简体   繁体   English

Apache Axis2 Java客户端访问Bronto SOAP WSDL

[英]Apache Axis2 Java client to access Bronto SOAP WSDL

I've downloaded Apache Axis2, using the following link: http://archive.apache.org/dist/ws/axis2/1_4_1/axis2-1.4.1-bin.zip 我已经使用以下链接下载了Apache Axis2: http : //archive.apache.org/dist/ws/axis2/1_4_1/axis2-1.4.1-bin.zip

Then I used the following command to generate java classes: wsdl2java.sh -uri https://api.bronto.com/v4?wsdl total generated src: BrontoSoapApiImplServiceStub.java BrontoSoapApiImplServiceCallbackHandler.java ApiExceptionException0.java 然后,我使用以下命令来生成Java类:wsdl2java.sh -uri https://api.bronto.com/v4?wsdl总生成的src:BrontoSoapApiImplServiceStub.java BrontoSoapApiImplServiceCallbackHandler.java ApiExceptionException0.java

I was able to login using the following. 我可以使用以下方式登录。

BrontoSoapApiImplServiceStub stub;

// Get the stub...

LoginE loginE = new LoginE();
Login login = new Login();

login.setApiToken("your token here");
loginE.setLogin(login);

// Call the web service; login
stub.login(loginE);

Now I try to addContacts, and needs SessionHeaderE, but I can't seem to link login to the sessionId, the following code is not right. 现在,我尝试添加联系人,并需要SessionHeaderE,但是我似乎无法将登录链接到sessionId,以下代码不正确。 I'm imaging after login, I should be able to get some session info. 登录后我正在成像,我应该能够获得一些会话信息。 But I can't seem to find. 但我似乎找不到。

SessionHeader sessionHeader = new SessionHeader();
sessionHeader.setSessionId(param)  // I don't know how to get sessionId from login info
SessionHeaderE sessionHeaderE = new SessionHeaderE();
sessionHeaderE.setSessionHeader(sessionHeader);
.....
AddContactsResponseE responseE = stub.addContacts(addContactsE, sessionHeaderE);

By the way, this is my first time working with Axis. 顺便说一句,这是我第一次与Axis合作。 Not sure what's the best way to approach the problem. 不确定解决问题的最佳方法是什么。 BrontoSoapApiImplServiceStub.java has more than 200,000 lines in it. BrontoSoapApiImplServiceStub.java中包含200,000多行。

I got the answer from http://www.experts-exchange.com 我从http://www.experts-exchange.com获得了答案

String sessionId = stub.login(loginE).getLoginResponse().get_return(); 字符串sessionId = stub.login(loginE).getLoginResponse()。get_return();

Thanks. 谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM