【问题标题】:SOAP request namespace questionSOAP 请求命名空间问题
【发布时间】:2011-03-23 10:13:55
【问题描述】:

我需要澄清一下 SOAP 请求对 .Net 3.5 ASMX Web 服务的确切要求。这是一个示例请求:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dp="http://www.datapower.com/schemas/management">
<soapenv:Body>
 <spml:addRequest requestID="string" executionMode="synchronous" xmlns:spml="spmlnamespace">
  <spml:psoID ID="23099469" targetID="string" />
  <spml:data>
       <spml:attr name='groupId'>
        <spml:value>111111</spml:value>
       </spml:attr>
       <spml:attr name='mdn'>
        <spml:value>5555555555</spml:value>
       </spml:attr>
       <spml:attr name='serviceId'>
        <spml:value>SDCAT1</spml:value>
       </spml:attr>
     </spml:data>
 </spml:addRequest>
</soapenv:Body>
</soapenv:Envelope>

这是否意味着我的 asmx Web 服务方法应该命名为“addRequest”?这是否也意味着这个方法应该接受两个参数,第一个是“psoID”类型的,第二个是 spml 命名空间中定义的“data”类型的?

【问题讨论】:

  • 您是否要对 WSDL 进行逆向工程?
  • 是的,基本上。有一个提供给我的 WSDL,但我无法使用 wsdl.exe 生成代理类,因为如果复杂类型包含一系列复杂类型,工具中的一个错误会导致它失败。
  • 您确定这是 WSDL.exe 中的错误而不是废话 WSDL,您会遇到什么错误?或许您最好发布 wsdl.exe 遇到的 wsdl 部分,也许我们可以找出问题所在。
  • 您在什么平台上编写您的客户端。.NET?
  • 我已编辑问题以包含 wsdl 和导入的 xsd 文件。我不相信 wsdl 和 xsd 文件中有错误,但我是新手。

标签: c# soap wsdl namespaces asmx


【解决方案1】:

事实证明,我能够使用 wsdl.exe 工具生成代理类,方法是:1)用“include”语句替换“import”语句,2)将第一个和第二个 xsd 文件合并到一个文件/命名空间中.谢谢大家的意见。

【讨论】:

  • 您也应该尝试不编辑文件,而是在命令行中传递所有文件路径:wsdl.exe main.wsdl sub.wsdl main.xsd sub.xsd
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-06-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多