java端的webservice 是用axis1.4 和tomcat5.5 做的
下面是wsdl文件
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/services/CompletObject" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/CompletObject" xmlns:intf="http://localhost:8080/axis/services/CompletObject" 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:types>
<schema targetNamespace="http://localhost:8080/axis/services/CompletObject" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="UserInfo">
<sequence>
<element name="age" type="xsd:int" />
<element name="birthDay" nillable="true" type="xsd:date" />
<element name="name" nillable="true" type="soapenc:string" />
<element name="password" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getUserInfoRequest" />
<wsdl:message name="getUserInfoAllInfoRequest">
<wsdl:part name="info" type="impl:UserInfo" />
</wsdl:message>
<wsdl:message name="getUserInfoResponse">
<wsdl:part name="getUserInfoReturn" type="impl:UserInfo" />
</wsdl:message>
<wsdl:message name="getUserInfoAllInfoResponse">
<wsdl:part name="getUserInfoAllInfoReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:portType name="CompletObject">
<wsdl:operation name="getUserInfoAllInfo" parameterOrder="info">
<wsdl:input message="impl:getUserInfoAllInfoRequest" name="getUserInfoAllInfoRequest" />
<wsdl:output message="impl:getUserInfoAllInfoResponse" name="getUserInfoAllInfoResponse" />
</wsdl:operation>
<wsdl:operation name="getUserInfo">
<wsdl:input message="impl:getUserInfoRequest" name="getUserInfoRequest" />
<wsdl:output message="impl:getUserInfoResponse" name="getUserInfoResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CompletObjectSoapBinding" type="impl:CompletObject">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getUserInfoAllInfo">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="getUserInfoAllInfoRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://test" use="encoded" />
</wsdl:input>
<wsdl:output name="getUserInfoAllInfoResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/CompletObject" use="encoded" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getUserInfo">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="getUserInfoRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://test" use="encoded" />
</wsdl:input>
<wsdl:output name="getUserInfoResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/CompletObject" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CompletObjectService">
<wsdl:port binding="impl:CompletObjectSoapBinding" name="CompletObject">
<wsdlsoap:address location="http://192.168.1.100:8080/axis/services/CompletObject" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>现在问题是:
1、我在java中调用是可以的,能够正确返回我定义的UserInfo对象
2、我在vs 2005中添加web引用也能添加进来,但是添加进来后
客户端代码:
CompletObjectService cos = new CompletObjectService();
在这里就报错,异常信息
未处理 InvalidOperationException
无法反射方法 CompletObjectService.getUserInfoAllInfo。
下面是wsdl文件
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://localhost:8080/axis/services/CompletObject" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://localhost:8080/axis/services/CompletObject" xmlns:intf="http://localhost:8080/axis/services/CompletObject" 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:types>
<schema targetNamespace="http://localhost:8080/axis/services/CompletObject" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="UserInfo">
<sequence>
<element name="age" type="xsd:int" />
<element name="birthDay" nillable="true" type="xsd:date" />
<element name="name" nillable="true" type="soapenc:string" />
<element name="password" nillable="true" type="soapenc:string" />
</sequence>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getUserInfoRequest" />
<wsdl:message name="getUserInfoAllInfoRequest">
<wsdl:part name="info" type="impl:UserInfo" />
</wsdl:message>
<wsdl:message name="getUserInfoResponse">
<wsdl:part name="getUserInfoReturn" type="impl:UserInfo" />
</wsdl:message>
<wsdl:message name="getUserInfoAllInfoResponse">
<wsdl:part name="getUserInfoAllInfoReturn" type="soapenc:string" />
</wsdl:message>
<wsdl:portType name="CompletObject">
<wsdl:operation name="getUserInfoAllInfo" parameterOrder="info">
<wsdl:input message="impl:getUserInfoAllInfoRequest" name="getUserInfoAllInfoRequest" />
<wsdl:output message="impl:getUserInfoAllInfoResponse" name="getUserInfoAllInfoResponse" />
</wsdl:operation>
<wsdl:operation name="getUserInfo">
<wsdl:input message="impl:getUserInfoRequest" name="getUserInfoRequest" />
<wsdl:output message="impl:getUserInfoResponse" name="getUserInfoResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CompletObjectSoapBinding" type="impl:CompletObject">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="getUserInfoAllInfo">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="getUserInfoAllInfoRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://test" use="encoded" />
</wsdl:input>
<wsdl:output name="getUserInfoAllInfoResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/CompletObject" use="encoded" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getUserInfo">
<wsdlsoap:operation soapAction="" />
<wsdl:input name="getUserInfoRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://test" use="encoded" />
</wsdl:input>
<wsdl:output name="getUserInfoResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://localhost:8080/axis/services/CompletObject" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="CompletObjectService">
<wsdl:port binding="impl:CompletObjectSoapBinding" name="CompletObject">
<wsdlsoap:address location="http://192.168.1.100:8080/axis/services/CompletObject" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>现在问题是:
1、我在java中调用是可以的,能够正确返回我定义的UserInfo对象
2、我在vs 2005中添加web引用也能添加进来,但是添加进来后
客户端代码:
CompletObjectService cos = new CompletObjectService();
在这里就报错,异常信息
未处理 InvalidOperationException
无法反射方法 CompletObjectService.getUserInfoAllInfo。
--输入网址就好了.
会自动生成代理类的.
你要引入命名空间,使用代理类...
在“Web引用名”文本框中输入“MyTestSpace”
MyTestSpace.CompletObjectService service= new MyTestSpace.CompletObjectService();
http://www.cnblogs.com/huashanlin/archive/2008/06/30/1232315.html