0
votes

I am fairly new to WS02 ESB -- my company implemented it a few months ago.

Currently, I am attempting to put a REST layer over the top of a WCF service. The use case I am trying to implement is for a location api in which mobile apps (iphone, android) provide location data to the WCF service via RESTful xml.

My current data flow is structured like Mobile App -> REST API -> ESB Proxy -> WCF Service.

The xml provided to the REST endpoint in the payload is this:

<Location Partner='{API Parnert Name}' Code='{API Partner Code}' Password='{API Partner Password}' Generated='2013-04-16T16:30:15Z'>
  <Latitude>44.5881</Latitude>
  <Longitude>-89.581248</Longitude>
  <Accuracy>75.334</Accuracy>
  <MobileDeviceUID>A1000017B8B437</MobileDeviceUID>
</Location>

In order to route this xml through WSO2 ESB I have created an API and a Service Proxy. (Everything is running locally on my machine)

The API is configured like this:

<api xmlns="http://ws.apache.org/ns/synapse" name="API_LOC" context="/WS1/Location">
   <resource methods="POST">
      <inSequence>
         <log level="full" category="DEBUG"/>
         <send>
            <endpoint>
               <address uri="http://localhost:8280/services/WS1LocationProxy/AddLocation" format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
         <log level="full"/>
      </outSequence>
   </resource>
</api>

And my proxy is configured like this:

<proxy xmlns="http://ws.apache.org/ns/synapse" name="WS1LocationProxy" transports="https,http" statistics="disable" trace="disable" startOnLoad="true">
   <target>
      <inSequence>
         <log level="full" category="TRACE"/>
         <property name="FORCE_HTTP_1.0" value="true" scope="axis2"/>
         <send>
            <endpoint>
               <address uri="http://localhost:54270/WS1LocationService.svc"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <publishWSDL uri="http://localhost:54270/WS1LocationService.svc?wsdl"/>
   <parameter name="useOriginalwsdl">true</parameter>
   <parameter name="interface">WS1LocationService</parameter>
   <parameter name="serviceType">proxy</parameter>
   <description></description>
</proxy>

My main question is this: how can I transform the POST payload of the incoming REST request into the SOAP envelope needed for the WCF service in the proxy. I haven't been able to find good examples of such a process.

1

1 Answers

1
votes

You dont need to manually transform it..Incoming POST request will be converted to SOAP message for processing in ESB.. You can check that with a log mediator in your proxy.. In the insequence..just use a log mediator and see the output..

<log level="full" >
   <property name ="incoming message" value="*****"/>
</log>