c# 调用axis的webservice的问题
下面的是一个wsdl:
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://localhost:8080/services/Login" xmlns:impl="http://localhost:8080/services/Login" xmlns:intf="http://localhost:8080/services/Login" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns2="http://services.serviceadapter.soapcomponents.corazio.org" xmlns:tns1="http://www.w3.org/1999/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <!--
WSDL created by Apache Axis version: 1.2alpha
Built on Dec 01, 2003 (04:33:24 EST)
-->
- <wsdl:types>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://services.serviceadapter.soapcomponents.corazio.org">
<element name="login" type="xsd:anyType" />
</schema>
- <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost:8080/services/Login">
<element name="loginReturn" type="xsd:anyType" />
</schema>
</wsdl:types>
- <wsdl:message name="loginResponse">
<wsdl:part name="loginReturn" element="impl:loginReturn" />
</wsdl:message>
- <wsdl:message name="loginRequest">
<wsdl:part name="part" element="tns2:login" />
</wsdl:message>
- <wsdl:portType name="Login">
- <wsdl:operation name="login">
<wsdl:input name="loginRequest" message="impl:loginRequest" />
<wsdl:output name="loginResponse" message="impl:loginResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="LoginSoapBinding" type="impl:Login">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="login">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="loginRequest">
<wsdlsoap:body use="literal" namespace="http://services.serviceadapter.soapcomponents.corazio.org" />
</wsdl:input>
- <wsdl:output name="loginResponse">
<wsdlsoap:body use="literal" namespace="http://localhost:8080/services/Login" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="LoginService">
- <wsdl:port name="Login" binding="impl:LoginSoapBinding">
<wsdlsoap:address location="http://localhost:8080/services/Login" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
用java调用这个webservice时是这样调用的:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
String endpoint =
"http://localhost:8080/services/Login";
Service service = new Service();
Call call = (Call) service.createCall();
call.setMaintainSession(true);
//Login
call.setTargetEndpointAddress(new java.net.URL(endpoint));
SOAPBodyElement[] login_in = new SOAPBodyElement[1];
Element login =
doc.createElementNS("http://localhost:8080", "Login");
Element cred = doc.createElement("UserCredentials");
Element lname = doc.createElement("loginName");
lname.appendChild(doc.createTextNode("test1"));
Element pass = doc.createElement("password");
pass.appendChild(doc.createTextNode("test1"));
cred.appendChild(lname);
cred.appendChild(pass);
login.appendChild(cred);
System.out.println(XMLUtils.ElementToString(login));
login_in[0] = new SOAPBodyElement(login);
Vector sessVector = (Vector) call.invoke(login_in);
在.net当中,我新建了一个webservice的引用Login,指向http://localhost:8080/services/Login?wsdl,我用c#调用新建了这个webservice:
LoginService cc=new LoginService();
但是调用login方法时,login的参数该如何初始化,我对.net还不是很熟,希望大家能给一些意见,不胜感激!