wso2 data mapper SequenceMediator Runtime error - wso2

I am trying to use the data mapper to map the response from two(2) different api. So what I did was use the clone mediator and aggregate mediator to merge these two api together and then map it using the data mapper but when I get on the data mapper part I always get an error. It works if I removed the data mapper mediator part.
Here's my api
<?xml version="1.0" encoding="UTF-8"?>
<api context="/test" name="test" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<property name="ROOT" scope="default">
<root:movie xmlns:root="www.wso2esb.com"/>
</property>
<log level="full"/>
<clone continueParent="true" id="movie" sequential="true">
<target>
<sequence>
<send>
<endpoint>
<address format="rest" uri="https://api.themoviedb.org/3/movie/tt0918940?api_key=code"/>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<send>
<endpoint>
<address format="rest" uri="https://www.omdbapi.com/?type=movie&i=tt0918940"/>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence>
<aggregate id="movie">
<completeCondition>
<messageCount max="-1" min="-1"/>
</completeCondition>
<onComplete enclosingElementProperty="ROOT" expression="//jsonObject/*" xmlns:dummy="http://org.dummy" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<datamapper config="gov:datamapper/TestMapping.dmc" inputSchema="gov:datamapper/TestMapping_inputSchema.json" inputType="JSON" outputSchema="gov:datamapper/TestMapping_outputSchema.json" outputType="JSON"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<respond/>
</onComplete>
</aggregate>
</outSequence>
</resource>
</api>
and here's my log
[2016-07-21 09:33:56,180] ERROR - SequenceMediator Runtime error occurred while mediating the message
java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:78)
at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
at org.wso2.carbon.mediator.datamapper.engine.input.readers.JSONInputReader.readFromInputStream(JSONInputReader.java:76)
at org.wso2.carbon.mediator.datamapper.engine.input.readers.JSONInputReader.read(JSONInputReader.java:59)
at org.wso2.carbon.mediator.datamapper.engine.input.InputBuilder.buildInputModel(InputBuilder.java:59)
at org.wso2.carbon.mediator.datamapper.engine.core.mapper.MappingHandler.doMap(MappingHandler.java:67)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:306)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:256)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:95)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:57)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.mediators.eip.aggregator.AggregateMediator.completeAggregate(AggregateMediator.java:447)
at org.apache.synapse.mediators.eip.aggregator.AggregateMediator.mediate(AggregateMediator.java:330)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:95)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:57)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.rest.Resource.process(Resource.java:325)
at org.apache.synapse.rest.API.process(API.java:338)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:125)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:101)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:56)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:300)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:554)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:188)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:255)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Please check your governance registry whether you add configuration correctly into ESB. (Navigate to Governance registry)
You will get null pointer exception as it can't find relevant details. Please add relevant configurations and test.

Related

VFS Transport Sender Warning

I am using a proxy that reads from a csv file, converts into a desired json payloads and writes to two different sftp locations sequentially via a clone. When i execute this operation i get the following warning in the logs for every file that's written.Do i need to change any configurations in the sequence or properties?
Warning log :
WARN {VFSTransportSender} - Could not set last modified. org.apache.commons.vfs2.FileSystemException: Could not set the last modified timestamp of "sftp://sftp4u.pivotree:***#sftp4u.blob.core.windows.net/Francescas/dev/VariantFeedToBloomreach/out/Put/2023-02-14T10-45-02.json".
at org.apache.commons.vfs2.provider.DefaultFileContent.setLastModifiedTime(DefaultFileContent.java:180)
at org.apache.synapse.transport.vfs.VFSTransportSender.populateResponseFile(VFSTransportSender.java:366)
at org.apache.synapse.transport.vfs.VFSTransportSender.writeFile(VFSTransportSender.java:280)
at org.apache.synapse.transport.vfs.VFSTransportSender.sendMessage(VFSTransportSender.java:189)
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:678)
at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:86)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:586)
at org.apache.synapse.endpoints.AbstractEndpoint.send(AbstractEndpoint.java:409)
at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:77)
at org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:123)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:214)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.mediators.eip.Target.mediateMessage(Target.java:256)
at org.apache.synapse.mediators.eip.Target.mediate(Target.java:111)
at org.apache.synapse.mediators.eip.splitter.CloneMediator.mediate(CloneMediator.java:136)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:109)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:71)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:228)
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:854)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:480)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:189)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:135)
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.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: 8: UnsupportedOperation: This operation is currently unsupported.
at com.jcraft.jsch.ChannelSftp.throwStatusError(ChannelSftp.java:2873)
at com.jcraft.jsch.ChannelSftp._setStat(ChannelSftp.java:2418)
at com.jcraft.jsch.ChannelSftp.setStat(ChannelSftp.java:2392)
at org.apache.commons.vfs2.provider.sftp.SftpFileObject.flushStat(SftpFileObject.java:201)
at org.apache.commons.vfs2.provider.sftp.SftpFileObject.doSetLastModifiedTime(SftpFileObject.java:194)
at org.apache.commons.vfs2.provider.DefaultFileContent.setLastModifiedTime(DefaultFileContent.java:176)
... 38 more
Proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="SampleProxy" startOnLoad="true" transports="http https vfs" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<smooks config-key="SmooksConf">
<input type="text"/>
<output type="xml"/>
</smooks>
<property expression="$body/*" name="Data" scope="default" type="OM"/>
<clone sequential="true">
<target>
<sequence>
<xslt key="sampleXSLT1"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property name="JSON1" expression="json-eval($)"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property expression="fn:concat('abc','.json')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove"/>
<send>
<endpoint>
<address uri="vfs:sftp://{sftp_path}/folder?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true;transport.vfs.Streaming=true;">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<xslt key="sampleXSLT2"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property name="JSON2" expression="json-eval($)"/>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property expression="fn:concat('xyz','.json')" name="transport.vfs.ReplyFileName" scope="transport" type="STRING"/>
<property name="OUT_ONLY" scope="default" type="STRING" value="true"/>
<property name="ClientApiNonBlocking" value="true" scope="axis2" action="remove"/>
<send>
<endpoint>
<address uri="vfs:sftp://{sftp_path}/folder?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true;transport.vfs.Streaming=true;">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.MaxRetryCount">1</parameter>
<parameter name="transport.vfs.FileURI">sftp://{sftp_path}/input?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">sftp://{sftp_path}/error?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">sftp://{sftp_path}/move?sftpPathFromRoot=true&transport.vfs.AvoidPermissionCheck=true</parameter>
</proxy>
Please try adding this property in the proxy, this works in wso2 ei 6.6.
<property action="remove" name="LAST_MODIFIED" scope="transport"/>
A new VFS property[1] was introduced to ignore setting the last modified timestamp of MI and EI.
In the VFS proxy, you can set the following parameter,
<parameter name="transport.vfs.UpdateLastModified">false</parameter>
This feature is available in MI 4.1.0 base pack. If you are using EI 6.6.0 or MI 1.2.0 you will need to update those products using a WSO2 subscription.
For more information on WSO2 subscription check https://wso2.com/subscription/
[1] - https://github.com/wso2/micro-integrator/issues/2318

WSO2 EI - SalesForce Connector not connecting to partial instance

Getting the below errors when I am trying to connect to Salesforce, Anything essential am I missing?
//TID[-1234] [EI] [2019-03-19 20:40:40,174] ERROR {org.apache.axis2.description.ClientUtils} - The system cannot infer the transport information from the /services/createSFBuzz URL.
//TID[-1234] [EI] [2019-03-19 20:40:40,174] ERROR {org.apache.synapse.core.axis2.Axis2Sender} - Unexpected error during sending message out org.apache.axis2.description.ClientUtils.inferOutTransport(ClientUtils.java:86) org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:116) org.apache.axis2.client.OperationClient.execute(OperationClient.java:149) org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:603) org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:85) org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:547) org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:120) org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:108) org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:70) org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158) org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:224) org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:337) org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:383) org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:151) org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) java.lang.Thread.run(Thread.java:745)
My Proxy Code:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="createSFBuzz"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="http,https">
<target>
<inSequence>
<property expression="json-eval($.accessToken)" name="accessToken"/>
<property expression="json-eval($.apiUrl)" name="apiUrl"/>
<property expression="json-eval($.clientId)" name="clientId"/>
<property expression="json-eval($.refreshToken)" name="refreshToken"/>
<property expression="json-eval($.clientSecret)" name="clientSecret"/>
<property expression="json-eval($.hostName)" name="hostName"/>
<property expression="json-eval($.apiVersion)" name="apiVersion"/>
<property expression="json-eval($.registryPath)" name="registryPath"/>
<property expression="json-eval($.intervalTime)" name="intervalTime"/>
<salesforcerest.init>
<accessToken>{$ctx:accessToken}</accessToken>
<apiUrl>{$ctx:apiUrl}</apiUrl>
<apiVersion>{$ctx:apiVersion}</apiVersion>
<hostName>{$ctx:hostName}</hostName>
<clientSecret>{$ctx:clientSecret}</clientSecret>
<clientId>{$ctx:clientId}</clientId>
<refreshToken>{$ctx:refreshToken}</refreshToken>
<registryPath>{$ctx:registryPath}</registryPath>
<intervalTime>{$ctx:intervalTime}</intervalTime>
</salesforcerest.init>
<log level="full" separator=","/>
<send/>
</inSequence>
<outSequence>
<payloadFactory media-type="json">
<format>{"success":"Connection Successful"}</format>
<args/>
</payloadFactory>
<respond/>
</outSequence>
</target>
<description/>
</proxy>
The problem is not in the salesforce connector, but in the send mediator afterwards. It has no idea where to send anything. You have a send mediator without a defined endpoint, and most likely without a To header that points to a valid endpoint.
What are you trying to achieve with the Send mediator?

wso2 cloning from two different api

I am trying to clone 2 different api to combine their response but i am always getting a null pointer error. at first i am just trying to clone these 2 api.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/movieapi" name="movieapi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/movie/{imdbId}">
<inSequence>
<property expression="get-property('uri.var.imdbId')" name="uri.var.imdbId" scope="default" type="STRING"/>
<clone>
<target>
<endpoint>
<address trace="disable" uri="https://api.themoviedb.org/3/movie/{uri.var.imdbId}?api_key=code&append_to_response=casts,images"/>
</endpoint>
</target>
<target>
<endpoint>
<address trace="disable" uri="http://www.omdbapi.com/?type=movie&i={uri.var.imdbId}"/>
</endpoint>
</target>
</clone>
</inSequence>
</resource>
</api>
Here is my error from wso2esb version 5 beta
[2016-07-15 13:57:34,106] ERROR - PassThroughHttpSender Failed to submit the response
java.lang.NullPointerException
at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:67)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:463)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:264)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
at org.apache.synapse.rest.Resource.process(Resource.java:348)
at org.apache.synapse.rest.API.process(API.java:336)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:120)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:100)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:55)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:541)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:179)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:252)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
[2016-07-15 13:57:34,121] ERROR - Axis2Sender Access-Control-Allow-Origin:*,Cache-Control:public, max-age=28800,Content-Type:application/json;charset=utf-8,ETag:"37a6259cc0c1dae299a7866489dff0bd",Status:404 Not Found,X-Memc:MISS,X-Memc-Age:0,X-Memc-Expires:28800,X-Memc-Key:d0c5ca8e07e81f5246e96c9e4bd54753,X-RateLimit-Limit:40,X-RateLimit-Remaining:39,X-RateLimit-Reset:1468562263,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back
org.apache.axis2.AxisFault: Failed to submit the response
at org.apache.synapse.transport.passthru.PassThroughHttpSender.handleException(PassThroughHttpSender.java:613)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:266)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:212)
at org.apache.synapse.rest.Resource.process(Resource.java:348)
at org.apache.synapse.rest.API.process(API.java:336)
at org.apache.synapse.rest.RESTRequestHandler.apiProcess(RESTRequestHandler.java:120)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:100)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:55)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:304)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:541)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:179)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:252)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at org.apache.synapse.transport.passthru.util.SourceResponseFactory.create(SourceResponseFactory.java:67)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:463)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:264)
... 16 more
[2016-07-15 13:57:34,124] INFO - LogMediator To: http://www.w3.org/2005/08/addressing/anonymous, WSAction: , SOAPAction: , MessageID: urn:uuid:f814f333-463b-4f51-89f1-2c361d7c55ae, Direction: response, MESSAGE = Executing default 'fault' sequence, ERROR_CODE = 0, ERROR_MESSAGE = Access-Control-Allow-Origin:*,Cache-Control:public, max-age=28800,Content-Type:application/json;charset=utf-8,ETag:"37a6259cc0c1dae299a7866489dff0bd",Status:404 Not Found,X-Memc:MISS,X-Memc-Age:0,X-Memc-Expires:28800,X-Memc-Key:d0c5ca8e07e81f5246e96c9e4bd54753,X-RateLimit-Limit:40,X-RateLimit-Remaining:39,X-RateLimit-Reset:1468562263,<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body/></soapenv:Envelope> Unexpected error sending message back, Payload: {"status_code":34,"status_message":"The resource you requested could not be found."}
Please check whether your property retrieve value from the property. For that use log mediator as follows;
<log level="full">
<property expression="get-property('uri.var.imdbId')" name="uri.var.imdbId" scope="default" type="STRING"/>
</log>
Then the issue is retrieving part.
Issue is about submitting response. According to your configuration, you didn't add aggregate mediator to gather responses [1]. Please add and test it.
I add sample scenario here. You just have to start 2 instances of SimpleStockQuote service [2] and publish messages to proxy via SOAPUI.
<proxy name="ScatterGatherProxy" startOnLoad="true" trace="disable" transports="https http">
<description/>
<target>
<inSequence>
<clone>
<target>
<sequence>
<send>
<endpoint name="vendorA">
<address uri="http://localhost:9001/services/SimpleStockQuoteService/"/>
</endpoint>
</send>
</sequence>
</target>
<target>
<sequence>
<send>
<endpoint name="vendorB">
<address uri="http://localhost:9002/services/SimpleStockQuoteService/"/>
</endpoint>
</send>
</sequence>
</target>
</clone>
</inSequence>
<outSequence>
<log level="full"/>
<aggregate>
<completeCondition>
<messageCount min="2"/>
</completeCondition>
<onComplete expression="//m0:return"
xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd">
<enrich>
<source clone="true" xpath="//m0:return[not(preceding-sibling::m0:return/m1:last <= m1:last) and not(following-sibling::m0:return/m1:last < m1:last)]"/>
<target type="body"/>
</enrich>
<send/>
</onComplete>
</aggregate>
</outSequence>
</target>
[1] https://docs.wso2.com/display/ESB490/Aggregate+Mediator
[2] https://docs.wso2.com/display/ESB490/Setting+Up+the+ESB+Samples#Starting%20the%20Axis2%20server

Can't parse JSON response in the OutSequence wso2 esb?

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"/>

Error when uploading pdf using vfs:ftps (missing FileURI). Possible bug?

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