Thanks, I figured that out. What I was asking [Now its just a curiosity], is that , I had generated stubs using wsdl2java. How do I pass the session token to that code The following is a usage of the generated code. I used the netbeans web service client wizard to generate the code.
private static java.util.List<org.wso2.carbon.user.mgt.common.xsd.FlaggedName> listAllUsers(java.lang.String filter, java.lang.Integer limit) throws UserAdminUserAdminException { org.wso2.carbon.user.mgt.UserAdmin service = new org.wso2.carbon.user.mgt.UserAdmin(); org.wso2.carbon.user.mgt.UserAdminPortType port = service.getUserAdminHttpsSoap11Endpoint(); return port.listAllUsers(filter, limit); } On Thu, Jul 27, 2017 at 12:00 AM, KasunG Gajasinghe <kas...@wso2.com> wrote: > > You can check this class [1] on how the AuthenticationAdminStub is used to > login to WSO2. It also shows how to extract the session cookie. > > The sample at [2] shows how to add the session cookie to your stub. > > HTH > > [1] https://github.com/wso2/product-es/blob/5da6bdd53f14e10aed4f799606e528 > 4b627c1e1c/modules/integration/tests-common/admin-clients/src/main/java/ > org/wso2/es/integration/common/clients/AuthenticatorClient.java#L37 > > [2] https://github.com/wso2/product-es/blob/5da6bdd53f14e10aed4f799606e528 > 4b627c1e1c/modules/integration/tests-common/admin-clients/src/main/java/ > org/wso2/es/integration/common/clients/AuthenticateStub.java#L52 > > > On Wed, Jul 26, 2017 at 11:43 PM, Sagar Kapadia <ks197...@gmail.com> > wrote: > >> Can you also help me with the authentication part? I get a blank session >> id >> >> >> On Wed, Jul 26, 2017 at 11:43 PM, Sagar Kapadia <ks197...@gmail.com> >> wrote: >> >>> Hi, >>> Thanks a lot , KasunG Gajasinghe. You made my day. :D. It worked. >>> Sagar >>> >>> >>> On Wed, Jul 26, 2017 at 11:40 PM, KasunG Gajasinghe <kas...@wso2.com> >>> wrote: >>> >>>> >>>> >>>> On Wed, Jul 26, 2017 at 11:34 PM, Sagar Kapadia <ks197...@gmail.com> >>>> wrote: >>>> >>>>> I am trying to call a method in the EventStreamAdminService. However, >>>>> I get the following exception. I tried to fix the wsdl and recreate the >>>>> jar, but because of the compiled classes containing a reference to >>>>> 10.100.1.144, it did not work either. What is the work around? Do I have >>>>> to >>>>> rebuild the jar from source? >>>>> >>>> >>>> Not really. When creating the EventStreamAdminServiceStub instance, >>>> you can pass your own endpoint. Check the over-loaded constructors. >>>> >>>> >>>> >>>>> >>>>> Jul 26, 2017 11:30:20 PM org.apache.axis2.transport.htt >>>>> p.impl.httpclient3.HTTPSenderImpl sendViaPost >>>>> INFO: Unable to sendViaPost to url[https://10.100.1.144:9443/ >>>>> services/EventStreamAdminService.EventStreamAdminServiceHttp >>>>> sSoap12Endpoint/] >>>>> org.apache.axis2.AxisFault: Transport error: 405 Error: Method Not >>>>> Allowed >>>>> at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderI >>>>> mpl.handleResponse(HTTPSenderImpl.java:343) >>>>> at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderI >>>>> mpl.sendViaPost(HTTPSenderImpl.java:213) >>>>> at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.j >>>>> ava:121) >>>>> at org.apache.axis2.transport.http.CommonsHTTPTransportSender.w >>>>> riteMessageWithCommons(CommonsHTTPTransportSender.java:403) >>>>> at org.apache.axis2.transport.http.CommonsHTTPTransportSender.i >>>>> nvoke(CommonsHTTPTransportSender.java:234) >>>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431) >>>>> at org.apache.axis2.description.OutInAxisOperationClient.send(O >>>>> utInAxisOperation.java:399) >>>>> at org.apache.axis2.description.OutInAxisOperationClient.execut >>>>> eImpl(OutInAxisOperation.java:225) >>>>> at org.apache.axis2.client.OperationClient.execute(OperationCli >>>>> ent.java:150) >>>>> at org.wso2.carbon.event.stream.stub.EventStreamAdminServiceStu >>>>> b.getStreamNames(EventStreamAdminServiceStub.java:3246) >>>>> at com.avinashi.wso2das.adminapi.Application.main(Application.java:80) >>>>> >>>>> org.apache.axis2.AxisFault: Transport error: 405 Error: Method Not >>>>> Allowed >>>>> at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderI >>>>> mpl.handleResponse(HTTPSenderImpl.java:343) >>>>> at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderI >>>>> mpl.sendViaPost(HTTPSenderImpl.java:213) >>>>> at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.j >>>>> ava:121) >>>>> at org.apache.axis2.transport.http.CommonsHTTPTransportSender.w >>>>> riteMessageWithCommons(CommonsHTTPTransportSender.java:403) >>>>> at org.apache.axis2.transport.http.CommonsHTTPTransportSender.i >>>>> nvoke(CommonsHTTPTransportSender.java:234) >>>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431) >>>>> at org.apache.axis2.description.OutInAxisOperationClient.send(O >>>>> utInAxisOperation.java:399) >>>>> at org.apache.axis2.description.OutInAxisOperationClient.execut >>>>> eImpl(OutInAxisOperation.java:225) >>>>> at org.apache.axis2.client.OperationClient.execute(OperationCli >>>>> ent.java:150) >>>>> at org.wso2.carbon.event.stream.stub.EventStreamAdminServiceStu >>>>> b.getStreamNames(EventStreamAdminServiceStub.java:3246) >>>>> at com.avinashi.wso2das.adminapi.Application.main(Application.java:80) >>>>> >>>>> Sagar >>>>> >>>>> >>>>> On Wed, Jul 26, 2017 at 6:32 PM, Sagar Kapadia <ks197...@gmail.com> >>>>> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> I used this tutorial >>>>>> https://docs.wso2.com/display/DAS300/Calling+Admin+Services+from+Apps >>>>>> >>>>>> I am facing the following issues in importing the WSDL files and >>>>>> generating the code >>>>>> I get the following error message when I call >>>>>> wsimport AuthenticationAdmin.xml >>>>>> >>>>>> [ERROR] missing required attribute "message" of element "wsdl:output" >>>>>> >>>>>> >>>>>> Failed to parse the WSDL. >>>>>> >>>>>> I could not fix this issue. >>>>>> >>>>>> In another wsdl file "UserAdmin", I got multiple errors, >>>>>> [ERROR] operation "" has an invalid style >>>>>> which I fixed as follows >>>>>> https://stackoverflow.com/questions/12155114/generating-stub >>>>>> s-with-jax-ws-fails >>>>>> I added <wsdl:output message="tns::<OperationName>Response"> and >>>>>> also >>>>>> corresponding >>>>>> <wsdl:message name="<NameofMessage>"> >>>>>> >>>>>> I was able to generate code for the UserAdmin sevice, but not for >>>>>> AuthenticationAdmin Service >>>>>> >>>>>> By the way the reason I tried to generate code for the >>>>>> Autherntication Service is that login fails without any exception . The >>>>>> token returned is null. >>>>>> I am sharing a link to the source code [Netbeans project] for the web >>>>>> service client and the the modified wsdl files I am using >>>>>> >>>>>> >>>>>> Link to the source >>>>>> https://drive.google.com/open?id=0BwqZCw5oc2rwcmJGTllNbEo2U00 >>>>>> >>>>>> >>>>>> The help I require is primarily with the login functionality, because >>>>>> its failing. Also, is the manner I am trying to fix the wsdls correct? >>>>>> [Adding wsdl:output with message] >>>>>> >>>>>> >>>>>> Sincerely >>>>>> Sagar >>>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> Dev mailing list >>>>> Dev@wso2.org >>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>>> >>>>> >>>> >>>> >>>> -- >>>> >>>> *Kasun Gajasinghe*Associate Technical Lead, WSO2 Inc. >>>> email: kasung AT spamfree wso2.com >>>> linked-in: http://lk.linkedin.com/in/gajasinghe >>>> blog: http://kasunbg.org >>>> phone: +1 650-745-4499 <+1%20650-745-4499>, 77 678 0813 >>>> >>>> >>> >>> >> > > > -- > > *Kasun Gajasinghe*Associate Technical Lead, WSO2 Inc. > email: kasung AT spamfree wso2.com > linked-in: http://lk.linkedin.com/in/gajasinghe > blog: http://kasunbg.org > phone: +1 650-745-4499, 77 678 0813 > >
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev