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
Related
I used WSO2 ESB 5.0. I used two soap endpoints to get the response. Below mention the proxy service code.
<?xml version="1.0" encoding="UTF-8"?>
<inSequence xmlns="http://ws.apache.org/ns/synapse">
<log/>
<property expression="//sam:getCertificateID/sam:vehicleNumber"
name="getVehicleNo" scope="default" type="STRING" xmlns:sam="http://sample.esb.org"/>
<log>
<property expression="get-property('default','getVehicleNo')" name="VehicleNo"/>
</log>
<call>
<endpoint>
<wsdl port="EmissionTestServiceHttpSoap11Endpoint"
service="EmissionTestService" uri="http://172.17.0.1:9763/services/EmissionTestService?wsdl"/>
</endpoint>
</call>
<property expression="//ns:getCertificateIDResponse/ns:return"
name="getCertificateIDResponse" scope="default" type="STRING" xmlns:ns="http://sample.esb.org"/>
<log>
<property
expression="get-property('default','getCertificateIDResponse')" name="CertificateID"/>
</log>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:sam="http://sample.esb.org" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header/>
<soapenv:Body>
<sam:getPolicyID>
<sam:vehicleNumber>$1</sam:vehicleNumber>
</sam:getPolicyID>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg evaluator="xml" expression="get-property('default','getVehicleNo')"/>
</args>
</payloadFactory>
<log/>
<property name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>
<call>
<endpoint>
<wsdl port="InsuranceServiceHttpSoap11Endpoint"
service="InsuranceService" uri="http://172.17.0.1:9763/services/InsuranceService?wsdl"/>
</endpoint>
</call>
<property expression="//ns:getPolicyIDResponse/ns:return"
name="getPolicyIDResponse" scope="default" type="STRING" xmlns:ns="http://sample.esb.org"/>
<log>
<property
expression="get-property('default','getPolicyIDResponse')" name="PolicyID"/>
</log>
</inSequence>
First endpoint is working fine and gave the specific log messages. But when going to call second endpoint, below error message is occurred.
Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found faultstring
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:305)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:252)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:234)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)
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:65)
at org.apache.synapse.transport.passthru.util.DeferredMessageBuilder.getDocument(DeferredMessageBuilder.java:148)
at org.apache.synapse.transport.passthru.util.RelayUtils.builldMessage(RelayUtils.java:137)
... 14 more
Can you help me to solve this issue. Any help or workarounds are really appreciated.
Your endpoint is not returning an soap Envelope. You can see what's happening if you set 'configure->logging->apache.synapse.tranport.http.wire' to 'debug'.
Because the endpoint is not returning SOAP, but likely plain old XML you can try setting
<property name="messageType" value="application/xml" scope="axis2"/>
<property name="ContentType" value="application/xml" scope="axis2"/>
before sending the message.
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.
I think i'm getting close with this. I'm trying to invoke an insert call on a DSS service from and ESB in WSO2.
I have the DSS service setup and I am able to insert data into the table from the 'try it' link. I copied the WSDL to the ESB and referenced the endpoint. I can see the insert operation from the ESB try it service. I put in my data and click send. I see a 'success' response come back but nothing is being added to the table.
Is anyone willing to nudge me in the right direction with this?
Thank you!
Response from try it service
<success details="in-only operation"/>
proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="MyProxy"
transports="https,http,local,vfs"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="targetfilename" value="TITLES"/>
<log level="full"/>
<clone/>
</inSequence>
</target>
<publishWSDL key="InsertServiceWSDL"/>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.FileURI">file:///var/process
/rrin</parameter>
<parameter name="transport.vfs.MoveAfterProcess">file:///var/process
/rroriginal</parameter>
<parameter name="transport.vfs.MoveAfterFailure">file:///var/process
/rrfault</parameter>
<parameter name="transport.vfs.FileNamePattern">TITLES.xml</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<description/>
</proxy>
You'll need to add an address endpoint pointing to the DSS service. Refer to this sample which is on how to define a proxy service for an axis2 web service. Your scenario is very similar to this.
Here is how I did it. The call will now hit the DSS and insert the data into the table. I am seeing some errors in the log for each XML row it processes and send to the DSS. I'm not sure why yet. I'm still researching that.
Edit: I changed the call mediator to a send mediator and that fixed this issue. I am no longer getting this error message.
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.
Here is my sequence.
<sequence xmlns="http://ws.apache.org/ns/synapse" name="MySequence">
<log level="custom">
<property name="sequence" value="MySequence"></property>
</log>
<property xmlns:ns="http://org.apache.synapse/xsd" name="filename" expression="get-property('transport', 'FILE_NAME')"></property>
<log level="custom">
<property xmlns:ns="http://org.apache.synapse/xsd" name="show-name" expression="get-property('filename')"></property>
<property xmlns:ns="http://org.apache.synapse/xsd" name="file-name" expression="get-property('targetfilename')"></property>
</log>
<iterate xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" xmlns:z="RowsetSchema" expression="//z:row" id="It1">
<target>
<sequence>
<property name="Id" expression="//z:row/#ID"></property>
<property name="vch" expression="//z:row/#vch"></property>
<log level="custom">
<property name="showids" expression="get-property('Id')"></property>
<property name="showvch" expression="get-property('vch')"></property>
</log>
<filter xpath="//z:row[starts-with(#vch, '978')]">
<then>
<payloadFactory media-type="xml">
<format>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:p="http://ws.wso2.org/dataservice">
<soapenv:Body>
<p:insert_AR_operation>
<p:ID xmlns:xs="http://ws.wso2.org/dataservice">$1</p:ID>
<p:vch xmlns:xs="http://ws.wso2.org/dataservice">$2</p:vch>
</p:insert_AR_operation>
</soapenv:Body>
</soapenv:Envelope>
</format>
<args>
<arg expression="get-property('Id')" evaluator="xml"></arg>
<arg expression="get-property('vch')" evaluator="xml"></arg>
</args>
</payloadFactory>
<log level="custom">
<property name="sequence" value="Calling LevelsAR_ISBNService"></property>
</log>
<property name="HTTP_METHOD" value="POST" scope="axis2"></property>
<property name="SOAPAction" value="insert_AR_operation" scope="transport"></property>
<send>
<endpoint>
<address uri="http://*.*.*.*:****/services/AR_Service.HTTPEndpoint/"></address>
</endpoint>
</send>
</then>
<else>
<log level="custom">
<property name="sequence" value="Condition Drop"></property>
</log>
<drop></drop>
</else>
</filter>
</sequence>
</target>
</iterate>
<property xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.ReplyFileName" expression="fn:concat(get-property('SYSTEM_DATE', 'yyMMddHHmmss'), '-', get-property('filename'))" scope="transport"></property>
<property name="OUT_ONLY" value="true"></property>
</sequence>
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 am developing a proxy service with a soap webservice that performs soap to rest conversion, the message is sent to a servlet that response with a string in flat format (not xml), just a secuence of characters like
OIUW|ECHNOWE|RFHQWIUE|FBPQW|EFHAO|IEFH
I am invoking with SOAP UI and I get this response fine, now I would like to receive it in "SOAP format", wrapping the message into a soap:body, I've tried with a XSLT and with a PayloadFactory Mediator, but as soon as I use any of them (even doing nothing) I get a
[2014-07-31 09:30:41,847] 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.
What do I do wrong ? How can I achieve a message transformation without this exception?
Thank you!
UPDATE: My proxy as requested by Ratha
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="SCL3"
transports="http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence>
<log level="custom">
<property name="MyTrace" value="--- REQUEST ---"/>
</log>
<log level="full"/>
<property name="REST_URL_POSTFIX"
value="x4?msg=x4|0003|0000000021|0|0|0400002081020224849"
scope="axis2"
type="STRING"/>
<property name="HTTP_METHOD" value="GET" scope="axis2" type="STRING"/>
<property name="SOAPAction" scope="default" action="remove"/>
<header name="Action" scope="default" action="remove"/>
<send>
<endpoint>
<address uri="http://localhost:8087/X4" format="pox"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<log level="custom">
<property name="MyTrace" value="--- RESPONSE ---"/>
</log>
<property name="ContentType"
value="application/soap+xml"
scope="transport"
type="STRING"/>
<property name="messageType"
value="application/soap+xml"
scope="transport"
type="STRING"/>
<payloadFactory media-type="xml">
<format>
<a xmlns="">$1</a>
</format>
<args>
<arg value="my value"/>
</args>
</payloadFactory>
<send/>
</outSequence>
</target>
<publishWSDL uri="file:/C:/wso2/wso2esb-4.8.1/repository/workspaces/myproject/SCL3.wsdl"/>
</proxy>
I've seen that my servlet was setting content type to "text/xml" instead of "text/plain", I've changed it to "text/plain" and everything is working fine now.
Therefore I deduce that the error message
"Content is not allowed in prolog"
actually means
"Unexpected content type"
When you have following outsequence configuration what your log prints?
<outSequence>
<log level="full">
<property name="MyTrace" value="--- RESPONSE ---"/>
</log>
<send/>
</outSequence>