Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why Getting Fault Code in SOAP Response Message

 
somia razzaq
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi !!!
I am using SAAJ to display the request and response maessages generated by my web service. I am successful to get soap request message but at respose, i get the following fault message. why this happens? where i am wrong. Kindly help me.

Response:

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns3="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:Client</faultcode><faultstring>Cannot find dispatch method for {}</faultstring></S:Fault>
</S:Body>
</S:Envelope>

Best Wishes!!!
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
The value Client in the <faultcode> element indicates that there was something wrong with the request message; most likely it is malformed in some way.
To find the cause of this error, I suggest using soapUI to create and send a valid request message to the service and then compare it to the request message you construct in the code using SAAJ.
Best wishes!
 
somia razzaq
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Krizsan wrote:Hi!
The value Client in the <faultcode> element indicates that there was something wrong with the request message; most likely it is malformed in some way.
To find the cause of this error, I suggest using soapUI to create and send a valid request message to the service and then compare it to the request message you construct in the code using SAAJ.
Best wishes!




I use soapUI to test soap request and response messages. Given following:

Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sim="http://j2ee.netbeans.org/wsdl/simple_WSDL">
<soapenv:Header/>
<soapenv:Body>
<sim:simple_WSDLOperation>
<Age>?</Age>
<Name>?</Name>
</sim:simple_WSDLOperation>
</soapenv:Body>
</soapenv:Envelope>


Response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sim="http://j2ee.netbeans.org/wsdl/simple_WSDL" xmlns:sim1="http://xml.netbeans.org/schema/simple_schema">
<soapenv:Header/>
<soapenv:Body>
<sim:simple_WSDLOperationResponse>
<student_object>
<sim1:Age>?</sim1:Age>
<sim1:Name>?</sim1:Name>
</student_object>
</sim:simple_WSDLOperationResponse>
</soapenv:Body>
</soapenv:Envelope>

I have error in both. Can you tell me about this error and how i remove it ?

Best Wishes.
 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
It looks like you receive a good response when using soapUI. The next step, as I said before, would be to compare the request from soapUI with the request from your client. My guess is that there is something wrong with your client and it sends bad requests to the service, which then returns a fault.
Best wishes!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic