aspose file tools*
The moose likes Web Services and the fly likes Want to understand SOAP Exception's meaning? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "Want to understand SOAP Exception Watch "Want to understand SOAP Exception New topic
Author

Want to understand SOAP Exception's meaning?

Ketan KC Chachad
Ranch Hand

Joined: Nov 23, 2003
Posts: 76
Hi,
I am getting the following 2 exceptions whenever the invoke() method is called on a SOAP Call object.
1. [SOAPException: faultCode=SOAP-ENV:Client; msg=Error parsing HTTP status line "": java.util.NoSuchElementException; targetException=java.lang.IllegalArgumentException: Error parsing HTTP status line "": java.util.NoSuchElementException]
2. [SOAPException: faultCode=SOAP-ENV:Client; msg=Connection reset by peer: socket write error; targetException=java.net.SocketException: Connection reset by peer: socket write error]
Can anyone help in understanding the cause for the exceptions being thrown?


Regards,<br />Ketan KC Chachad
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Have you checked what the wire-traffic looks like? (using tools such as org.apache.axis.utils.tcpmon or net.grinder.TCPSniffer)


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ketan KC Chachad
Ranch Hand

Joined: Nov 23, 2003
Posts: 76
The exception posted by me happens in a client application which was recently modified by me. Earlier this application used to perform a transfer of data in a sequential form i.e. first the client used to send data to the server and then receive data from the server. This flow was changed so that both the processes could happen simultaneously using threads.
When the current modified client application is executed then the posted exceptions are thrown but when the old sequential client application is executed then the exceptions are not thrown. Is threading the cause of such exceptions being thrown? And is the wire-traffic the only reason for such exceptions to arise?
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Ketan Chachad:
And is the wire-traffic the only reason for such exceptions to arise?

I assume that by 'wire-traffic' Lasse mean to say the messages that was sent from client to server and then server to client.
TCP Monitor or TCP Sniffer will help you to tell what exactly you sent (that is the HTTP message)from the client to the server and vice versa, which inturn helps you to debug the error message
more info can be found here http://ws.apache.org/axis/java/user-guide.html , look at the appendix "Using the Axis TCP Monitor (tcpmon)"


Spritle Software Blogs
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Balaji guessed right. With such logging proxies such as tcpmon and TCPSniffer, you can see whether the communication between two systems is what you expect it to be. That helps you to locate the source of the problem into a slightly smaller area.
By the way, my preference between the two tools mentioned is the TCPSniffer from the Grinder project. It's a command-line utility and somehow feels more simple to use.
[ November 24, 2003: Message edited by: Lasse Koskela ]
Ketan KC Chachad
Ranch Hand

Joined: Nov 23, 2003
Posts: 76
Thanks for the prompt replies .... but I have never used Axis or Grinder so it will take me some time to understand their working and hence figure out what the actual problem is. In the mean time I would like show you the code that is throwing the exception.
  • [SOAPException: faultCode=SOAP-ENV:Client; msg=Error parsing HTTP status line "": java.util.NoSuchElementException; targetException=java.lang.IllegalArgumentException: Error parsing HTTP status line "": java.util.NoSuchElementException] Exception message is thrown when I call an authenticate method on the server. The code is as follows:


  • Here
  • [list]mSoapCall is a reference of type org.apache.soap.rpc.Call,
  • mvecParams is a vector,
  • authent is the string to be authenticated by the server,
  • mstrBranchID is the id against the string is to be authenticated and
  • mSoapResponse is a reference of type org.apache.soap.rpc.Response.

  • The exception gets thrown when mSoapCall.invoke() gets executed.
    Similarly the exception
  • [SOAPException: faultCode=SOAP-ENV:Client; msg=Connection reset by peer: socket write error; targetException=java.net.SocketException: Connection reset by peer: socket write error]

  • gets thrown during the execution of the following code

    where,
  • mSoapCall is a reference of type org.apache.soap.rpc.Call
  • mvecParams is a reference of type Vector
  • strFileName is the name of the file
  • content is actually the content of the file given by strFileName and
  • mSoapResponse is a reference of type org.apache.soap.rpc.Response.
  • [/LIST]
    [ November 24, 2003: Message edited by: Ketan Chachad ]
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Hmm. That doesn't ring any bells in my head. Sorry.
    Regarding the learning curve for Grinder's TCPSniffer, here's all you need to do:
    java -classpath grinder.jar net.grinder.TCPSniffer -localPort 8081 -remotePort 8080
    That will make the TCPSniffer to proxy traffic coming to 8081 into port 8080 and logging all traffic into the standard output.
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    The below given stack trace is another exception thrown but this being on the server side.

    Also the command that you have given i.e.
    java -classpath grinder.jar net.grinder.TCPSniffer -localPort 8081 -remotePort 8080
    where do I execute this line? on the client machine or on the server machine? And if the client machine connects to the server through a proxy then should the proxy details be also given, if yes then how? Better still can you give me a link where I can get more information about TCPSniffer.
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Here's the user guide for Grinder. You can basically run the TCPSniffer anywhere.
    For example, if you have two separate machines -- one for the client and one for the service -- you're probably going to run the TCPSniffer on the client machine and point the client application to "localhost:xxxx" instead of "remote:yyyy" (TCPSniffer will forward any TCP/IP traffic from "localhost:xxxx" to "remote:yyyy"). You could run the sniffer on the server machine too, unless it's out of your control (a live 3rd party web service, for example).
    If you have only one machine, you obviously run the TCPSniffer on that machine. In this case, you just have to run the sniffer and the server on different port numbers (i.e. from localhost:5001 to localhost:5002 etc.).
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    hey thanks for the grinder manual's link .... but my question still remains as is ..... to help you to help me let me explain you the complete architecture of the system I am working with
    There is an Apache Tomcat Server (remotehost) on which the server application is executing as a web service.
    It is accessed by the clients via the HTTP URL http://<remotehost>:8000/soap/servlet/rpcrouter.
    If the client machine is behind a firewall, the proxy host is set at 192.168.0.1 and the proxy port is set at 8080.
    Now if I have to start TCPSniffer at the client's end should I give the command line as
    java net.grinder.TCPSniffer -localHost <proxyhost> -localPort 8080 -remoteHost <remotehost> -remotePort <8000>
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    Hi there finally used TCPSniffer but I am not sure if it is right .... please correct me if I am wrong. Here it is:
    1. I gave the following command line java net.grinder.TCPSniffer -remoteHost 192.168.0.1 -remotePort 8080 where 192.168.0.1 is the proxy Host and 8080 is the proxy Port.
    2. Then I started the client application in which I gave the proxy host as localhost and proxy port as 8001 which are the default values of TCPSniffer.
    3. Now TCPSniffer generated a whole load of output which I was to see .
    But now the task of understand what TCPSniffer has outputed is where I again require help . Can you help me in understanding the output?
    Balaji Loganathan
    author and deputy
    Bartender

    Joined: Jul 13, 2001
    Posts: 3150
    Originally posted by Ketan Chachad:
    3. Now TCPSniffer generated a whole load of output which I was to see .
    But now the task of understand what TCPSniffer has outputed is where I again require help . Can you help me in understanding the output?

    I haven't used the TCPSniffer, but plz check what httpsniffer.out and httpsniffer.err where telling. If my guessing is right then it shd show the messages that went through between client and server.
    Try to see what the message(soap request) your client sent and waht was the soap response from your server.
    if you can't get, then please post output here.
    regards
    Balaji
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    Where can I find httpsniffer.out and httpsniffer.err? Also a question to Lasse, last time you said that I could run TCPSniffer on the server too ... in this case how do I give the command? And then where do I find the previously quoted files? Also I did execute the TCPSniffer on the client machine (Windows 95) and it gave loads of output on the screen (i.e. standard output) as previously said by me. How do I just display the SOAP messages exchanged in this case? But I want the command to execute TCPSniffer on the server more urgently. Thanks in advance
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Where can I find httpsniffer.out and httpsniffer.err?
    Have you searched for them? I can't remember where they go.
    Also a question to Lasse, last time you said that I could run TCPSniffer on the server too ... in this case how do I give the command?
    You give the same command as on the client. The TCPSniffer only proxies traffic from one port to another and back -- it doesn't care whether it's on the "server-side" or on the "client-side".
    Also I did execute the TCPSniffer on the client machine (Windows 95) and it gave loads of output on the screen (i.e. standard output) as previously said by me. How do I just display the SOAP messages exchanged in this case?
    I don't think there is a way to just display the SOAP messages, unless you switch to some other tool. TCPSniffer is not a SOAP-sniffer but a TCP-sniffer...
    But I want the command to execute TCPSniffer on the server more urgently.
    Umm, what do you mean "more urgently"?
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    Lasse said:
    Have you searched for them? I can't remember where they go.

    I made a search on the whole server and did not find it.
    Also the command I gave on the server is
    java -classpath /usr/local/reconvert/grinder.jar net.grinder.TCPSniffer -remoteHost 192.168.0.1 -remotePort 8000 -localHost 202.63.169.10 -localPort 8000, is this correct? The IP address given with remoteHost is the interface at which Tomcat was listening to client requests and now it is forwarded via the localHost address given to TCPSniffer.
    And sorry for the "more urgent" statement in my last post .
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    I don't think you can use the same port number for both remote and local. Otherwise the command-line looks good to me.
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    I made a search on the whole server and did not find it.
    The manual tells us that the two files are produced only by the Sniff'n'Grind web application, not by the command-line client alone. Although it looks like those files wouldn't give you any more information than the regular output you're seeing when running TCPSniffer from the command-line.
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    Hmmm well I executed the command given by me and it is giving me an output and not throwing any errors. Can you explain the proxy option to me a bit more clearly. Also the output generated is not showing any errors inspite of the client program showing them and NullPointerExceptions being thrown by the server program. So I am more now so pls help
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Could you post the output from the console?
    Meanwhile, here's a piece of the output from TCPSniffer for a project I'm working on in which two systems communicate using custom XML messages over HTTP (POST):The "----- host:port->host:port -----" lines tell you to which direction the following piece of data was moving (client->server or server->client). Everything in between is the raw character data being transmitted. In this example, the outgoing stuff is a regular HTTP POST request with an XML document in the body, and the incoming stuff is a regular HTTP response with a response XML document in the body.
    [ November 27, 2003: Message edited by: Lasse Koskela ]
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    hey thanks for the sample output. Although the TCPSniffer running on the server is giving huge scary output. I ran the same on the client machine and it gave me the following output with the exception thrown at the client side.

    --- localhost:1146->192.168.0.1:8080 opened --
    --- 192.168.0.1:8080->localhost:1146 opened --
    ------ localhost:1146->192.168.0.1:8080 ------
    POST http://202.63.169.10:8000/soap/servlet/rpcrouter HTTP/1.0
    Host: 202.63.169.10
    Content-Type: text/xml; charset=utf-8
    Content-Length: 497
    SOAPAction: ""
    <?xml version='1.0' encoding='UTF-8'?>
    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body>
    <ns1:authenticate xmlns:ns1="urn:receive" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <authent xsi:type="xsd:string">IMS</authent>
    <center xsi:type="xsd:string">99</center>
    </ns1:authenticate>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    --- localhost:1143->192.168.0.1:8080 closed --
    --- 192.168.0.1:8080->localhost:1143 closed --
    ------ 192.168.0.1:8080->localhost:1146 ------
    HTTP/1.0 500 Internal Server Error
    Server: Squid/2.3.STABLE4
    Mime-Version: 1.0
    Date: Thu, 27 Nov 2003 12:28:23 GMT
    Content-Type: text/html
    Content-Length: 682
    Expires: Thu, 27 Nov 2003 12:28:23 GMT
    X-Squid-Error: ERR_READ_ERROR 104
    X-Cache: MISS from SERVER1
    Proxy-Connection: close
    <HTML><HEAD>
    <TITLE>ERROR: The requested URL could not be retrieved</TITLE>
    </HEAD><BODY>
    <H1>ERROR</H1>
    <H2>The requested URL could not be retrieved</H2>
    <HR>
    <P>
    While trying to retrieve the URL:
    <A HREF="[no URL]">[no URL]</A>
    <P>
    The following error was encountered:
    <UL>
    <LI>
    <STRONG>
    Read Error
    </STRONG>
    </UL>
    <P>
    The system returned:
    <PRE><I> (104) Connection reset by peer</I></PRE>
    <P>
    An error condition occurred while reading data from the network. Please
    retry your request.
    <P>Your cache administrator is <A HREF="mailto:root">root</A>.
    <br clear="all">
    <hr noshade size=1>
    Generated Thu, 27 Nov 2003 12:28:23 GMT by SERVER1 (Squid/2.3.STABLE4)
    </BODY></HTML>
    --- 192.168.0.1:8080->localhost:1146 closed --
    --- localhost:1146->192.168.0.1:8080 closed --

    Hope this can help you in telling me what could be wrong? Thanks again
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    Hi,
    I have a question about TCPSniffer .... my program connects to the server at IP Address 202.63.169.10 and Port 8000 using a URL and SOAPHttpConnection. Now if I am using TCPSniffer do I have to change this URL in the program itself? I actually gave the following java command
    java net.grinder.TCPSniffer as I assumed that the default local host and port to be the proxy for the client application and the below exception stack trace was shown

    Does this mean that the local host and port that the TCPSniffer is sniffing at cannot be treated as the proxy host and port for the client application? And do I have to specify the remote Host and port as the actual IP address and port where the server is acutally awaiting client connections?
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Your client needs to either use the sniffer's address/port as the endpoint (instead of the actual web service's address/port), or use the sniffer's address/port as a HTTP proxy (I'm not sure how this proxy thing works, though).
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    Hey thanks ..... that helped a lot but my problem is not getting solved with the tool ..... can you suggest me some book / link / reference for apache tomcat because the tomcat server is logging some null pointer and io exceptions.
    Lasse Koskela
    author
    Sheriff

    Joined: Jan 23, 2002
    Posts: 11962
        
        5
    Here are some places to look for answers:
    1) The source
    2) The documentation
    3) The community
    Ketan KC Chachad
    Ranch Hand

    Joined: Nov 23, 2003
    Posts: 76
    Hi Lasse,
    Thanks for those links, they were a great help.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Want to understand SOAP Exception's meaning?
     
    Similar Threads
    Secured Websevice in Applet
    Proxy error : 10016
    Connector Not Available Exception, Websphere 6.0
    SOAP and java.net.SocketException
    Information required regarding SOAPExceptions