c# 调用axis的webservice的问题

thinkmore 2004-11-30 12:17:42
下面的是一个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还不是很熟,希望大家能给一些意见,不胜感激!
...全文
542 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
yizhixiaozhu 2005-02-12
  • 打赏
  • 举报
回复
jf up
AllenTing 2005-02-11
  • 打赏
  • 举报
回复
up
老鹰40 2005-02-11
  • 打赏
  • 举报
回复
有点长,建立一你把问题简化一下,也许有人能帮你解答。
帮你顶!
AllenTing 2005-02-11
  • 打赏
  • 举报
回复
up
hedonister 2005-02-11
  • 打赏
  • 举报
回复
up
噯卟釋手 2005-02-07
  • 打赏
  • 举报
回复
up
haoco 2005-02-03
  • 打赏
  • 举报
回复
up
thinkmore 2004-12-03
  • 打赏
  • 举报
回复
没人回答,只好自己再顶了
haoztao 2004-12-01
  • 打赏
  • 举报
回复
有点长啊!自习研究一下把!
thinkmore 2004-12-01
  • 打赏
  • 举报
回复
谢谢两位啊,我也一直在试,也希望有人提供一下思路。自己再顶!
wangxt 2004-11-30
  • 打赏
  • 举报
回复
帮你顶

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧