Saturday, September 15, 2012

Create a proxy in WSO2 ESB using admin services.

Do you want to know how to create a proxy in WSO2 ESB without using UI. Here is a sample code
that will help you to understand how to use an admin service to achieve the task.
package org.wso2.test;

import org.apache.axis2.AxisFault;
import org.wso2.carbon.proxyadmin.stub.ProxyServiceAdminProxyAdminException;
import org.wso2.carbon.proxyadmin.stub.ProxyServiceAdminStub;
import org.wso2.carbon.proxyadmin.stub.types.carbon.ProxyData;
import org.wso2.carbon.utils.CarbonUtils;

import java.rmi.RemoteException;

public class TestProxy {

    public static void main(String[] args)
            throws RemoteException, ProxyServiceAdminProxyAdminException {

        String userName = "admin";
        String password = "admin";
        // Add the service URL
        String serviceEndPoint="http://localhost:8281/services/echo" ;
        // Proxy Admin service's endpoing URL
        String endPoint = "https://localhost:9444/services/" +"ProxyServiceAdmin";

        // Set client trust store
        System.setProperty("", "/media/data/wso2/products/wso2/esb/" +
                                                       "wso2esb-4.5.0/repository/resources/security" +
        System.setProperty("", "wso2carbon");

        ProxyServiceAdminStub proxyServiceAdminStub = new ProxyServiceAdminStub(endPoint);

        CarbonUtils.setBasicAccessSecurityHeaders(userName, password,

        //Set proxy configuration data
        String[] transport = {"http", "https"};
        ProxyData data = new ProxyData();
        data.setEndpointXML("<endpoint http:="http:" ns="ns" synapse="synapse""" xmlns="\"><address serviceendpoint="serviceendpoint" uri="\">


Download complete maven project here


  1. I upgraded my php to 5.3.X.
    I installed file downloaded from
    I installed wso2.
    I am getting the error 'Fatal error: Cannot use object of type WSData as array in wsf_wsdl.php on line 211'...
    Do you know what is the problem?
    Can you help me? This is veru critical to me.
    Thanks in advance

  2. I tried this but got this error:

    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axiom/om/OMFactory
    at org.wso2.test.TestProxy.main(
    Caused by: java.lang.ClassNotFoundException:
    at Method)
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    ... 1 more
    Java Result: 1

    Do you know why?

    1. Did you build the maven project attached in the blog post and try to run? You need to have required dependencies in the classpath to run? If you are running the project outside the IDE which you open the maven project, make sure required jars available in the classpath. You can run ant command in ESB_HOME/bin folder and then point ESB_HOME/repository/lib location to classpath.

    2. Yes, If you please could have a look:
      I tried it with Eclipse Juno, ESB 4.6.0 and Mac OS-X.

  3. I think you have not changed the ports of the ESB 4.6.0. Then you should change the proxy service admins URL.
    https://localhost:9444/services/" +"ProxyServiceAdmin. Change the port to default one which is 9443. And also make sure you change the WSDL uri to 8280 also.

  4. I have best idea to open any blocked site very easily and no need to change any proxy just one click and open any site very easily and you can access anywhere you are
    DownloadForAll UK proxy

  5. Hey everyone now I am telling you a way to open unblock torrent sites by using just simple click.
    access Mp3skull in UK

  6. Yes i got it that you provided into this post. I will try the codes you shared.

    Some pc tips get here pccenter

  7. This would work if you wan to use Facebook at work, and need to change your IP address, but at the same time don't want to change the country of your IP. VPN For British IPs

  8. The main IP address an Internet have knows about is the IP address of the proxyfree mexico vpn

  9. Intermediaries are equipped for keeping you absolutely unknown from programmers and logs.

  10. Appreciating the persistence you put into your blog and detailed information you provide. I’ve bookmarked your site and I’m adding your RSS feeds to my Google account. Visit website

  11. It was thinking about whether I could utilize this review on my other site, I will connect it back to your site though.Great Thanks. diebestenvpn

  12. Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? VPN

  13. Interesting post. I Have Been wondering about this issue. so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks

  14. I have perused your online journal it is exceptionally useful for me. I need to express profound gratitude to you. I have bookmark your site for future redesigns.

  15. Your neighborhood ISP accomplished something that interfered with your system association sufficiently long for the VPN Contivity change to recognize your customer was not reacting; express vpn not working with netflix

  16. I have looked couple of days and discovered some spellbinding formed work on it. In any case, it is the best of all. lesmeilleursvpn

  17. Hi there, I found your blog via Google while searching for such kinda informative post and your post looks very interesting for me. lemigliorivpn

  18. This is a wonderful product, taking into account all the information about it, this type of product that prevents user interest in the site, and you will share more ... good luck.  meer informatie

  19. Extremely intriguing online journal. A lot of web journals I see nowadays don't generally give anything that I'm keen on, however I'm most definitely inspired by this one. Recently felt that I would post and let you know. meer informatie

  20. VPS hosting can be considered as an extension between a mutual and a devoted server, since it offers extraordinary adaptability at an awesome cost. Hence a VPS can be an answer for every one of your needs. buy

  21. This comment has been removed by the author.

  22. If you want activate the remote management of the router. You can find it here router setting.