【发布时间】:2014-12-19 13:18:20
【问题描述】:
我正在尝试在 VS Pro 2012 (VB.NET) 中构建一个应用程序,该应用程序将调用 RoyalMail 的 MailMark WSDL,该应用程序具有诸如 RetrieveActiveSupplyChains 之类的方法,这些方法需要单个参数(请求)。
我已经使用 svcutil 和 /l:vb 开关来下载 WSDL 并在我的项目中引用它,一旦完成,我就可以看到公开的方法
Dim client As PosterUploadClient = New PosterUploadClient()
现在输入客户端。调出我希望看到的所有方法,当我执行 client.open() 时,我可以通过身份验证并查看状态变化,但我不知道如何提供实际方法所需的参数。根据他们的文档,RetrieveActiveSupplyChains 不需要参数,但他们提供了请求结构的 xml 示例,所以我的假设是我需要将其构造为具有适当值的 xml 并将其作为“请求”发送?
这听起来对吗?我知道这对于网络程序员来说可能是肉和蔬菜,但我以前没有尝试过。他们作为示例提供的 xml 如下所示:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1">http://rm-manifest.com/2014/01/service/IPosterUpload/RetrieveAllActiveSupplyChains</a:Action>
<a:MessageID>urn:uuid:ab5e32a3-812e-4d91-97a8-de00a08874e9</a:MessageID>
<a:ReplyTo>
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<a:To s:mustUnderstand="1">https://rm-manifest.com/PosterUpload2/PosterUpload.svc/service</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="_0">
<u:Created>2014-10-03T14:32:58.480Z</u:Created>
<u:Expires>2014-10-03T14:37:58.480Z</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-dfaaf0b0-3823-4f75-b607-33f7434295dc-1">
<o:Username>NetworkAccess</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">p1</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<RetrieveAllActiveSupplyChains xmlns="http://rm-manifest.com/2014/01/service">
<request xmlns:b="http://rm-manifest.com/2014/01/messages" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"/>
</RetrieveAllActiveSupplyChains>
</s:Body>
</s:Envelope>
但我仍然不确定它实际上需要如何提交,当然如果我使用新的 xmltextreader 阅读该示例,它不喜欢它并显示以下错误消息
Value of type 'System.Xml.XmlTextReader' cannot be converted to 'MM_TEST.Mosaic.EIB.PosterUploadService.Core.Messages.RetrieveActiveSupplyChainsRequest'
我的假设是 WSDL 取代了在我的代码中实际创建“新 HttpRequest”的需要,但不确定。我已经做了很多谷歌搜索,但没有得到任何像这样工作的东西
如果这有帮助,WSDL 就在这里: https://customertest.rm-manifest.com/PosterUpload/PosterUpload.svc
【问题讨论】:
标签: asp.net xml vb.net wsdl webmethod