我能否更改所有 SOAP 网络服务方法中的命名空间,无需编辑代码?
这一行...
<ConfirmIdentity xmlns="http://www.domain.com"> ?
这可能吗?
<?xml version="1.0" encoding="utf-8"?>
<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:Body>
<ConfirmIdentity xmlns="http://www.domain.com">
<ConfirmIdentityRequest>
<ApplicationCrediential>
<API_Username>string</API_Username>
<API_Password>string</API_Password>
</ApplicationCrediential>
<SessionId>string</SessionId>
</ConfirmIdentityRequest>
</ConfirmIdentity>
</soap:Body>
</soap:Envelope>
最佳答案
据我所知,您无法更改命名空间,它是在类和方法的上下文中设置的。即使你以某种方式将它从另一个包裹起来,它仍然会覆盖。您唯一的选择是代理消费者。
关于c# - SOAP Web 服务,在不编辑代码的情况下更改命名空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6190997/