如何配置Eclipse以使用Web服务?

如何配置Eclipse以使用Web服务?,eclipse,axis2,Eclipse,Axis2,我试图生成与web服务交互的客户机代码,但我很难确定可以对服务器进行哪些过程调用。我认为在Eclipse中构建该API是帮助我理解API的一条很好的捷径,但我真的不知道从哪里开始使用Eclipse。现在我正在使用axis2并从命令行运行wsdl2java: wsdl2java.sh -uri http://www.xignite.com/xQuotes.asmx?WSDL -s -ap -o xignite 这将生成我需要的所有存根,但我需要将我的凭据添加到头中,下面的示例代码给出了相应的函数

我试图生成与web服务交互的客户机代码,但我很难确定可以对服务器进行哪些过程调用。我认为在Eclipse中构建该API是帮助我理解API的一条很好的捷径,但我真的不知道从哪里开始使用Eclipse。现在我正在使用axis2并从命令行运行wsdl2java:

wsdl2java.sh -uri http://www.xignite.com/xQuotes.asmx?WSDL -s -ap -o xignite
这将生成我需要的所有存根,但我需要将我的凭据添加到头中,下面的示例代码给出了相应的函数Header1(),但这是不正确的,我需要找到正确的函数

//Instantiate the service
XigniteQuotesXigniteQuotesSoapStub stub = new XigniteQuotesXigniteQuotesSoapStub();
//Instantiate the objects that will let you build the SOAP Header
Header1 header = new Header1();
//Create the Header
Header h = new Header();
//Assign your email address (me@myfirm.com) to the Username element
h.setUsername("me@myfirm.com");
//Set the password
h.setPassword("");
//Set the SOAP header
header.setHeader(h);
//Create the arguments needed for the call
GetQuotes getQuotes = new GetQuotes();
getQuotes.setSymbol("msft,aapl");
//Make the call with the arguments and the header
GetQuotesResponse response = stub.GetQuotes(getQuotes, header);

当使用现有的WSDL时,我总是使用它来快速原型化,并查看服务提供了什么方法——软件有一个免费的社区版本。此外,还有一个for it,其功能与单机版相同。

在stackoverflow.com中,您可能会有更好的运气。谢谢!SoapUI是一个很好的工具,可以帮助我实现我的目标。