XML : WSO2 ESB Proxy - XML Error

I've implemented a content based router proxy (CBR) that analyze XML and dispatch the request to the right end point according to the XML content. It works perfectly but it has problems when the ESB receive a SOAP response with attachment.

In more detail the CBR proxy works like it: Inseq:

  1. Extract using XPATH the service
  2. Create the right XML
  3. Send the SOAP request to the remote server

Outseq:

  1. Receive the XML response
  2. Apply XSLT to transform the response
  3. Send back the response to the client

Now, as said, the proxy works right when it handles SOAP request without attachment but when the response holds an attachment it gives this error:

      org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,913]  Message: Invalid byte 2 of 3-byte UTF-8 sequence.      at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)      at org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:653)      at org.apache.axiom.om.impl.llom.OMElementImpl.getFirstOMChild(OMElementImpl.java:670)      at org.apache.axiom.om.impl.llom.OMElementImpl.getChildren(OMElementImpl.java:352)      at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:553)      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)      at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)      at org.apache.axiom.om.impl.util.OMSerializerUtil.serializeChildren(OMSerializerUtil.java:555)      at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:875)      at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:230)      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:125)      at org.apache.axiom.om.impl.llom.OMSerializableImpl.serialize(OMSerializableImpl.java:113)      at org.apache.axiom.om.impl.llom.OMElementImpl.toString(OMElementImpl.java:988)      at java.lang.String.valueOf(String.java:2847)      at java.lang.StringBuffer.append(StringBuffer.java:232)      at org.apache.synapse.mediators.builtin.LogMediator.getFullLogMessage(LogMediator.java:184)      at org.apache.synapse.mediators.builtin.LogMediator.getLogMessage(LogMediator.java:123)      at org.apache.synapse.mediators.builtin.LogMediator.mediate(LogMediator.java:91)      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:77)      at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:47)      at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:131)      at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:268)      at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:488)      at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:170)      at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)      at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:225)      at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)      at java.lang.Thread.run(Thread.java:745)  Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,913]  Message: Invalid byte 2 of 3-byte UTF-8 sequence.      at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:596)      at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)      at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:34)      at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)      at org.apache.axiom.util.stax.dialect.SJSXPStreamReaderWrapper.next(SJSXPStreamReaderWrapper.java:138)      at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)      at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)      ... 30 more    

I've tried several type of end point like SwA and MOM but it doesn't solve the problem. By the way, the response doesn't arrive to the out sequence. The log is shown below:

  15:16:26,215 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER To: /services/ESBService.ESBServiceHttpSoap12Endpoint, WSAction: urn:doService, SOAPAction: urn:doService, MessageID: urn:uuid:c5a390d2-f37d-4cb9-8158-52fcbe2ab576, Direction: request, Envelope: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:esb="http://esb.xxx" xmlns:ws="http://ws.xxxx"><soap:Body>        <esb:doService>           <!--Optional:-->           <esb:payload>                                   ....           </esb:payload>             <esb:serviceId>serviceName</esb:serviceId>           <esb:actionId>actionId</esb:actionId>        </esb:doService>     </soap:Body></soap:Envelope>  15:16:26,215 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Log mediator  15:16:26,216 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Property mediator  15:16:26,216 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Setting property : serviceId at scope : default to : igrue (i.e. result of expression : //q0:doService/q0:serviceId)  15:16:26,217 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Property mediator  15:16:26,217 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Property mediator  15:16:26,218 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Setting property : actionId at scope : default to : getEsiti (i.e. result of expression : //q0:doService/q0:actionId)  15:16:26,218 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Property mediator  15:16:26,218 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Property mediator  15:16:26,218 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Setting property : filepath at scope : default to : file:./repository/..... (i.e. result of expression : fn:concat('file:./repository/xxx/', //q0:doService/q0:serviceId))  15:16:26,219 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Property mediator  15:16:26,219 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Property mediator  15:16:26,219 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Unable to find a match for regx : <value>(.+?)</value> with the property value :  15:16:26,220 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Setting property : EPR at scope : default to :  (i.e. result of expression : get-property('registry',$ctx:filepath))  15:16:26,220 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Property mediator  15:16:26,220 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Property mediator  15:16:26,221 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Setting property : inseq at scope : default to : sequence/service-in.xml (i.e. result of expression : fn:concat('sequence/', fn:concat(//q0:doService/q0:serviceId,'-in.xml')))  15:16:26,221 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Property mediator  15:16:26,221 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Property mediator  15:16:26,222 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Setting property : outfilter at scope : default to : sequence/seq_name.xml (i.e. result of expression : fn:concat('sequence/', fn:concat(//q0:doService/q0:serviceId,'-out.xml')))  15:16:26,222 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Property mediator  15:16:26,222 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Property mediator  15:16:26,224 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Setting property : serviceAct at scope : default to :               ........  15:16:26,224 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Property mediator  15:16:26,224 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Header mediator  15:16:26,225 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Set SOAP header : To to :   15:16:26,225 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Header mediator  15:16:26,225 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : BAM mediator  15:16:26,228 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : BAM mediator  15:16:26,228 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Sequence key=<Value {name ='null', expression =get-property('inseq')}>  15:16:26,232 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Executing with key Value {name ='null', expression =get-property('inseq')}  15:16:26,232 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Sequence <igrue-in>  15:16:26,232 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Sequence <SequenceMediator> :: mediate()  15:16:26,233 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Mediation started from mediator position : 0  15:16:26,233 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Property mediator  15:16:26,233 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Setting property : DISABLE_CHUNKING at scope : axis2 to : true (i.e. constant : true)  15:16:26,233 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Property mediator  15:16:26,233 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Header mediator  15:16:26,234 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Removing SOAP Header : Action  15:16:26,234 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Header mediator  15:16:26,234 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : XSLT mediator  15:16:26,239 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER output method: xml; encoding: null  15:16:26,240 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Using org.apache.synapse.util.jaxp.StreamSourceBuilder  15:16:26,240 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Using org.apache.synapse.util.jaxp.StreamResultBuilder  15:16:26,242 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Transformation completed - processing result  15:16:26,243 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Replace node with result  15:16:26,243 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : XSLT mediator  15:16:26,243 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Start : Send mediator  15:16:26,243 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER Sending message through endpoint : igrue resolving to address = http://ip:8080/remote_ws  15:16:26,243 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER SOAPAction: null  15:16:26,244 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER WSA-Action: null  15:16:26,254 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Send mediator  15:16:26,254 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Sequence <service-in>  15:16:26,254 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Sequence key=<Value {name ='null', expression =get-property('inseq')}>  15:16:26,254 [-] [PassThroughMessageProcessor-5]  INFO TRACE_LOGGER End : Sequence <anonymous>  15:16:26,291 [-] [PassThroughMessageProcessor-6]  INFO TRACE_LOGGER Start : Sequence <anonymous    

When it receive the respone i get the error shown above. Can you help me?

No comments:

Post a Comment