SOAP 信封中的命名空间前缀导致解析错误:“服务器无法读取请求”

发布于 2024-12-27 15:37:05 字数 1541 浏览 0 评论 0原文

我有一个客户正在尝试在他们的 Java 环境中使用我们的 .Net WebService。他们使用“javax.xml.soap.*”,它需要命名空间前缀。这些相同的命名空间前缀会导致我们端出现解析异常。

SoapServerMessage.Exception:“服务器无法读取请求。”

我们正在使用“System.Web.Services.WebService”,

这是他们试图传递的请求:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header>
  <ct:CredentialsSoapHeader xmlns:ct="http://ourwebsite.com/webservices/"
                            xsi:type="WebServiceKeyCredentials">
    <Key>demoKey</Key>
    <Password>demoPassword</Password>
  </ct:CredentialsSoapHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
  <ct1:GetUserID xmlns:ct1="http://ourwebsite.com/webservices/">
      <EmailAddress>[email protected]</EmailAddress>
  </ct1:GetUserID>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

生成的响应:

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/xml; charset=utf-8
ETag: ""
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 17 Jan 2012 19:28:20 GMT
Content-Length: 0

一旦我去掉名称空间前缀,请求就可以正常工作。我对这个系统不是很熟悉,但我会尽力根据需要提供任何信息。

预先感谢您提供的任何帮助!

I have a client who is attempting to use our .Net WebService with their Java environment. They're using 'javax.xml.soap.*' which requires a namespace prefix. These same namespace prefixes cause parsing exceptions on our end.

SoapServerMessage.Exception : "Server was unable to read request."

We are using 'System.Web.Services.WebService'

Here is a request they are trying to pass through:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header>
  <ct:CredentialsSoapHeader xmlns:ct="http://ourwebsite.com/webservices/"
                            xsi:type="WebServiceKeyCredentials">
    <Key>demoKey</Key>
    <Password>demoPassword</Password>
  </ct:CredentialsSoapHeader>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
  <ct1:GetUserID xmlns:ct1="http://ourwebsite.com/webservices/">
      <EmailAddress>[email protected]</EmailAddress>
  </ct1:GetUserID>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

The generated response:

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/xml; charset=utf-8
ETag: ""
Server: Microsoft-IIS/7.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Tue, 17 Jan 2012 19:28:20 GMT
Content-Length: 0

As soon as I strip away the namespace prefix, the request works fine. I'm not very familiar with this system but I will try to provide any information as needed.

Thank you in advance for any help that can be provided!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文