Noel
Noel

Reputation: 59

WS02: Invoking external weather SOAP webservice from ESB

I am trying to use WSO2 ESB (version 4.8.1) to invoke externally hosted SOAP web services. To try it out I was using a public web service for weather information (http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL), more specifically the GetWeatherInformation operation.

I have successfully consumed the web service using the soapUI tool.

I am a newcomer to SOAP and ESB, so I tried to follow a number of blog entries, but I keep on getting errors. I tried using proxy service, payload factory and send but still didn't manage. Can somebody please help me with setting this up?

Thanks

Upvotes: 0

Views: 2188

Answers (2)

Jean-Michel
Jean-Michel

Reputation: 5946

Here come a sample API to invoke GetWeatherInformation :

<?xml version="1.0" encoding="UTF-8"?>
<api xmlns="http://ws.apache.org/ns/synapse"
     name="testws3api"
     context="/testws3api">
   <resource methods="GET" url-mapping="/GetWeatherInformation">
      <inSequence>
         <payloadFactory media-type="xml">
            <format>
               <GetWeatherInformation xmlns="http://ws.cdyne.com/WeatherWS/"/>
            </format>
            <args/>
         </payloadFactory>
         <send>
            <endpoint>
               <address uri="http://wsf.cdyne.com/WeatherWS/Weather.asmx" format="soap11"/>
            </endpoint>
         </send>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
   </resource>
</api>

You just have to send a GET http request to http://esb.hostname:8280/testws3api/GetWeatherInformation (use SoapUI or type this address in your internet browser) and you will get back the XML response from the Weather WS

Upvotes: 1

Jean-Michel
Jean-Michel

Reputation: 5946

It works with this proxy conf deployed in WSO2 ESB v4.8.1 :

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="testws3"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <target>
      <endpoint>
         <wsdl service="Weather"
               port="WeatherSoap12"
               uri="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL"/>
      </endpoint>
      <outSequence>
         <send/>
      </outSequence>
   </target>
   <publishWSDL uri="http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL"/>
</proxy>

Upvotes: 0

Related Questions