I'm using wso2esb 4.7.0 and wso2dss 3.0.0..I have created dataservice to update a record from table..My Dss configuration is as follows
<query id="trial_query" useConfig="default">
<sql>update muser set username=? where userid=?</sql>
<param name="username" ordinal="1" sqlType="STRING"/>
<param name="userid" ordinal="2" sqlType="BIGINT"/>
</query>
<operation name="trial_op">
<call-query href="trial_query">
<with-param name="username" query-param="username"/>
<with-param name="userid" query-param="userid"/>
</call-query>
</operation>
After that i have created a ESB configuration as :
<target>
<inSequence>
<property name="username"
expression="//username/text()"
scope="default"
type="STRING"/>
<property name="userid"
expression="//userid/text()"
scope="default"
type="STRING"/>
<log level="full"/>
<property name="FORCE_ERROR_ON_SOAP_FAULT" value="true"/>
<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>
<send>
<endpoint>
<address uri="http://192.168.1.23:9764/services/Capp_muser_dataservice/trail_op"
format="soap12"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<send/>
</outSequence>
</target>
and this is also working..Now i wanted to add a sequence mediator in esb and It's configuration is as :
<property name="messageType" value="application/json" scope="axis2"></property>
<property xmlns:ns="http://org.apache.synapse/xsd" xmlns:s="http://ws.wso2.org/dataservice" name="username" expression="get-property('username')" scope="default" type="STRING"></property>
<log>
<property name="username" value="UPDATED SUCCESSFULLY"></property>
</log>
<send></send>
I'm sending request with curl command as :
curl -v -H "Accept:application/json" -H "Content-Type:application/json" -d '{"username":"Harry","userid":"347367127872701992"}' http://youtility-desktop:8282/services/capp1
Now, he issue is when i'm adding sequence in send mediator ESB throws an error as :
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.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:381)
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)
... 17 more
Still the configuration is working fine with errors too..
I have tried the same code in wso2esb 4.8.0 and wso2dss 3.1.0.Here ESB is working fine but error occurred with wso2dss 3.1.0 . It show error like:
javax.xml.stream.XMLStreamException: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:username
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: Capp_muser_dataservice
Location: /Capp_muser_dataservice.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: trail_op
Current Params: {}
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:107)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.serialize(DSOMDataSource.java:112)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.executeInOnly(DSOMDataSource.java:80)
at org.wso2.carbon.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:127)
... 40 more
Caused by: DS Fault Message: Error in 'CallQuery.extractParams', cannot find parameter with type:query-param name:username
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: Capp_muser_dataservice
Location: /Capp_muser_dataservice.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: trail_op
Current Params: {}
at org.wso2.carbon.dataservices.core.engine.CallQuery.extractParams(CallQuery.java:208)
at org.wso2.carbon.dataservices.core.engine.CallQuery.executeElement(CallQuery.java:177)
at org.wso2.carbon.dataservices.core.engine.CallQueryGroup.executeElement(CallQueryGroup.java:111)
at org.wso2.carbon.dataservices.core.engine.OutputElement.execute(OutputElement.java:89)
at org.wso2.carbon.dataservices.core.description.operation.Operation.execute(Operation.java:71)
at org.wso2.carbon.dataservices.core.engine.DataService.invoke(DataService.java:548)
at org.wso2.carbon.dataservices.core.engine.DSOMDataSource.execute(DSOMDataSource.java:101)
... 43 more
Why the errors occurred? Is their any problem with soap format during send mediator or i have to add some properties in esb configuration?What should i do to resolve this issue?Please let me know..
Related
At the start of the Outsequence I am using this:
<property name="messageType" value="application/JSON" scope="axis2"/>
but still I get the error message Content not allowed in prolog.
If I directly send the response to the client without using any mediators I don't get any error.
Below is the full stack trace:
[2015-07-07 12:11:35,747] ERROR - RelayUtils Error while building Passthrough stream
org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Content is not allowed in prolog.
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:138)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:107)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:82)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:68)
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)
I am able to parse JSON response.
WSO2 ESB version used- 4.8.1
Below is the proxy code.
<?xml version="1.0" encoding="UTF-8"?><proxy xmlns="http://ws.apache.org/ns/synapse" name="JsonProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
<target>
<inSequence>
<log level="full">
<property name="################ REQUEST ###################" expression="$body"/>
</log>
<send>
<endpoint>
<address uri="http://ip.jsontest.com/"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<property name="messageType" value="application/json" scope="axis2" type="STRING"/>
<log level="full">
<property name="################ RESPONSE###################" expression="$body"/>
</log>
<log>
<property name="::::::::::::::::::::::::::::: JSON :::::::::::::::::::::::::::" expression="json-eval($.)"/>
</log>
<send/>
</outSequence>
</target>
<description/>
</proxy>
Please cross check that below lines are only uncommented in axis2.xml
<messageFormatter contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamFormatter"/>
<messageFormatter contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
<messageBuilder contentType="application/json"
class="org.apache.synapse.commons.json.JsonStreamBuilder"/>
<messageBuilder contentType="application/json/badgerfish"
class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/>
I have a proxy service in WSO2 ESB which is listening over a Queue via JMS and then after some processing it sends message to another queue. It works fine. I am implementing fault sequence of this service that in case if endpoint is suspended then it should send message to an error queue. In fault sequence WSO2 ESB is generating ERROR_MESSAGE, ERROR_DETAIL, ERROR_EXCEPTION but it is not generating ERROR_CODE.
Fault Sequence:
<faultSequence xmlns="http://ws.apache.org/ns/synapse">
<log level="full" separator="**********Fault Sequence File Processor***********">
<property name="ErrorCode" expression="get-property('ERROR_CODE')"></property>
<property name="ErrorMessage" expression="get-property('ERROR_MESSAGE')"></property>
<property name="ErrorDetail" expression="get-property('ERROR_DETAIL')"></property>
<property name="ErrrorException" expression="get-property('ERROR_EXCEPTION')"></property>
</log>
<payloadFactory media-type="xml">
<format>
<MessageFormat xmlns="">
<ECode>$1</ECode>
<EMsg>$2</EMsg>
<EDetail>$3</EDetail>
<EException>$4</EException>
</MessageFormat>
</format>
<args>
<arg expression="get-property('ERROR_CODE')" evaluator="xml"></arg>
<arg expression="get-property('ERROR_MESSAGE')" evaluator="xml"></arg>
<arg expression="get-property('ERROR_DETAIL')" evaluator="xml"></arg>
<arg expression="get-property('ERROR_EXCEPTION')" evaluator="xml"></arg>
</args>
</payloadFactory>
<property name="OUT_ONLY" value="true" scope="default" type="STRING"></property>
<property name="ClientApiNonBlocking" action="remove" scope="axis2"></property>
<send>
<endpoint key="conf:/endpoints/ErrorQueue.xml"></endpoint>
</send>
</faultSequence>
Endpoint Which i am suspending:
<?xml version="1.0" encoding="UTF-8"?>
<endpoint xmlns="http://ws.apache.org/ns/synapse" name="Endpoint">
<address uri="jms:/RequestQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&java.naming.provider.url=tcp://192.168.1.33:61616&transport.jms.DestinationType=queue" format="pox">
<timeout>
<duration>6000</duration>
</timeout>
<markForSuspension>
<errorCodes>101504, 101505, 303001, 303000</errorCodes>
<retriesBeforeSuspension>1</retriesBeforeSuspension>
<retryDelay>1</retryDelay>
</markForSuspension>
<suspendOnFailure>
<errorCodes>101500, 101501, 101506, 101507, 101508, 303001, 303000</errorCodes>
<initialDuration>1000</initialDuration>
<progressionFactor>2</progressionFactor>
<maximumDuration>6400</maximumDuration>
</suspendOnFailure>
</address>
</endpoint>
Note:
The IP mentioned in the "address" URI is not correct so that's why service goes into fault sequence.
Output on Error Queue:
<MessageFormat><ECode>0</ECode><EMsg>Unexpected error during sending message out</EMsg><EDetail>org.apache.synapse.SynapseException: Unexpected error during sending message out
at org.apache.synapse.core.axis2.Axis2Sender.handleException(Axis2Sender.java:172)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:71)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:338)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:333)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
at org.apache.synapse.endpoints.IndirectEndpoint.send(IndirectEndpoint.java:54)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)
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.mediators.base.SequenceMediator.mediate(SequenceMediator.java:196)
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.mediators.eip.Target.mediate(Target.java:106)
at org.apache.synapse.mediators.eip.splitter.IterateMediator.mediate(IterateMediator.java:146)
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.mediators.base.SequenceMediator.mediate(SequenceMediator.java:196)
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.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:166)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.axis2.transport.base.AbstractTransportListener.handleIncomingMessage(AbstractTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.processFile(VFSTransportListener.java:597)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:328)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:158)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:107)
at org.apache.axis2.transport.base.AbstractPollingTransportListener$1$1.run(AbstractPollingTransportListener.java:67)
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:744)
Caused by: org.apache.axis2.AxisFault: Unable to create a JMSMessageSender for : null
at org.apache.axis2.transport.base.AbstractTransportSender.handleException(AbstractTransportSender.java:226)
at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:129)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:482)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:59)
... 33 more
Caused by: javax.jms.JMSException: Could not connect to broker URL: tcp://192.168.1.33:61616. Reason: java.net.NoRouteToHostException: No route to host
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:36)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:301)
at org.apache.activemq.ActiveMQConnectionFactory.createActiveMQConnection(ActiveMQConnectionFactory.java:246)
at org.apache.activemq.ActiveMQConnectionFactory.createQueueConnection(ActiveMQConnectionFactory.java:203)
at org.apache.axis2.transport.jms.JMSOutTransportInfo.createJMSSender(JMSOutTransportInfo.java:363)
at org.apache.axis2.transport.jms.JMSSender.sendMessage(JMSSender.java:127)
... 39 more
</EDetail><EException></EException></MessageFormat>
Problem:
Why WSO2 ESB does not generate ERROR_CODE? I have to get that error code and on the basis of error code make some further logic.
This is default behaviour of WSO2 ESB. In Endpoint failure case, WSO2 ESB returns 0 as ErrorCode but Error Detail and Error Message have specific error messages. What you can do is, using Filter mediator or Switch mediator you can make your custom error code and message.
<filter xmlns:ns="http://org.apache.synapse/xsd" source="json-eval($.node[0].nid)" regex="100">
<then>
//your business here
</then>
<else>
//your business here
</else>
</filter>
I'm using wso2esb 4.7.0 and wso2dss 3.0.0.I have created a dataservice to update table in wso2dss and it's working fine.Now i have called this service in wso2esb via send mediator as:
<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>
<endpoint>
<address uri="http://192.168.1.23:9764/services/Capp_muser_dataservice/"
format="soap12"/>
</endpoint>
</send>
<log level="full"/>
</inSequence>
<outSequence>
<send/>
</outSequence>
This is also working fine..The issue occurred when i'm calling a sequence in send mediator like :
<send receive="Capp_Login_seq1">
<endpoint>
<address uri="http://192.168.1.23:9764/services/Capp_muser_dataservice/"
format="soap11"/>
</endpoint>
</send>
My request is :
curl -v -H "Accept:application/json" -H "Content-Type:application/json" -d '{"username":"sps","userid":"337217709387286044"}' http://youtility-desktop:8282/services/Capp_LoginProxy
It shows error in esb :
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
Is it issue of soap request or anything else?
please let me know..
Remove the endpoint format and check.
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..
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"/>
We have a proxy service that downloads a pdf file from a JasperReports Server and then do a vfs:ftps to upload the pdf to a FTP server. The download part works just fine but we are struggling with the upload part. Here is our problem:
When starting the proxy service, we got the following WARN message (Note we do have a parameter FileURI in the config):
WARN PollTableEntry transport.vfs.FileURI parameter is missing in the proxy service configuration
and when running a request, we got an exception as follows:
[PassThroughMessageProcessor-2] ERROR Axis2Sender Unexpected error during sending message out
java.lang.NullPointerException
at java.util.StringTokenizer.<init>(StringTokenizer.java:182)
at java.util.StringTokenizer.<init>(StringTokenizer.java:204)
at org.apache.commons.vfs2.provider.ftps.FtpsFileProvider.doCreateFileSystem(FtpsFileProvider.java:67)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:104)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:82)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:66)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:694)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:650)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:606)
at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:134)
at org.apache.axis2.transport.base.AbstractTransportSender.invoke(AbstractTransportSender.java:112)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:297)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:456)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:269)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:329)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:59)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:95)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:230)
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:217)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
I wonder if it is a potential bug or anything wrong in the proxy configuration.
PLEASE help, thanks!
Here is the proxy config xml:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="GenerateSecurityReport"
transports="https http vfs"
startOnLoad="true"
trace="enable"
statistics="enable">
<description/>
<parameter name="transport.vfs.FileURI">vfs:ftps://ftpUser:ftpPassword#ftp.host/path?vfs.passive=true</parameter>
<parameter name="transport.vfs.ContentType">application/pdf</parameter>
<target>
<endpoint>
<address uri="http://jasperServerHost/path/to/report.pdf"/>
</endpoint>
<inSequence>
<log/>
<property name="Authorization"
expression="fn:concat('Basic ', base64Encode('jasperUser:jasperPassword'))"
scope="transport"
type="STRING"/>
<property name="product"
expression="fn:substring-after(get-property('To'), 'product=')"
scope="default"
type="STRING"/>
</inSequence>
<outSequence>
<log/>
<property name="CONTENT_TYPE"
value="application/pdf"
scope="axis2"
type="STRING"/>
<property name="transport.vfs.ReplyFileName"
expression="fn:concat(get-property('product'), '_vendor_patches.pdf')"
scope="transport"/>
<property name="OUT_ONLY" value="true"/>
<property name="HTTP_SC" value="200" scope="axis2"/>
<send>
<endpoint>
<address uri="vfs:ftps://ftpUser:ftpPassword#ftp.host/path?vfs.passive=true"/>
</endpoint>
</send>
<payloadFactory>
<format>
<html xmlns="">
<body>success</body>
</html>
</format>
</payloadFactory>
<property name="Content-Type"
value="text/html"
scope="transport"
type="STRING"/>
<send/>
</outSequence>
</target>
</proxy>
Did you define the transport.vfs.FileNamePattern parameter?
Follow this sample