当前位置:编程学习 > C#/ASP.NET >>

急啊!SOAP 如何替换为SOAPENV?

我用.net做的web service 返回响应的xml 中的soap root tag 都是 
<SOAP:Envelope> 但是对方要求的是SOAPENV:Envelope 请问该如何转换呢? 

第一  对要求的请求与回应是: soapenv:Envelope 

<?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns2:reqCustomInfo xmlns:ns2="GEForMsp"> <ns2:customerId>21020120000322 </ns2:customerId> </ns2:reqCustomInfo> </soapenv:Body> </soapenv:Envelope> 


<?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns1:reqCustomInfoResponse xmlns:ns1="GEForMsp"> <ns1:out> <ns2:address xmlns:ns2="http://WebServices.sttri.com"> </ns2:address> <ns2:adminAccount xmlns:ns2="http://WebServices.sttri.com">ydqqyys </ns2:adminAccount> <ns2:customerName xmlns:ns2="http://WebServices.sttri.com">........................ </ns2:customerName> <ns2:customerType xmlns:ns2="http://WebServices.sttri.com">1 </ns2:customerType> <ns2:email xmlns:ns2="http://WebServices.sttri.com"> </ns2:email> <ns2:fax xmlns:ns2="http://WebServices.sttri.com"> </ns2:fax> <ns2:phoneNumber xmlns:ns2="http://WebServices.sttri.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1" /> <ns2:resultCode xmlns:ns2="http://WebServices.sttri.com">1 </ns2:resultCode> <ns2:transactPerson xmlns: 
ns2="http://WebServices.sttri.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="1" /> <ns2:zipCode xmlns:ns2="http://WebServices.sttri.com"> </ns2:zipCode> </ns1:out> </ns1:reqCustomInfoResponse> 
</soapenv:Body> </soapenv:Envelope> 


第二  在II下测试时, .NET webservice 请求与回应时,虽然我在客户端调用时指定 namespace = soapenv, 但是回应的消息仍旧为soap:Envelope  ,与上述的  soapenv:Envelope  不同 

<?xml version="1.0" encoding="utf-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns2:reqCustomInfo xmlns:ns2="GEForMSP"> <ns2:customerId>210203201000001 </ns2:customerId> </ns2:reqCustomInfo> </soapenv:Body> </soapenv:Envelope> 

<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <reqCustomInfoResponse xmlns="GEForMSP"> <reqCustomInfoResult> <resultCode>0 </resultCode> </reqCustomInfoResult> </reqCustomInfoResponse> </soap:Body> </soap:Envelope> 

第三  最后导致当对方来请求我这个WebService时,提示 于HTTP Header SOAPAction不能被调用方识别,导致IIS 500错误。此问题应该如何解决? 

Server did not recognize the value of HTTP Header SOAPAction: . 

<?xml version='1.0' encoding='UTF-8'?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <ns2:reqCustomInfo xmlns:ns2="GEForMsp"> <ns2:customerId>210203123445 </ns2:customerId> </ns2:reqCustomInfo> </soapenv:Body> </soapenv:Envelope> 

<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <soap:Fault> <faultcode>soap:Client </faultcode> <faultstring>Server did not recognize the value of HTTP Header SOAPAction: . </faultstring> <detail /> </soap:Fault> </soap:Body> </soap:Envelope> 


--------------------编程问答-------------------- 昏头了.. --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 微软的是用:<soap:Envelope xmlns:soapenv="
Java下面一般是用:<soapenv:Envelope xmlns:soapenv="
能让那个调用的你Client下面进行调整吗?
补充:.NET技术 ,  Web Services
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,