0
我正在使用WCF连接到Apache Web服务。请求失败,因为服务器无法解析标题信息。我已经和服务提供者谈过了,他们已经指出名字空间的范围是错误的。它们应该放在信封上而不是身体上。如何在.NET中更改此项?在XML请求上更改WCF名称空间
我的要求:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<wsCaller>
<appVersion></appVersion>
</wsCaller>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<addSvcRecord xmlns="http://ws.dsr.careur.com">
<svcRecord xmlns="">
<vin>JMZCR19F200100059</vin>
<number>10</number>
<date>2012-02-22</date>
<mileage>38500</mileage>
<mileageType>KILOMETERS</mileageType>
<invokeErrorPage>false</invokeErrorPage>
</svcRecord>
</addSvcRecord>
</s:Body>
</s:Envelope>
应该看起来更像:
<?xml version="1.0" encoding="UTF-8" ?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.dsr.careur.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ws="http://ws.dsr.careur.com" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<ws:wsCaller>
<appVersion></appVersion>
</ws:wsCaller>
</SOAP-ENV:Header>
<ns0:Body>
<ns1:getSvcRecords>
<vin>JMZDE14K280138989</vin>
</ns1:getSvcRecords>
</ns0:Body>
</SOAP-ENV:Envelope>
你是如何定义头文件的? – 2012-02-23 11:21:40
在我的web.config我已经把它添加到端点: <端点地址= “https://mappsacc.careur.com/dsr-services/dsrWebService” 绑定= “basicHttpBinding的” bindingConfiguration = “DsrWebServiceSoapBinding” 合同= “CarDSR.DsrWebService” NAME = “DsrWebServicePort”> 0.1 –
Zymotik
2012-02-23 11:48:23