微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使C#Web服务生成soapenv命名空间而不是soap?

有没有办法制作一个C#/ .NET网络服务,通常会像这样生成XML

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
 <DHeader xmlns="http://www.abc.com" />
</soap:Header>
  <soap:Body>
    <Response xmlns="http://www.abc.com">
      <Result>
        <ErrorObject ObjectID="string" ErrorCode=""  />          
      </Result>
     </Response>
   </soap:Body>
</soap:Envelope>

像这样生成XML.

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapv:Header>
    <DHeader xmlns="http://www.abc.com" />
  </soapenv:Header>
  <soapenv:Body>
    <Response xmlns="http://www.abc.com">
      <Result>
        <ErrorObject ObjectID="string" ErrorCode=""  />          
      </Result>
    </Response>
  </soapenv:Body>
</soapenv:Envelope>

这尝试解决使用.NET Web服务的AXIS客户端的问题. AXIS正在阻塞soap命名空间,需要一个soapenv命名空间.无法更改AXIS侧.

任何想法或评论都会很棒.

这是所要求的确切错误.

line -1: Element Envelope@http://www.w3.org/2003/05/soap-envelope is not a valid Envelope@http://schemas.xmlsoap.org/soap/envelope/ document or a valid substitution. 

解决方法:

soapenv不是名称空间 – 它是名称空间前缀.

只要前缀引用相同的命名空间,soap和soapenv引用相同的东西,并具有相同的含义.

似乎极不可能任何版本的AXIS被严重破坏以至于特别处理前缀.你应该假设你有一个不同的问题.请发布您收到的确切错误.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。