发送SOAP请求给WSDL, 超级难题!!!高手请进。

ThankU 2010-01-20 01:38:54
WSDL运行良好,定义如下:

<?xml version="1.0" ?>
- <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://schemas.ABCD.com/default" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:inst="http://schemas.ABCD.com/APM/instance/1.0" name="3rdParties" targetNamespace="http://schemas.ABCD.com/default">
- <wsdl:types>
- <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns1="http://schemas.ABCD.com/default" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.ABCD.com/default">
<xsd:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="TheReference" type="xs:string" />
- <xsd:element name="GetHandlingResponse">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="data">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="instance_id" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Location" type="xs:string" />
<xsd:element xmlns:xs="http://www.w3.org/2001/XMLSchema" name="Reserve" type="xs:string" />
- <xsd:element name="GetHandling">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element ref="tns1:TheReference" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://schemas.ABCD.com/APM/instance/1.0">
- <xsd:element name="APM">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="instance_id" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
- <wsdl:message name="GetHandlingInput">
<wsdl:part name="body" element="tns:GetHandling" />
</wsdl:message>
- <wsdl:message name="GetHandlingOutput">
<wsdl:part name="body" element="tns:GetHandlingResponse" />
</wsdl:message>
- <wsdl:message name="HeaderOutput">
<wsdl:part name="MyHeader" element="inst:APM" />
</wsdl:message>
- <wsdl:portType name="GetMessages">
- <wsdl:operation name="GetHandling">
<wsdl:input message="tns:GetHandlingInput" />
<wsdl:output message="tns:GetHandlingOutput" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="GetMessages" type="tns:GetMessages">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="GetHandling">
<soap:operation soapAction="" style="document" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
<soap:header message="tns:HeaderOutput" part="MyHeader" use="literal" />
<soap:header message="tns:HeaderOutput" part="MyHeader" use="literal" />
<soap:header message="tns:HeaderOutput" part="MyHeader" use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="GetMessagesService">
- <wsdl:port name="GetMessagesPort" binding="tns:GetMessages">
<soap:address location="https://my.ABCD.com/ABCD" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>


现在我想给上面的WSDL发送一个SOAP请求,然后得到结果。

发送请求的XML:
<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<GetHandling xmlns="http://schemas.ABCD.com/default">
<TheReference>123456</TheReference>
</GetHandling>
</SOAP:Body>
</SOAP:Envelope>

我想得到的结果(返回的XML)是:
<data>
<GetHandlingResponse xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://schemas.ABCD.com/default">
<data xmlns="http://schemas.ABCD.com/APM/execution/1.0">
<instance_id>112233445566</instance_id>
</data>
</GetHandlingResponse>
</data>

请问用c#怎样写啊?
...全文
287 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
ThankU 2010-01-23
  • 打赏
  • 举报
回复
顶!
much0726 2010-01-20
  • 打赏
  • 举报
回复
.net 封装了WS的请求和发送包格式,如果需要修改格式要对发送类进行重写。
http://blog.csdn.net/much0726/archive/2008/09/17/2943364.aspx
我之前研究的内容,主要要实现重写ClientOutputFilter : SoapFilter 这个类。
khjian 2010-01-20
  • 打赏
  • 举报
回复
jf
zhangxuyu1118 2010-01-20
  • 打赏
  • 举报
回复
mark
cxinh 2010-01-20
  • 打赏
  • 举报
回复
不懂。。
帮顶!!
江南小鱼 2010-01-20
  • 打赏
  • 举报
回复
关注~~~
帮顶..
langziqian 2010-01-20
  • 打赏
  • 举报
回复
mark
bychgh 2010-01-20
  • 打赏
  • 举报
回复
wangchunlin880210 2010-01-20
  • 打赏
  • 举报
回复
顶起
liaoyukun111 2010-01-20
  • 打赏
  • 举报
回复
d
netstray 2010-01-20
  • 打赏
  • 举报
回复
学习
beijingbeerman 2010-01-20
  • 打赏
  • 举报
回复
http://book.csdn.net/bookfiles/1062/100106231828.shtml
beijingbeerman 2010-01-20
  • 打赏
  • 举报
回复
http://topic.csdn.net/t/20060508/13/4735905.html
beijingbeerman 2010-01-20
  • 打赏
  • 举报
回复
web service 是什么语言写得?
ThankU 2010-01-20
  • 打赏
  • 举报
回复
我的问题是:返回的XML就是这个WSDL文件本身!!!我的请求语段是:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<GetHandling xmlns="http://schemas.ABCD.com/default">
<TheReference>123456 </TheReference>
</GetHandling>
</SOAP:Body>
</SOAP:Envelope>
ThankU 2010-01-20
  • 打赏
  • 举报
回复
这个是标准的xml soap,用.net怎样访问阿?

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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