Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf SOAP1.1或SOAP1.2_Wcf_Soap_Gsoap - Fatal编程技术网

Wcf SOAP1.1或SOAP1.2

Wcf SOAP1.1或SOAP1.2,wcf,soap,gsoap,Wcf,Soap,Gsoap,我有两条由gSOAP库生成的请求消息: 1 POST http://localhost:8998/Service1.svc/ HTTP/1.1 Host: localhost:8998 User-Agent: gSOAP/2.8 Content-Type: application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData" Content-Length: 536 Connection: close

我有两条由gSOAP库生成的请求消息:

1

POST http://localhost:8998/Service1.svc/ HTTP/1.1
Host: localhost:8998
User-Agent: gSOAP/2.8
Content-Type: application/soap+xml; charset=utf-8; action="http://tempuri.org/IService1/GetData"
Content-Length: 536
Connection: close
SOAPAction: "http://tempuri.org/IService1/GetData"

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns4="http://schemas.datacontract.org/2004/07/WcfService2" xmlns:ns3="http://schemas.microsoft.com/2003/10/Serialization/" xmlns:ns1="http://tempuri.org/"><SOAP-ENV:Body><ns1:GetData><ns1:value>55</ns1:value></ns1:GetData></SOAP-ENV:Body></SOAP-ENV:Envelope>

而且效果很好。为什么我需要更改名称空间以使其工作?为什么gSOAP工具不能生成正确的命名空间

WSDL:


声明SOAP 1.1使用此命名空间:

http://schemas.xmlsoap.org/soap/envelope/
http://www.w3.org/2003/05/soap-envelope
虽然SOAP 1.2使用此命名空间:

http://schemas.xmlsoap.org/soap/envelope/
http://www.w3.org/2003/05/soap-envelope

因此,您的第一条消息似乎来自SOAP1.2,而您的第二条消息似乎来自SOAP1.1。由于您的第一条消息失败,而第二条消息通过,因此您似乎正在使用符合SOAP 1.1的服务。

很多时候,当您看到时,您可以知道SOAP请求的版本是1.2

内容类型:应用程序/soap+xml;字符集=utf-8;action=“address”


SOAP1.1使用
内容类型:text/xml;charset=utf-8

我在混合“from”“to”时犯了错误。WSDL addedBut它是SOAP 1.1还是SOAP 1.2?哪个属性定义了SOAP版本?从我所知道的,版本隐含在为信封选择的名称空间中。可能的重复
http://schemas.xmlsoap.org/soap/envelope/
http://www.w3.org/2003/05/soap-envelope