0 Replies Latest reply on Oct 20, 2017 6:23 AM by vladodias

    Problem with JAX-WS when trying to parse a SOAP Fault

    vladodias

      Hi,

       

      I've found a potential bug in JAX-WS when trying to parse a SOAP Fault... description below... Where do I register this so it can be assessed and fixed?

       

      My webservice is returning a SOAP Fault like this…

       

       

      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

         <soap:Body xmlns:tns="http://www.esri.com/schemas/ArcGIS/10.1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

            <tns:Fault xmlns:my="urn:myNamespace" xmlns:tns="http://schemas.xmlsoap.org/soap/envelope/">

      <faultcode>tns:Client</faultcode>

      <faultstring>Not found - parcel_key = 283458</faultstring>

      <detail>

                  <exception>this is my exception</exception>

               </detail>

      </tns:Fault>

      </soap:Body>

      </soapenv:Envelope>

       

      When I try to call this web service, using JAX-WS, I get an unexpected NPE – Null Pointer Exception

       

       

      Exception in thread "main" javax.xml.ws.WebServiceException: java.lang.NullPointerException

              at com.sun.xml.internal.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:196)

              at com.sun.xml.internal.ws.client.dispatch.DispatchImpl.invoke(DispatchImpl.java:203)

              at cogc.test.Class1.main(Class1.java:93)

      Caused by: java.lang.NullPointerException

              at com.sun.xml.internal.ws.fault.ExceptionBean.isStackTraceXml(ExceptionBean.java:166)

              at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.attachServerException(SOAPFaultBuilder.java:276)

              at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:117)

              at com.sun.xml.internal.ws.client.dispatch.DispatchImpl.doInvoke(DispatchImpl.java:184)

              ... 2 more

       

      The cause seems to be this code…

       

       

      Possible solution would be…

       

      public static boolean isStackTraceXml(Element n) {

          return n.getLocalName().equals(LOCAL_NAME) && n.getNamespaceURI() != null && n.getNamespaceURI().equals(NS);

      }