I have a simple RESTful service that I want to publish as a SOAP-based web service using the WSO2 ESB.
My simple RESTful service can be called as http://<<my system>>:8080/myapp/person/read As a response, I get the JSON data of the Person object.
Problem: I cannot pass parameters to the RESTful service. I have to remove the parameter value from SOAP input, but donโt know how to pass it to my RESTful; using ESB.
I installed the following in a WSO2 ESB
<proxy xmlns="http://ws.apache.org/ns/synapse" name="PersonProxy" transports="https,http" statistics="enable" trace="enable" startOnLoad="true"> <target> <inSequence> <property xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" name="PERSON_ID" expression="//soapenv:Body/person/id"/> <log level="full"> <property name="PERSON_ID" expression="get-property('PERSON_ID')"/> </log> <filter xpath="//person"> <then> <property name="REST_URL_POSTFIX" value="read" scope="axis2" type="STRING"/> <property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/> <property name="id" expression="get-property('PERSON_ID')" scope="axis2" type="STRING"/> <property name="ContentType" value="application/x-www-form-urlencoded" scope="axis2" type="STRING"/> </then> <else/> </filter> <send> <endpoint> <address uri="http://<<my system>>:8080/myapp/person" format="rest"/> </endpoint> </send> </inSequence> <outSequence> <send/> </outSequence> </target> <description></description> </proxy>
My SOAP request is as follows
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body> <person> <id>3</id> </person> </soapenv:Body> </soapenv:Envelope>
I have another RESTful service with a GET and id method as part of the url itself, and this works fine. ESB configuration looks like
<property name="REST_URL_POSTFIX" expression="get-property('PERSON_ID')" scope="axis2" type="STRING"/> <property name="HTTP_METHOD" value="GET" scope="axis2" type="STRING"/> <endpoint> <address uri="http://<<my system>>:8080/cfs/person" format="rest"/> </endpoint>
Appreciate any pointers or help.
source share