ServerSOAPFaultException and how to read it?
Asked Answered
D

2

9

I did a request and my program spit out

WARNING: Input Action on WSDL operation Search and @Action on its associated Web Method search did not match and will cause problems in dispatching the requests
Exception in thread "main" com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Client error Please see the server log to find more detail regarding exact cause of the failure.
    at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:124)
    at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
    ....

I see via mitmproxy that the server sent back

<?xml version='1.0' encoding='utf-8'?>
<!--pageview_candidate-->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <soapenv:Fault>
      <faultcode>soapenv:Client</faultcode>
      <faultstring>Client error</faultstring>
      <faultactor>http://api.bing.net:80/soap.asmx</faultactor>
      <detail>
        <Errors xmlns="http://schemas.microsoft.com/LiveSearch/2008/03/Search">
          <Error>
            <Code>1001</Code>
            <Message>Required parameter is missing.</Message>
            <HelpUrl>http://msdn.microsoft.com/en-us/library/dd251042.aspx</HelpUrl>
            <Parameter>SearchRequest.AppId</Parameter>
          </Error>
          <Error>
            <Code>1001</Code>
            <Message>Required parameter is missing.</Message>
            <HelpUrl>http://msdn.microsoft.com/en-us/library/dd251042.aspx</HelpUrl>
            <Parameter>SearchRequest.Sources</Parameter>
          </Error>
        </Errors>
      </detail>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>

How do I read the first bit and get the details in the second bit? I don't have access to the server log, as in, the log on the server that hosts the web service.

I notice that the xml elements inside of soapenv:Fault don't have an xmlns. Is this how most SOAP errors are reported back? Is this a nonstandard way to do things? Am I going to have to rely completely on mitmproxy to debug these kinds of problems with web services?

Demirep answered 9/9, 2014 at 17:17 Comment(0)
M
8

You must create a SOAPHandler to intercept the SOAP response/fault.

Use this tutorial to learn how to create an handler and register it to the service port:

http://www.mkyong.com/webservices/jax-ws/jax-ws-soap-handler-in-client-side/

Then remember to override the handleFault(SOAPMessageContext) method to intercept server faults.

Mitrailleuse answered 9/9, 2014 at 19:4 Comment(0)
C
-1

Failure creating PFS order : com.sun.xml.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Internal Error Please see the server log to find more detail regarding exact cause of the failure.

Culture answered 5/5, 2022 at 0:24 Comment(1)
This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From ReviewGlialentn

© 2022 - 2024 — McMap. All rights reserved.