1) Hello I am trying to use the admin services to create an Proxy inside the ESB.
So I have exposed the admin services (Hidden=false)
I have imported the WSDl in my Java project https://localhost:8243/services/ProxyServiceAdmin?wsdl
But I cannot workout how to call the method addProxy
am I using the wrong admin service? Please help with an example of consuming this method.
ProxyServiceAdmin ps = new ProxyServiceAdmin();
ps.addProxy(); //wrong
2) I have a proxy defined as a one-line String, like
String xmlproxy="<?xml version='1.0' encoding='UTF-8'?><proxy xmlns='http://ws.apache.org/ns/synapse' name='MyProxy1' transports='https' startOnLoad='true' trace='disable'> <target inSequence='sequence1'>...."
Is it possible to add this Proxy by calling some method of the admin services?
thanks a lot for your attention!
EDIT I had a look at the WSDL "ProxyServiceAdmin?wsdl"
it says <wsdl:operation name="addProxy"><http:operation location="addProxy"/><wsdl:input><mime:content type="text/xml" part="parameters"/></wsdl:input><wsdl:output><mime:content type="text/xml" part="parameters"/></wsdl:output>
so it is there, but why I cannot call it? Why my code does not work as a normal Web Service would? Really, please help. I don't get what i am doing wrong...
ProxyServiceAdmin ps = new ProxyServiceAdmin();
ps.addProxy(); //not recognized as an operation of ProxyServiceAdmin even if it is in the wsdl
You simply have to use "org.wso2.carbon.proxyadmin.stub.ProxyServiceAdminStub" to ad proxy by admin services
Please have a look at following code and comments inline.
You have to authenticate your service stub before make any use of it
Need to generate ProxyData object of your proxy as synaps xml
Thank You, Dharshana
This is the JSP page is used for creating a pass through proxy. You can fill your proxy data similar to that. if you browse the other jsps you can find similar logics used for different proxy templates. Here you can find the complete module, both UI and Service code.
please find the sample to create a proxy using admin service here. I added Darshana's code to a complete example.