I am using wso2 esb 4.8.1. I am trying to do xml to xml transformation with the help of smooks mediator but I am getting following exception when is hit request from the try it from application deployment console of wso2,
[2014-11-07 09:39:20,401] ERROR - SmooksMediator Failed to filter source.
org.milyn.SmooksException: Failed to filter source.
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:86)
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:61)
at org.milyn.Smooks._filter(Smooks.java:516)
at org.milyn.Smooks.filterSource(Smooks.java:475)
at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:123)
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.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
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:724)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1236)
at org.milyn.delivery.sax.SAXParser.parse(SAXParser.java:70)
at org.milyn.delivery.sax.SmooksSAXFilter.doFilter(SmooksSAXFilter.java:75)
... 15 more
[2014-11-07 09:39:20,417] ERROR - NativeWorkerPool Uncaught exception
org.wso2.carbon.mediator.service.MediatorException: Failed to filter source. Caused by Failed to filter source.
at org.wso2.carbon.mediator.transform.SmooksMediator.handleException(SmooksMediator.java:242)
at org.wso2.carbon.mediator.transform.SmooksMediator.mediate(SmooksMediator.java:137)
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.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:411)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:183)
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:724)
seqence xml is as below,
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse" name="smooksTransService" transports="http https" startOnLoad="true" trace="disable">
<target>
<inSequence>
<log level="full" separator=","/>
<smooks config-key="gov:/_system/config/transforms/smooksconfig.xml">
<input type="text"/>
<output type="xml"/>
</smooks>
<log level="full" separator=","/>
<drop/>
</inSequence>
<outSequence/>
<faultSequence/>
</target>
</proxy>
Below is smooks configuration file,
<?xml version="1.0" encoding="UTF-8"?><smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd">
<params>
<param name="stream.filter.type">SAX</param>
<param name="inputType">input.xml</param>
<param name="default.serialization.on">true</param>
<param name="input.xml" type="input.type.actived">File:/C:\Shailesh\xmls\model-input.xml</param>
</params>
<ftl:freemarker applyOnElement="#document">
<ftl:template><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<h:salesorder xmlns:h="http://www.w3.org/TR/html4/">
<h:details>
<h:orderid>${.vars["order"]["#id"]}</h:orderid>
<h:customer>
<h:id>${.vars["order"]["header/customer/#number"]}</h:id>
<h:name>${.vars["order"]["header/customer"]}</h:name>
</h:customer>
</h:details>
<#list .vars["order"]["order-items"] as order_items>
<h:itemList>
<#list .vars["order_items"]["order-item"] as order_item>
<h:item>
<h:id>${.vars["order_item"]["#id"]}</h:id>
<h:productId>${.vars["order_item"]["product"]}</h:productId>
<h:quantity>${.vars["order_item"]["quantity"]}</h:quantity>
<h:price>${.vars["order_item"]["price"]}</h:price>
</h:item>
</#list>
</h:itemList>
</#list>
</h:salesorder>]]></ftl:template>
<param name="modelSrc">File:/C:\Shailesh\xmls\model-output.xml</param>
<param name="modelSrcType">XML</param>
<param name="mess![enter image description here][2]ageType">XML</param>
<param name="templateDataProvider">input</param>
</ftl:freemarker>
<resource-config selector="#document">
<resource>org.milyn.delivery.DomModelCreator</resource>
</resource-config>
</smooks-resource-list>
My request for proxy service is as shown in attached image.
I didn't go through your example thoroughly, but it seems the error is that the Smooks Mediator cannot find the registry resource.
Looks like there is an issue when you specify the smooks config-key attribute. When you are working with the registry, you need to know that there are different registry spaces.
If you refer a resource via "gov:", the resource will be in "/_system/governance". You need to use "conf:" to refer a resource in "/_system/config".
For eg: If you have a resource in "/_system/config/transforms/smooksconfig.xml", you need to refer it as follows:
"conf:transforms/smooksconfig.xml"
Related question: Howto access registry in WSO2 ESB
I hope this helps.
Related
Scenario
I've created a proxy service which calls an endpoint. The endpoints gives XML response. I'm using Foreach Mediator to iterate through the XML response using the defined XPath expression. Finally, each record will be inserted to the database using the DB Report Mediator.
Proxy Service
<?xml version="1.0" encoding="UTF-8"?>
<proxy name="alertsIoscoProxy" startOnLoad="true" statistics="enable" trace="enable" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
<target>
<inSequence>
<send>
<endpoint>
<address uri="https://www.XXXXXX/investor_protection/investor_alerts/xml-feed">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>1</progressionFactor>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</address>
</endpoint>
</send>
</inSequence>
<outSequence>
<foreach expression="//alerts/alert" id="foreach_alert">
<sequence>
<dbreport>
<connection>
<pool>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/postgres</url>
<user>postgres</user>
<password>admin</password>
</pool>
</connection>
<statement>
<sql><![CDATA[insert into IOSCO_RESPONSE (ID, DATE_POSTED, COMPANY,REGULATOR, JURISDICTION, LINK, SUBJECT) values (?,?,?,?,?,?,?)]]></sql>
<parameter expression="//id" type="VARCHAR" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"/>
<parameter expression="//datePosted" type="VARCHAR" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"/>
<parameter expression="//company" type="VARCHAR" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"/>
<parameter expression="//regulator" type="VARCHAR" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"/>
<parameter expression="//jurisdiction" type="VARCHAR" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"/>
<parameter expression="//link" type="VARCHAR" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"/>
<parameter expression="//subject" type="VARCHAR" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"/>
</statement>
</dbreport>
</sequence>
</foreach>
<log level="custom">
<property name="add" value="Records added!!!!"/>
</log>
<sequence key="Lookup"/>
<respond/>
</outSequence>
<faultSequence/>
</target>
</proxy>
Sample XML
<alerts>
<message>Results are capped at 500 records.</message>
<alert>
<id>23091</id>
<datePosted>20221209</datePosted>
<company>Trado Banco</company>
<regulator>Financial Conduct Authority</regulator>
<jurisdiction>United Kingdom</jurisdiction>
<link>https://www.fca.org.uk/news/warnings/trado-banco</link>
<subject>Regarding fraudulent or manipulative practices (insider dealing, market manipulation, misrepresentation of material information, etc.)<br /><br />Regarding registration of issuance, offer or sale of securities/derivatives, and reporting requirements<br /><br />Regarding market intermediaries (investment and trading advisers, collective investment schemes, brokers, dealers, and transfer agents)<br /><br />Regarding markets, exchanges, and clearing and settlement entities<br /><br />Miscellaneous</subject>
<comments/>
<attachments/>
</alert>
.
.
.
</alerts>
Error
[2022-12-13 23:42:55,323] INFO {TRACE_LOGGER} - {proxy:alertsIoscoProxy} Proxy Service alertsIoscoProxy received a new message...
[2022-12-13 23:42:55,323] INFO {TRACE_LOGGER} - {proxy:alertsIoscoProxy} Message To: null
[2022-12-13 23:42:55,323] INFO {TRACE_LOGGER} - {proxy:alertsIoscoProxy} SOAPAction: null
[2022-12-13 23:42:55,323] INFO {TRACE_LOGGER} - {proxy:alertsIoscoProxy} WSA-Action: null
[2022-12-13 23:42:55,324] INFO {TRACE_LOGGER} - Setting specified anonymous fault-sequence for proxy
[2022-12-13 23:42:55,324] INFO {TRACE_LOGGER} - {proxy:alertsIoscoProxy} Using the anonymous in-sequence of the proxy service for mediation
[2022-12-13 23:42:55,878] INFO {TRACE_LOGGER} - Setting specified anonymous fault-sequence for proxy
[2022-12-13 23:42:57,175] ERROR {RelayUtils} - Error while building Passthrough stream org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found alerts
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:153)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:169)
at org.apache.synapse.transport.passthru.util.RelayUtils.buildMessage(RelayUtils.java:122)
at org.apache.synapse.transport.util.PassThroughMessageHandler.buildMessage(PassThroughMessageHandler.java:103)
at org.apache.synapse.mediators.AbstractListMediator.buildMessage(AbstractListMediator.java:155)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:96)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:72)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:158)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:377)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.handleMessage(SynapseCallbackReceiver.java:627)
at org.apache.synapse.core.axis2.SynapseCallbackReceiver.receive(SynapseCallbackReceiver.java:208)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ClientWorker.run(ClientWorker.java:298)
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)
Question
Why proxy Service is considering the response as Soap while its HTTP response with xml based formatting? How could I solve this issue?
One reason for this issue is, your response coming from https://www.XXXXXX/investor_protection/investor_alerts/xml-feed maybe having the Content-Type set to text/xml which is by default considered as a SOAP message and built with the SOAPMessageBuilder. If you can change the backend to send application/xml as the content type this would resolve the issue. Else you will have to change the Message Builder configurations to build text/xml messages with ApplicationXMLBuilder. For that you need to add the following to the deployment.toml.
[[custom_message_builders]]
content_type = "text/xml"
class="org.apache.axis2.builder.ApplicationXMLBuilder"
Note that this will affect all the SOAP 1.1 calls as well, which use text/xml content type. To avoid this you can create a custom message builder as well. More details are on the aforementioned doc.
I am using WSO2 EI 6.3.0 version. I am creating data service within the application which reads data from CSV.
I am running into very unusual case where I have created two data services. One with sample Product.csv which is shipped with WSO2 EI.
When calling Sample (Product.CSV) I am able to get the json response message. but when I am trying to invoke another API which other data service it is giving me below error:
[2018-10-10 17:57:31,916] [EI-Core] ERROR - JsonStreamFormatter Error occurred while writing to application/json
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor133.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.wso2.carbon.integrator.core.json.JsonStreamFormatter.writeTo(JsonStreamFormatter.java:107)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.submitResponse(PassThroughHttpSender.java:597)
at org.apache.synapse.transport.passthru.PassThroughHttpSender.invoke(PassThroughHttpSender.java:281)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:337)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:158)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.xml.stream.XMLStreamException: DS Fault Message: Error in CSVQuery.runQuery.
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Source Data Service:-
Name: InvoiceReport
Location: /InvoiceReport.dbs
Description: N/A
Default Namespace: http://ws.wso2.org/dataservice
Current Request Name: _getinvoice
Current Params: {}
Nested Exception:-
DS Fault Message: Error in 'StaticOutputElement.execute', cannot find parameter with type:column name:Docnumber
DS Code: INCOMPATIBLE_PARAMETERS_ERROR
Below is Data service:
<data name="InvoiceReport" transports="http https local">
<config enableOData="false" id="CSV_InvoiceReport">
<property name="csv_datasource">/usr/lib/wso2/wso2ei/6.3.0/samples/data-services/resources/Invoice.csv</property>
<property name="csv_columnseperator">comma</property>
<property name="csv_startingrow">2</property>
<property name="csv_hasheader">true</property>
<property name="csv_headerrow">1</property>
</config>
<query id="Q2" useConfig="CSV_InvoiceReport">
<result outputType="json">{
"Products": {
"Product": [
{
"Docnumber":"$Docnumber",
"Invoicenumber":"$Invoicenumber",
"Documentdate":"$Documentdate",
"Invoiceduedate":"$Invoiceduedate",
"Customerid":"$Customerid",
"Documenttotal":"$Documenttotal",
"Quantity":"$Quantity",
"Unitprice":"$Unitprice",
"Extendedprice":"$Extendedprice",
"Consumer":"$Consumer",
"Servicename":"$Servicename"
}
]
}
}
</result>
</query>
<operation name="GetInvoiceReport">
<call-query href="Q2"/>
</operation>
<resource method="GET" path="Invoice">
<call-query href="Q2"/>
</resource>
</data>
Not sure where is the problem. Both are simple data service and didnot find any differences in creating them. One is working and one is not working at all.
Can some one please help me. Is this a bug?
Thanks in advance.
I am using WSO2 Enterprise Integrator 6.1.1 . I am using VFS to poll a file from one directory and move to another directory. But my proxy service is making a lock file, and unable to move the file. I initially thought that it is a file permission issue but when I try it with Inbound Endpoint or my custom java mediator called in a proxy service. Then file is successfully moved.
Lock File:
Proxy Service Code:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="TestCSVFileMoving"
startOnLoad="true"
statistics="disable"
trace="disable"
transports="vfs">
<target>
<inSequence>
<log level="full"
separator=",========----------Test CSV File Proxy Triggered------======="/>
</inSequence>
<faultSequence/>
</target>
<parameter name="transport.vfs.Streaming">true</parameter>
<parameter name="transport.PollInterval">30</parameter>
<parameter name="transport.vfs.FileURI">vfs:file:///files/uploads</parameter>
<parameter name="transport.vfs.ContentType">text/plain</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.MoveAfterFailure">vfs:file:///opt/file/con/Fail</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<parameter name="transport.vfs.FileNamePattern">Test.*.csv</parameter>
<parameter name="transport.vfs.MoveAfterProcess">vfs:file:///opt/file/con/Out</parameter>
<description/>
</proxy>
Error Logs:
TID: [-1234] [] [2018-01-10 12:51:56,634] ERROR {org.apache.synapse.transport.vfs.VFSTransportListener} - File object 'file:///files/uploads/Test.csv'cloud not be moved, will remain in "locked" state {org.apache.synapse.transport.vfs.VFSTransportListener}
org.apache.axis2.AxisFault: Error moving file : file:///files/uploads/Test.csv to file:///opt/file/con/Out
at org.apache.axis2.transport.base.AbstractTransportListener.handleException(AbstractTransportListener.java:343)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:682)
at org.apache.synapse.transport.vfs.VFSTransportListener.scanFileOrDirectory(VFSTransportListener.java:499)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:188)
at org.apache.synapse.transport.vfs.VFSTransportListener.poll(VFSTransportListener.java:134)
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:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not rename "file:///files/uploads/Test.csv" because it is read-only.
at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1087)
at org.apache.synapse.transport.vfs.VFSTransportListener.moveOrDeleteAfterProcessing(VFSTransportListener.java:680)
... 8 more
Problem Statement:
My Question is that in the error log, it clearly states that it is a read only file. But Why that by using Inbound Endpoint and Calling a custom mediator I am able to move the file.But using VFS only I am getting this error? Also is there any way to solve it. If I have to use the VFS.
When i tried to use the data mapper mediator I always get an error. I tried mapping the json response to xml.
[2016-07-14 14:05:26,684] ERROR - omdbapi DataMapper mediator : mapping failed
XML not well-formed. Error occurred while processing start element event
at org.wso2.carbon.mediator.datamapper.engine.input.readers.XMLReader.read(XMLReader.java:97)
at org.wso2.carbon.mediator.datamapper.engine.input.InputModelBuilder.buildInputModel(InputModelBuilder.java:52)
at org.wso2.carbon.mediator.datamapper.engine.core.mapper.MappingHandler.doMap(MappingHandler.java:59)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.transform(DataMapperMediator.java:244)
at org.wso2.carbon.mediator.datamapper.DataMapperMediator.mediate(DataMapperMediator.java:209)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:83)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:49)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:160)
at org.apache.synapse.rest.Resource.process(Resource.java:320)
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)
Here is my api. I just use the omdbapi to give an example.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/omdbapi" name="omdbapi" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/*">
<inSequence>
<send>
<endpoint>
<address trace="disable" uri="http://www.omdbapi.com/"/>
</endpoint>
</send>
</inSequence>
<outSequence>
<datamapper config="gov:datamapper/omdbapiConfig.dmc" inputSchema="gov:datamapper/omdbapiConfig_inputSchema.json" inputType="XML" outputSchema="gov:datamapper/omdbapiConfig_outputSchema.json" outputType="XML"/>
<respond/>
</outSequence>
<faultSequence/>
</resource>
</api>
If you are trying to map JSON-> XML, you need to specify in the Data Mapper Mediator configuration.
Make sure you set the input type as JSON.
And there have been beta2 release on wso2 esb. So try using beta2 packs for esb runtime and tooling. Use the latest pack and try.
I am facing error like below at esb terminal side,i done many things like rename file so and so...... then also i didnt get any thing.
ERROR - ProxyServiceFactory Target is required for a Proxy service definition.
WARN - ProxyServiceDeployer Proxy service hot deployment from file: /home/aa/Downloads/jack/LatestVersion/wso2esb-4.6.0/repository/deployment/server/synapse-configs/default/proxy-services/readings.xml failed - Continue in fail-safe mode
org.apache.synapse.SynapseException: Target is required for a Proxy service definition
at org.apache.synapse.config.xml.ProxyServiceFactory.handleException(ProxyServiceFactory.java:369)
at org.apache.synapse.config.xml.ProxyServiceFactory.createProxy(ProxyServiceFactory.java:220)
at org.apache.synapse.deployers.ProxyServiceDeployer.deploySynapseArtifact(ProxyServiceDeployer.java:58)
at org.wso2.carbon.proxyadmin.ProxyServiceDeployer.deploySynapseArtifact(ProxyServiceDeployer.java:73)
at org.apache.synapse.deployers.AbstractSynapseArtifactDeployer.deploy(AbstractSynapseArtifactDeployer.java:172)
at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136)
at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:810)
at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144)
at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:377)
at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:254)
at org.apache.axis2.deployment.RepositoryListener.startListener(RepositoryListener.java:371)
at org.apache.axis2.deployment.scheduler.SchedulerTask.checkRepository(SchedulerTask.java:59)
at org.apache.axis2.deployment.scheduler.SchedulerTask.run(SchedulerTask.java:67)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.runAxisDeployment(CarbonDeploymentSchedulerTask.java:67)
at org.wso2.carbon.core.deployment.CarbonDeploymentSchedulerTask.run(CarbonDeploymentSchedulerTask.java:112)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:165)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
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)
A Proxy Service should contain at least an Insequence or an Endpoint or both. Make sure your file has atleast the following basic format which uses an empty insequence.
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="ProxyName"
transports="https http"
startOnLoad="true"
trace="disable">
<description/>
<target>
<inSequence/>
</target>
</proxy>
you are getting above error as you didn't set the namespace correctly on the proxy service definition.
Can you add namespace as follows (with "http://"):
xmlns="http://ws.apache.org/ns/synapse"
Try after fixing your configuration as follows:
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="insertreadings"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<description/>
<target>
<inSequence/>
<outSequence>
<drop/>
</outSequence>
</target>
</proxy>
i see a semicolon ";" in your proxy configurations. Can you remove that and try? just before name
<proxy xmlns="ws.apache.org/ns/synapse";
name="insertreadings"
transports="https http"
startOnLoad="true"
trace="disable">