ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gaurav Goyal <gaurav.ga.go...@oracle.com>
Subject RE: Need to file a bug/request for making sopa.jar to use for HTTP/1.1
Date Tue, 03 Jul 2018 09:07:17 GMT
 

Hi All,

 

We are having one product in which we are using SOAP.

Our customer does not want to use any HTTP/1.0 request so asking us to upgrade to use HTTP/1.1.

We did investigation and found that HTTP/1.0 is being hard coded in soap.jar so we cannot
really change this.

 

Class : org.apache.soap.util.net.HYPERLINK "http://svn.apache.org/repos/asf/webservices/archive/soap/branches/xml-soap-2_1/java/src/org/apache/soap/util/net/HTTPUtils.java"HTTPUtils.java

 

Code :
-------------------------------------------------------------------
  public static TransportMessage post(URL url, TransportMessage 
transportmessage, int i, String s, int j, int k, Boolean boolean1) 
        throws IllegalArgumentException, IOException, SOAPException 
    { 
        OutputStream outputstream = null; 
        InputStream inputstream = null; 
        Object obj = null; 
        int l; 
        Socket socket; 
        try 
        { 
            l = getPort(url); 
            socket = buildSocket(url, l, i, s, j, boolean1); 
            if(url.getProtocol().equalsIgnoreCase("HTTPS")) 
                s = null; 
            if(i > 0) 
                socket.setSoTimeout(i); 
            outputstream = socket.getOutputStream(); 
            inputstream = socket.getInputStream(); 
        } 
        catch(Exception exception) 
        { 
            Object obj1 = exception; 
            if(obj1 instanceof InvocationTargetException) 
                obj1 = 
((InvocationTargetException)obj1).getTargetException(); 
            throw new IllegalArgumentException("Error opening socket: " + 
obj1); 
        } 
        String s1 = s != null ? url.toString() : url.getFile(); 
        if(s1.length() == 0) 
            s1 = "/"; 
        StringBuffer stringbuffer = new StringBuffer(); 
        stringbuffer.append("POST").append(' ').append(s1).append(" 
HTTP/").append("1.0").append("\r\n").append("Host").append(": 
").append(url.getHost()).append(':').append(l).append("\r\n").append("Content- 
Type").append(": 
").append(transportmessage.getContentType()).append("\r\n").append("Content-Le 
ngth").append(": 
").append(transportmessage.getContentLength()).append("\r\n"); 
        Object obj2; 
        for(Enumeration enumeration = transportmessage.getHeaderNames(); 
enumeration.hasMoreElements(); stringbuffer.append(obj2).append(": 
").append(transportmessage.getHeader((String)obj2)).append("\r\n")) 
            obj2 = enumeration.nextElement(); 

        stringbuffer.append("\r\n"); 
        BufferedOutputStream bufferedoutputstream = new 
BufferedOutputStream(outputstream, k); 
         
bufferedoutputstream.write(stringbuffer.toString().getBytes("iso-8859-1")); 
        transportmessage.writeTo(bufferedoutputstream); 
        bufferedoutputstream.flush(); 
        outputstream.flush(); 
        BufferedInputStream bufferedinputstream = new 
BufferedInputStream(inputstream); 
        boolean flag = false; 
        Object obj3 = null; 
        StringBuffer stringbuffer1 = new StringBuffer(); 
        int j1 = 0; 
        do 
        { 
            if(j1 == 10 || j1 == -1) 
                break; 
            j1 = bufferedinputstream.read(); 
            if(j1 != 10 && j1 != 13 && j1 != -1) 
                stringbuffer1.append((char)j1); 
        } while(true); 
        String s3 = stringbuffer1.toString(); 
        try 
        { 
            StringTokenizer stringtokenizer = new StringTokenizer(s3); 
            stringtokenizer.nextToken(); 
            int i1 = Integer.parseInt(stringtokenizer.nextToken()); 
            StringBuffer stringbuffer2 = new StringBuffer(); 
            do 
            { 
                if(!stringtokenizer.hasMoreTokens()) 
                    break; 
                stringbuffer2.append(stringtokenizer.nextToken()); 
                if(stringtokenizer.hasMoreTokens()) 
                    stringbuffer2.append(" "); 
            } while(true); 
            String s2 = stringbuffer2.toString(); 
        } 
        catch(Exception exception1) 
        { 
            throw new IllegalArgumentException("Error parsing HTTP status 
line \"" + s3 + "\": " + exception1); 
        } 
        ByteArrayDataSource bytearraydatasource = new 
ByteArrayDataSource(bufferedinputstream, "iso-8859-1"); 
        byte abyte0[] = bytearraydatasource.toByteArray(); 
        Hashtable hashtable = new Hashtable(); 
        int k1 = -1; 
        String s4 = null; 
        StringBuffer stringbuffer3 = new StringBuffer(); 
        StringBuffer stringbuffer4 = new StringBuffer(); 
        boolean flag1 = true; 
        int l1; 
        for(l1 = 0; l1 < abyte0.length; l1++) 
        { 
            if(abyte0[l1] == 10) 
            { 
                if(stringbuffer3.length() == 0) 
                    break; 
                String s5 = stringbuffer3.toString(); 
                int i2 = stringbuffer4.length(); 
                if(i2 > 0 && stringbuffer4.charAt(i2 - 1) == ';') 
                    stringbuffer4.deleteCharAt(i2 - 1); 
                String s6 = stringbuffer4.toString(); 
                if(s5.equalsIgnoreCase("Content-Length")) 
                    k1 = Integer.parseInt(s6); 
                else 
                if(s5.equalsIgnoreCase("Content-Type")) 
                    s4 = s6; 
                else 
                    hashtable.put(s5, s6); 
                stringbuffer3 = new StringBuffer(); 
                stringbuffer4 = new StringBuffer(); 
                flag1 = true; 
                continue; 
            } 
            if(abyte0[l1] == 13) 
                continue; 
            if(flag1) 
            { 
                if(abyte0[l1] == 58) 
                { 
                    flag1 = false; 
                    if(l1 != abyte0.length - 1 && abyte0[l1 + 1] == 32) 
                        l1++; 
                } else 
                { 
                    stringbuffer3.append((char)abyte0[l1]); 
                } 
            } else 
            { 
                stringbuffer4.append((char)abyte0[l1]); 
            } 
        } 

        InputStream inputstream1 = bytearraydatasource.getInputStream(); 
        inputstream1.skip(l1 + 1); 
        if(k1 < 0) 
            k1 = bytearraydatasource.getSize() - l1 - 1; 
        TransportMessage transportmessage1; 
        try 
        { 
            SOAPContext soapcontext = new SOAPContext(); 
            transportmessage1 = new TransportMessage(inputstream1, k1, s4, 
soapcontext, hashtable); 
            transportmessage1.read(); 
        } 
        catch(MessagingException messagingexception) 
        { 
            throw new IllegalArgumentException("Error parsing response: " + 
messagingexception); 
        } 
        bufferedoutputstream.close(); 
        outputstream.close(); 
        bufferedinputstream.close(); 
        inputstream.close(); 
        socket.close(); 
        return transportmessage1; 
    } 

-------------------------------------------------------------------


Even I had verified the higher version 2.3.1 of soap release, still has the same code.

So can you raise a bug/SR for making this configurable or to use any other solution.

Or do we have some workaround solution already for this.

 

Thanks.

 

Regards.

Gaurav

Mime
View raw message