WCF SOAP响应命名空间问题

时间:2015-02-05 10:39:25

标签: wcf soap xml-namespaces

WCF返回空对象,虽然我可以从fiddler跟踪中看到正在返回数据。我确定它是命名空间问题,但在阅读完所有文档后我看不出有什么问题!请求和响应SOAP如下:

请求:

POST https://x.x.x.x:9001/soap/ HTTP/1.1
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.34209)
VsDebuggerCausalityData: uIDPo0Xy/aB8aeVEhMD2Z4yiT1MAAAAAKokUeOFUmEaRRFeDK7Ihn37dui0ez7tEhWItLBqEHq0ACQAA
Content-Type: text/xml; charset=utf-8
SOAPAction: "get_wsdl_version"
Host: x.x.x.x:9001
Content-Length: 236
Expect: 100-continue
Connection: Keep-Alive

<?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:Envelope>

响应:

HTTP/1.1 200 OK
Date: Thu, 05 Feb 2015 10:10:18 GMT
Server: Apache
Vary: Accept-Encoding,User-Agent
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/xml

<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
        <get_wsdl_versionResponse>
            <get_wsdl_versionResult xsi:type="xs:int">2002</get_wsdl_versionResult>
        </get_wsdl_versionResponse>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

编辑:添加(非常简单)客户端代码

Dim TestClient = New ServiceReference1.TableLampServiceClient

Dim Creds = New ServiceReference1.AuthInfo()
Creds.username = "xxx"
Creds.password = "yyy"

Dim TestVersion = TestClient.get_wsdl_version()

编辑:添加WDSL代码段 - 从VS

中提取
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:tns="cust_service.TableLampService"    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:typens="cust_service.TableLampService" name="TableLampService" targetNamespace="cust_service.TableLampService" xmlns="http://schemas.xmlsoap.org/wsdl/">
  <plnk:partnerLinkType name="TableLampService">
    <plnk:role name="TableLampService">
      <plnk:portType name="tns:TableLampService" />
    </plnk:role>
  </plnk:partnerLinkType>
  <types>
    <xs:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="cust_service.TableLampService">
      <xs:element name="get_wsdl_versionResponse" type="typens:get_wsdl_versionResponse" />
      <xs:complexType name="get_wsdl_versionResponse">
        <xs:sequence>
          <xs:element name="get_wsdl_versionResult" type="xs:int" />
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
  </types>
  <message name="get_wsdl_version" />
  <message name="get_wsdl_versionResponse">
    <part name="get_wsdl_versionResponse" element="typens:get_wsdl_versionResponse" />
  </message>
  <portType name="TableLampService">
    <operation name="get_wsdl_version" parameterOrder="get_wsdl_version">
      <documentation>
        get_wsdl_version() -&gt; int

        Return the SOAP server's WSDL version.  This is used to check
        client/server compatibility.

        Parameters: None

        Exceptions: None
        </documentation>
      <input name="get_wsdl_version" message="typens:get_wsdl_version" />
      <output name="get_wsdl_versionResponse" message="typens:get_wsdl_versionResponse" />
    </operation>
  </portType>
  <binding name="TableLampService" type="typens:TableLampService">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <operation name="get_wsdl_version">
      <soap:operation soapAction="get_wsdl_version" style="document" />
      <input name="get_wsdl_version">
        <soap:body use="literal" />
      </input>
      <output name="get_wsdl_versionResponse">
        <soap:body use="literal" />
      </output>
    </operation>
   </binding>
</definitions>

值得一提的是,我无法控制服务器端。我只需要在我的代码中使用该服务,但我可以。

提前致谢!

0 个答案:

没有答案