我正在与供应商的ASP.NET WebService集成 . 我们运行的架构不允许轻松使用SOAP资源 . 但是,我们的供应商支持HTTP POST和HTTP GET(使用application / x-www-form-encoded - 查询字符串) . 我们遇到的问题是身份验证 .

有问题的WebService需要一个SoapHeader,其中包含一个包含用户名和密码节点的ClientCredentials节点 . 我们假设他们正在使用Soap身份验证 . 如何在不诉诸SOAP的情况下使用此WebService?

SOAP请求的一个示例(根据其WSDL):

POST /webservices/service1.asmx HTTP/1.1
Host: localhost
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?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:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="https://localhost" xmlns:types="https://localhost/encodedTypes" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header>
    <types:ClientCredentials>
      <username xsi:type="xsd:string">string</username>
      <password xsi:type="xsd:string">string</password>
    </types:ClientCredentials>
  </soap:Header>
  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <tns:Method>
      <parameter xsi:type="xsd:string">string</parameter>
    </tns:Method>
  </soap:Body>
</soap:Envelope>

同样,.ASMX描述了使用HTTP GET或HTTP POST的可用性,如下所示:

POST /webservices/service1.asmx/Method HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

parameter=string

注意,上面没有描述任何认证信息 .

我们尝试过以下内容:

username=user&password=pass&parameter=string

ClientCredentials=<username>user</username><password>pass</password>&parameter=string

以及不同风格的HTTP身份验证 . 似乎没有什么工作,我们所获得的支持没有任何用处 - 他们实际上无法告诉我们他们的网络服务是如何运作的 .

有没有人有这方面的经验?