我在让客户端与我的系统集成时遇到了问题。我想我已经缩小了问题的范围。客户机正在发送一条xml消息,而我的系统被设置为接受xml消息;然而,它期望它是某种格式的。客户表示希望我在我这一端设置格式以接受他们的格式。
这是客户端消息:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<NewOrder>
<Message id="d3a39c31-cc9f-4331-ad13-be74522df6eb">
<Header>
<LoginAccountIdentifier>Blank</LoginAccountIdentifier>
<LoginAccountPassword>password</LoginAccountPassword>
</Header>我注意到我期望的格式是节点上的前缀tem:除外。
这是预期的消息:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:NewOrder>
<tem:Message id="d3a39c31-cc9f-4331-ad13-be74522df6eb ">
<Header>
<LoginAccountIdentifier>Blank</LoginAccountIdentifier>
<LoginAccountPassword>password</LoginAccountPassword>
</Header>我相信,如果我可以去掉前缀,那么这应该会使客户端的消息与预期的消息相匹配。问题是在哪里删除前缀"< tem:";此外,如何防止变量xmlns:tem="http://tempuri.org/“出现在我的文档中?
发布于 2012-05-19 03:00:17
我非常确定这是来自在类定义顶部具有[WebService(Namespace = "http://tempuri.org/")]属性的WebService.svc (或.asmx)类。删除它(或将其设置为适当的值)应该可以解决这个问题。
https://stackoverflow.com/questions/10658267
复制相似问题