在http://127.0.0.1:8083/WebRoot/services/HelloWorld?wsdl的内容为:
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://webservice.lib.free" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.lib.free" xmlns:intf="http://webservice.lib.free" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!--
WSDL created by Apache Axis version: 1.2beta3
Built on Aug 01, 2004 (05:59:22 PDT) -->
<wsdl:message name="sayHelloRequest" />
- <wsdl:message name="sayHelloResponse">
<wsdl:part name="sayHelloReturn" type="soapenc:string" />
</wsdl:message>
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="sayHello">
<wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest" />
<wsdl:output message="impl:sayHelloResponse" name="sayHelloResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="HelloWorldSoapBinding" type="impl:HelloWorld">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="sayHelloRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservice.lib.free" use="encoded" />
</wsdl:input>
- <wsdl:output name="sayHelloResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservice.lib.free" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="impl:HelloWorldSoapBinding" name="HelloWorld">
<wsdlsoap:address location="http://127.0.0.1:8083/WebRoot/services/HelloWorld" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://webservice.lib.free" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://webservice.lib.free" xmlns:intf="http://webservice.lib.free" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <!--
WSDL created by Apache Axis version: 1.2beta3
Built on Aug 01, 2004 (05:59:22 PDT) -->
<wsdl:message name="sayHelloRequest" />
- <wsdl:message name="sayHelloResponse">
<wsdl:part name="sayHelloReturn" type="soapenc:string" />
</wsdl:message>
- <wsdl:portType name="HelloWorld">
- <wsdl:operation name="sayHello">
<wsdl:input message="impl:sayHelloRequest" name="sayHelloRequest" />
<wsdl:output message="impl:sayHelloResponse" name="sayHelloResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="HelloWorldSoapBinding" type="impl:HelloWorld">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="sayHello">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="sayHelloRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservice.lib.free" use="encoded" />
</wsdl:input>
- <wsdl:output name="sayHelloResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://webservice.lib.free" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="HelloWorldService">
- <wsdl:port binding="impl:HelloWorldSoapBinding" name="HelloWorld">
<wsdlsoap:address location="http://127.0.0.1:8083/WebRoot/services/HelloWorld" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
...call.setOperationName(new QName( "","sayHello"));
看了你的endpoint,它应该是一个servlet-based endpoint,
你需要在服务器端的web.xml中,把它当作一个servlet来注册,比如
<servlet>
<servlet-name>HelloWorld_Endpoint</servlet-name>
<servlet-class><full_packagename>.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorld_Endpoint</servlet-name>
<url-pattern>service/HelloWorld_Test</url-pattern>
</servlet-mapping>
如果这样的话,你的服务URL是
String endpoint ="http://127.0.0.1:8083/WebRoot/service/HelloWorld_Test";
wsdl文件中的wsdlsoap:address location是个摆设而已。
你的servlet-based endpoint如何和wsdl中描述的服务关联呢?,用webservices.xml的<port-component-name>。
你的endpoint是一个servlet-based或ejb-based的组件,不是一个wsdl文件。
欢迎大家补充,指正。