java axis web service client setMaintainSession on multiple services (cookies?)

前端 未结 1 811
孤街浪徒
孤街浪徒 2021-01-21 12:20

I\'m implementing a client to a web service (and the guys maintaining the web service have been a litte unresponsive..) I\'ve used axis and WSDL2Java to generate java classes an

相关标签:
1条回答
  • 2021-01-21 12:52

    Hooray, I finally solved it myself :-D Thanx a lot to the excellent article at http://www.nsftools.com/stubby/ApacheAxisClientTips.htm I had to do the following with my code to make it work:

    CompanyServiceLocator cl = new CompanyServiceLocator();
    cl.setMaintainSession(true);
    CompanyServiceSoap css = cl.getCompanyServiceSoap();
    ((Stub)css)._setProperty(HTTPConstants.HEADER_COOKIE, "ASP.NET_SessionId="+sessionId); //New line that does the magic
    css.getCountryList(); //SUCCESS :-D
    

    Operating in the high-level abstraction of the autogenerated classes, it was unknown to me that casting the service classes to Stub would expose more methods and properties that could be set. Good to know for later I guess :-)

    0 讨论(0)
提交回复
热议问题