Announcement Announcement Module
Collapse
No announcement yet.
getSoapFault().getFaultDetail() throws org.springframework.ws.soap.axiom.AxiomSoapFau Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • getSoapFault().getFaultDetail() throws org.springframework.ws.soap.axiom.AxiomSoapFau

    Hello,


    We receive a WS response as a soapfault exception: in order to get detail about this exception, we are using method getFaultDetail():

    SoapFaultDetail soapFaultDetail = (sfce).getSoapFault().getFaultDetail();

    (ws-spring 1.5.9 deployed on weblogic 10.3.0/solaris 10)


    And we got the followwing XML exception:


    org.springframework.ws.soap.axiom.AxiomSoapFaultEx ception: Could not access fault: javax.xml.stream.XMLStreamException: Error at line:1 col:617 Got character[0] expected a valid XML character; nested exception is org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Error at line:1 col:617 Got character[0] expected a valid XML character
    at org.springframework.ws.soap.axiom.AxiomSoapFault.g etFaultDetail(AxiomSoapFault.java:57)


    Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Error at line:1 col:617 Got character[0] expected a valid XML character
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.nex t(StAXOMBuilder.java:260)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getNex tOMSibling(OMElementImpl.java:337)
    at org.apache.axiom.om.impl.traverse.OMChildrenQNameI terator.next(OMChildrenQNameIterator.java:118)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getFir stChildWithName(OMElementImpl.java:275)
    at org.apache.axiom.soap.impl.llom.soap11.SOAP11Fault Impl.getDetail(SOAP11FaultImpl.java:140)
    at org.springframework.ws.soap.axiom.AxiomSoapFault.g etFaultDetail(AxiomSoapFault.java:53)
    ... 15 more
    Caused by: javax.xml.stream.XMLStreamException: Error at line:1 col:617 Got character[0] expected a valid XML character
    at weblogic.xml.stax.XMLStreamReaderBase.advance(XMLS treamReaderBase.java:206)
    at weblogic.xml.stax.XMLStreamReaderBase.next(XMLStre amReaderBase.java:237)
    at javax.xml.stream.util.StreamReaderDelegate.next(St reamReaderDelegate.java:60)
    at org.apache.axiom.om.impl.builder.SafeXMLStreamRead er.next(SafeXMLStreamReader.java:183)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.par serNext(StAXOMBuilder.java:597)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.nex t(StAXOMBuilder.java:172)
    ... 20 more
    Caused by: Error at line:1 col:617 Got character[0] expected a valid XML character
    at weblogic.xml.babel.scanner.ScannerState.checkedRea d(ScannerState.java:625)
    at weblogic.xml.babel.scanner.CharData.read(CharData. java:65)
    at weblogic.xml.babel.scanner.Scanner.startState(Scan ner.java:296)
    at weblogic.xml.babel.scanner.Scanner.scan(Scanner.ja va:178)
    at weblogic.xml.babel.baseparser.BaseParser.accept(Ba seParser.java:533)
    at weblogic.xml.babel.baseparser.BaseParser.accept(Ba seParser.java:510)
    at weblogic.xml.babel.baseparser.EndElement.parse(End Element.java:34)
    at weblogic.xml.babel.baseparser.BaseParser.parseElem ent(BaseParser.java:457)
    at weblogic.xml.babel.baseparser.BaseParser.parseSome (BaseParser.java:326)
    at weblogic.xml.stax.XMLStreamReaderBase.advance(XMLS treamReaderBase.java:195




    We analysed the raw XML message with network monitor and its seems OK (XML well formatted).
    We noticed that if we set TRACE level in spring WS layer, the XML message is well marchalled and we got getFaultDetail() without XML exception.


    As a workaround, we decided to write a client interceptor to act like TRACE level:


    public class WebFaultInterceptor implements ClientInterceptor {

    public boolean handleFault(MessageContext messageContext)
    throws WebServiceClientException {
    try {
    String responseString = extractResponseString(messageContext);

    } catch (IOException e) {
    ...
    return true;
    }

    public boolean handleRequest(MessageContext messageContext) {
    return true;
    }

    public boolean handleResponse(MessageContext messageContext) {
    return true;
    }


    private String extractResponseString(MessageContext messageContext) throws IOException {
    String responseString = null;
    if (messageContext.hasResponse()) {
    ByteArrayOutputStream requestStream = new ByteArrayOutputStream();
    messageContext.getRequest().writeTo(requestStream) ;
    ByteArrayOutputStream responseStream = new ByteArrayOutputStream();
    messageContext.getResponse().writeTo(responseStrea m);
    responseString = responseStream.toString("UTF-8");
    }
    return responseString;
    }
    }



    This workaround looks like bugs in changelog "[SWS-588] - debug logging will hide parsing error on non well formed xml, and continue processing with incomplete xml" , but current 1.5.9 client spring ws release does not fix our current problem.


    Questions :
    Do you have explanations why TRACE level can fix our current problem ?
    How can i analyse this problem to fix it ?


    Thanks in advance for your response.


    regards,
    JF

  • #2
    Originally posted by jfdesmar View Post
    Hello,


    We receive a WS response as a soapfault exception: in order to get detail about this exception, we are using method getFaultDetail():

    SoapFaultDetail soapFaultDetail = (sfce).getSoapFault().getFaultDetail();

    (ws-spring 1.5.9 deployed on weblogic 10.3.0/solaris 10)


    And we got the followwing XML exception:


    org.springframework.ws.soap.axiom.AxiomSoapFaultEx ception: Could not access fault: javax.xml.stream.XMLStreamException: Error at line:1 col:617 Got character[0] expected a valid XML character; nested exception is org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Error at line:1 col:617 Got character[0] expected a valid XML character
    at org.springframework.ws.soap.axiom.AxiomSoapFault.g etFaultDetail(AxiomSoapFault.java:57)


    Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: Error at line:1 col:617 Got character[0] expected a valid XML character
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.nex t(StAXOMBuilder.java:260)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getNex tOMSibling(OMElementImpl.java:337)
    at org.apache.axiom.om.impl.traverse.OMChildrenQNameI terator.next(OMChildrenQNameIterator.java:118)
    at org.apache.axiom.om.impl.llom.OMElementImpl.getFir stChildWithName(OMElementImpl.java:275)
    at org.apache.axiom.soap.impl.llom.soap11.SOAP11Fault Impl.getDetail(SOAP11FaultImpl.java:140)
    at org.springframework.ws.soap.axiom.AxiomSoapFault.g etFaultDetail(AxiomSoapFault.java:53)
    ... 15 more
    Caused by: javax.xml.stream.XMLStreamException: Error at line:1 col:617 Got character[0] expected a valid XML character
    at weblogic.xml.stax.XMLStreamReaderBase.advance(XMLS treamReaderBase.java:206)
    at weblogic.xml.stax.XMLStreamReaderBase.next(XMLStre amReaderBase.java:237)
    at javax.xml.stream.util.StreamReaderDelegate.next(St reamReaderDelegate.java:60)
    at org.apache.axiom.om.impl.builder.SafeXMLStreamRead er.next(SafeXMLStreamReader.java:183)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.par serNext(StAXOMBuilder.java:597)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.nex t(StAXOMBuilder.java:172)
    ... 20 more
    Caused by: Error at line:1 col:617 Got character[0] expected a valid XML character
    at weblogic.xml.babel.scanner.ScannerState.checkedRea d(ScannerState.java:625)
    at weblogic.xml.babel.scanner.CharData.read(CharData. java:65)
    at weblogic.xml.babel.scanner.Scanner.startState(Scan ner.java:296)
    at weblogic.xml.babel.scanner.Scanner.scan(Scanner.ja va:178)
    at weblogic.xml.babel.baseparser.BaseParser.accept(Ba seParser.java:533)
    at weblogic.xml.babel.baseparser.BaseParser.accept(Ba seParser.java:510)
    at weblogic.xml.babel.baseparser.EndElement.parse(End Element.java:34)
    at weblogic.xml.babel.baseparser.BaseParser.parseElem ent(BaseParser.java:457)
    at weblogic.xml.babel.baseparser.BaseParser.parseSome (BaseParser.java:326)
    at weblogic.xml.stax.XMLStreamReaderBase.advance(XMLS treamReaderBase.java:195




    We analysed the raw XML message with network monitor and its seems OK (XML well formatted).
    We noticed that if we set TRACE level in spring WS layer, the XML message is well marchalled and we got getFaultDetail() without XML exception.


    As a workaround, we decided to write a client interceptor to act like TRACE level:


    public class WebFaultInterceptor implements ClientInterceptor {

    public boolean handleFault(MessageContext messageContext)
    throws WebServiceClientException {
    try {
    String responseString = extractResponseString(messageContext);

    } catch (IOException e) {
    ...
    return true;
    }

    public boolean handleRequest(MessageContext messageContext) {
    return true;
    }

    public boolean handleResponse(MessageContext messageContext) {
    return true;
    }


    private String extractResponseString(MessageContext messageContext) throws IOException {
    String responseString = null;
    if (messageContext.hasResponse()) {
    ByteArrayOutputStream requestStream = new ByteArrayOutputStream();
    messageContext.getRequest().writeTo(requestStream) ;
    ByteArrayOutputStream responseStream = new ByteArrayOutputStream();
    messageContext.getResponse().writeTo(responseStrea m);
    responseString = responseStream.toString("UTF-8");
    }
    return responseString;
    }
    }



    This workaround looks like bugs in changelog "[SWS-588] - debug logging will hide parsing error on non well formed xml, and continue processing with incomplete xml" , but current 1.5.9 client spring ws release does not fix our current problem.


    Questions :
    Do you have explanations why TRACE level can fix our current problem ?
    How can i analyse this problem to fix it ?


    Thanks in advance for your response.


    regards,
    JF

    Hello,

    in order to find what is wrong with following trace (STAX XML parsing) :


    at weblogic.xml.stax.XMLStreamReaderBase.advance(XMLS treamReaderBase.java:206)
    at weblogic.xml.stax.XMLStreamReaderBase.next(XMLStre amReaderBase.java:237)


    i tried to choose an another Streaming XML parser : i found SJSXP , The Sun Java Streaming XML Parser.

    I set :
    + sjsxp.jar in prefix of my classpath.
    + javax.xml.stream.XMLInputFactory=com.sun.xml.strea m.ZephyrParserFactory as system property for the JVM.

    And the problem is FIXED with theses parameters.


    Does there is a way to configue the System property "javax.xml.stream.XMLInputFactory" as a bean property for the bean AxiomSoapMessageFactory :

    <bean id="messageFactory" class="org.springframework.ws.soap.axiom.AxiomSoap MessageFactory" />


    Thanks in advance for your response.

    regards,
    JF.Desmarais

    Comment


    • #3
      Hello,

      i noticed in ws spring 2.0.1 the following improvement :

      [SWS-650] - AxiomSoapMessageFactory does not provide way to set properties on XMLInputFactory

      and i looked at the source code


      AxiomSoapMessageFactory 2.0.1
      +++++++++++++++++++++++++

      private final XMLInputFactory inputFactory = createXmlInputFactory();



      /**
      * Create a {@code XMLInputFactory} that this resolver will use to create {@link XMLStreamReader} objects.
      * <p/>
      * Can be overridden in subclasses, adding further initialization of the factory. The resulting factory is cached,
      * so this method will only be called once.
      *
      * @return the created factory
      */
      protected XMLInputFactory createXmlInputFactory() {
      return XMLInputFactory.newInstance();
      }


      AxiomSoapMessageFactory 1.5.9
      +++++++++++++++++++++++++

      private XMLInputFactory inputFactory;

      /** Default constructor. */
      public AxiomSoapMessageFactory() {
      inputFactory = XMLInputFactory.newInstance();
      }


      question:
      =======


      does there is a way in java to perform the same in release 1.5.9 (because XMLInputFactory is a private member and not vissible in an extend) ?

      thanks in advance for your response.

      regards,

      jf

      Comment

      Working...
      X