Monday, September 7, 2015

How to create a Proxy Service in WSO2 ESB (Enterprise Service Bus)?

Hi guys,

This is a quick post to help one of my friends who needed to know how to create a proxy service in WSO2 ESB.

Following is the simplest way to create a proxy service in ESB (as i know :D)

1. Go to the bin folder inside ESB HOME and Run the ESB server.

Note:- ESB HOME is the directory where you extracted the ESB product downloaded from the wso2 web site and all the installation guides are available in the product document.

2. Open the ESB management console by going to https://localhost:9443/carbon/ 
    and login as the super user.
    (default username: admin, default password: admin)

okay ... now we got the ESB running .... now if you have a service running in local server like axis2 or service running in external server get the .wsdl file of  the service. if you want to create a simple service using axis2 refer to the this blog.

I am continuing to create a Proxy service assuming that you already have a service up and running.





3. In the Main navigation menu select proxy service under add in the services tab.

                               Services->Add->Proxy Service



4. Now select the "Custom Proxy" from the select template table. More details...

5. Now in the next page fill the necessary details as following image shows


Proxy service name: Name of the proxy service that you creating. this will be used in service clients to call the original service.

my proxy service name is "StockQuote".

Publishing WSDL: there are few options to select in here. i personally like 2 options which are "Specify in-line" and "Specify source url".

        Specify in-line:  can copy and paste the .wsdl definition here
 Specify source url:  give the wsdl url.

I have chosen specify source url and my wsdl url is http://localhost:9000/services/SimpleStockQuoteService?wsdl

Next select Transport protocols in the "Transport settings" placed down below above page.

I chose http and https.

More Details... 

6. Click next and go to the next page.

7. In here we have to define the sequencing for the service. Sequence means the work flow of transporting data between client and service.



In the "Define In Sequence" we have to define the in sequence. but in this example i keep it as "none". 

In the "Define Endpoint" select the define in-line and click on the create link.




then it'll direct you to following page. From that select "Address Endpoint"


After clicking the Address Endpoint link you'll be directed to a page to enter your service url. My Service url is http://localhost:9000/services/SimpleStockQuoteService










 now click save&close button. it'll direct you to the previous page. from there click next.



 8. Next page will provide details to create the out sequence and the fault sequence.

    
In the "Define Out Sequence" select define in-line and click on create link. It'll direct you to a page where you have work flow editor.

in there click "add child" link next to root lable and then from the drop down select "core" and from the sub menu select "send".


Then click save&close. it'll direct you to the previous page and from there you can click finish.

More Details about sequences.

9. Now in the Services->List , you can see the created proxy service. (If you cannot see it refresh the home page few times).

 10. Now if you click on the service name it'll display the service details including deployed urls which can be used by clients to access the proxy service.


Endpoints
https://localhost:8243/services/StockQuote
http://localhost:8280/services/StockQuote

 11. Now you can try the proxy service you created using "try this service" link which direct you to "try it" tool.


 it's working fine.....







Well done ...  you created a proxy service using WSO2 ESB. :D 

Hope this will help.
Find What will be posted next here.
See ya in another blog post ....

No comments:

Post a Comment