5
votes

I'm using wso2esb 4.7.0 and wso2dss 3.0.0..I have written a query in wso2dss.It's working fine in dss. also but when i wish to work with wso2esb in sequence mediator it shows error as above

 ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:204)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
    at org.apache.axiom.om.impl.AbstractOMMetaFactory.createStAXSOAPModelBuilder(AbstractOMMetaFactory.java:73)
    at org.apache.axiom.om.impl.AbstractOMMetaFactory.createSOAPModelBuilder(AbstractOMMetaFactory.java:79)
    at org.apache.axiom.om.OMXMLBuilderFactory.createSOAPModelBuilder(OMXMLBuilderFactory.java:196)
    at org.apache.axis2.builder.SOAPBuilder.processDocument(SOAPBuilder.java:55)
    at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:118)
    at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:116)
    at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:91)
    at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:62)
    at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
    at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:232)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:443)
    at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:166)
    at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
    at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:222)
    at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:677)
    at com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:2116)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2022)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1114)
    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.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
    ... 20 more

        .
        .

My proxy service is :

<inSequence>
         <property name="messageType" value="application/json" scope="axis2"/>
         <property name="username"
                   expression="//username/text()"
                   scope="default"
                   type="STRING"/>
         <property name="userid"
                   expression="//userid/text()"
                   scope="default"
                   type="STRING"/>
         <log>
            <property name="username" expression="get-property('username')"/>
            <property name="userid" expression="get-property('userid')"/>
         </log>
         <payloadFactory media-type="xml">
            <format>
               <p:trail_op xmlns:p="http://ws.wso2.org/dataservice">
                  <p:username>$1</p:username>
                  <p:userid>$2</p:userid>
               </p:trail_op>
            </format>
            <args>
               <arg evaluator="xml" expression="get-property('username')"/>
               <arg evaluator="xml" expression="get-property('userid')"/>
            </args>
         </payloadFactory>
         <header name="Action" value=""/>
         <property name="SOAPAction" value="" scope="transport"/>
         <send receive="Capp_Login_seq1">
            <endpoint>
               <address uri="http://192.168.1.23:9764/services/Capp_muser_dataservice/"
                        format="soap12"/>
            </endpoint>
         </send>
         <log level="full"/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>

and sequence is:

 <sequence xmlns="http://ws.apache.org/ns/synapse" name="Capp_Login_seq1">
   <property name="messageType" value="application/json" scope="axis2"/>
   <property xmlns:ns="http://org.apache.synapse/xsd" xmlns:s="http://ws.wso2.org/dataservice" name="userid" expression="get-property('userid')" scope="default" type="STRING"/>
   <log>
      <property xmlns:ns="http://org.apache.synapse/xsd" name="userid" expression="get-property('userid')"/>
   </log>
   <send/>
</sequence>

I'm sending request like:

curl -v -H "Accept:application/json" -H "Content-Type:application/json"  -d '{"username":"Harry","userid":"347367127872701992"}' http://youtility-desktop:8282/services/Capp_LoginProxy

How should i fix the error? Please let me know..

1
what isthe request you sent ?chanaka777
curl -v -H "Accept:application/json" -H "Content-Type:application/json" -d '{"mailid":"[email protected]",phonenumber":"999999999"}' youtility-desktop:8282/services/Capp_muser_Registrationuser3129056
What about your log mediators ? Are they getting printed ? You cannot use XPATH expressions to manipulate a json request. Try this <property name="username" expression="json-eval($.username)"/> For more info refer thischanaka777
thanks chanaka777 for reply..I got the answer..This error is actually in dss but showing it in esb..I have to make changes in operation section while writing query at dss.. Return Request Status checkbox must be on..user3129056

1 Answers

1
votes

I got the same issue in ESB 5 and DAS 3. It could get fixed by adding relevant messageFormatters and messageBuilders in axis2.xml located in esb/repository/conf/axis2.xml

In my scenario, these two entries were added to axis2.xml

messageFormatter contentType="text/html" class="org.wso2.carbon.relay.ExpandingMessageFormatter"/>

messageBuilder contentType="text/html" class="org.wso2.carbon.relay.BinaryRelayBuilder"/>