Eclipse 使用wsdl和axis2生成ws-client

Eclipse 使用wsdl和axis2生成ws-client,eclipse,wsdl,jax-ws,axis2,Eclipse,Wsdl,Jax Ws,Axis2,我有这个wsdl <?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.7-hudson-48-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS

我有这个wsdl

<?xml version='1.0' encoding='UTF-8'?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.7-hudson-48-. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.7-hudson-48-. -->
<definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservice.consulta.spcjava.spcbrasil.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webservice.consulta.spcjava.spcbrasil.org/" name="consultaWebService">
<types>
<xsd:schema>
<xsd:import namespace="http://webservice.consulta.spcjava.spcbrasil.org/" schemaLocation="https://servicos.spc.org.br:443/spc/remoting/ws/consulta/consultaWebService?xsd=1" />
</xsd:schema>
</types>
<message name="consultar">
<part name="filtro" element="tns:filtro" />
</message>
<message name="consultarResponse">
<part name="resultado" element="tns:resultado" />
</message>
<message name="listarProdutos" />
<message name="listarProdutosResponse">
<part name="produtos" element="tns:produtos" />
</message>
<message name="detalharProduto">
<part name="codigo-produto" element="tns:codigo-produto" />
</message>
<message name="detalharProdutoResponse">
<part name="produto" element="tns:produto" />
</message>
<portType name="consultaWebService">
<operation name="consultar">
<input message="tns:consultar" />
<output message="tns:consultarResponse" />
</operation>
<operation name="listarProdutos">
<input message="tns:listarProdutos" />
<output message="tns:listarProdutosResponse" />
</operation>
<operation name="detalharProduto">
<input message="tns:detalharProduto" />
<output message="tns:detalharProdutoResponse" />
</operation>
</portType>
<binding name="consultaWebServicePortBinding" type="tns:consultaWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="consultar">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="listarProdutos">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="detalharProduto">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="consultaWebService">
<port name="consultaWebServicePort" binding="tns:consultaWebServicePortBinding">
<soap:address location="https://servicos.spc.org.br:443/spc/remoting/ws/consulta/consultaWebService" />
</port>
</service>
</definitions>

当我使用axis2生成wsdl时,会出现错误

为WSDL:org.apache.axis2.AxisFault:wsdleException(at/definitions/types/xsd:schema)生成代码期间发生异常:faultCode=OTHER_错误:尝试解析在“”处引用的架构时出错,相对于“文件:/C:/Users/Tiago-Roque/workspace/spe/WebContent/WEB-INF/ws/consultaWebService.xml.wsdl.”:java.io.IOException:服务器返回了URL的HTTP响应代码:401:

我使用eclipse生成
有人能帮我吗?

wsdl引用了一个受访问保护的外部xml模式(请参见
xsd:import
)。这就是为什么会出现401(未经授权)错误(
https://servicos.spc.org.br:443/spc/remoting/ws/consulta/consultaWebService?xsd=1


可能您可以请求wsdl的内联版本(其中所有模式定义都内联在一个完整的wsdl中)。

当我使用netbeans并尝试不使用axis2时:new\client to webservice\Local文件显示要输入的用户和密码,并生成客户端,但不是axis2格式。eclipse中的axis2也应该显示用户和密码?根据当前的axis文档,这可能没有实现(至少我找不到关于它的任何信息)。但是,由于您正在处理HTTP基本身份验证,因此可以在URL中传递凭据:
https://user:secretpassword@com/path/to/wsdl
奇怪的是,在我的工作中,我有6月份版本的eclipse,今天我设法生成了用户wsdl和密码,并生成了webservice客户端。我想问题在于我在家里安装的Luna版本的Eclipse。谢谢你的帮助