Monday, December 12, 2011

How to write a proxy to filter soap 1.1 requests with WSO2 ESB

Download WSO2 ESB and start the server.

We will be using SimpleStockQuoteService  service. So go to wso2esb-4.0.3/samples/axis2Server/src/SimpleStockQuoteService and type 'ant' in order to build.

Go to wso2esb-4.0.3/samples/axis2Server and type ./

Use admin/admin as username and password.

Select source view (Under service bus tab).

Use the following code for proxy. (Paste the code above the <definitions> tag)

<proxy name="DummyProxy" transports="https http" startOnLoad="true" trace="disable">
                <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
                <log level="full"/>
                <filter xmlns:soapenv="" xpath="/soapenv:Envelope ">
                        <log level="custom">
                            <property name="MSG_FLOW" value="soap 1.1 success!!!"/>

Click update.

Click list option under Web services. You will be able to see the proxy which you created. (DummyProxy).

The relevant wsdl is generated and it can be accessed from http://localhost:8280/services/DummyProxy?wsdl

Using soapUI to test the proxy service.

Create a new soapUI project and provide the wsdl of the SimpleStockQuoteService

Edit the current endpoint as http://localhost:8280/services/DummyProxy

Use the following soap request

<soap:Envelope xmlns:soap="" xmlns:ser="http://services.samples">

(replace "?" with "Apple" )

Try with soap 1.1 and soap 1.2 using soapUI.

Using soap 1.1 - You can see the following output

Using soap 1.2 - You cannot see the above message as this proxy filters soap 1.1 an drops others.

No comments:

Post a Comment