簡體   English   中英

如何使用ASPX中的SAP服務參考

[英]How to consume SAP Service Reference from ASPX

我是此類項目的最新成員,我需要一些幫助。 我有一個ASPX應用程序,必須在SOAP上使用SAP Services。 第三伙伴向我提供wsdl文件以附加服務。 好的,當我添加基於WSDL的服務引用時,在我的web.config中添加了下一個文件:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="ZWSDISLINEPEDIDOS" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://SomeURL" binding="basicHttpBinding"            bindingConfiguration="ZWSDISLINEPEDIDOS"
        contract="WS_SAP_PEDIDOS.ZWSDISLINEPEDIDOS" name="ZWSDISLINEPEDIDOS" />

    </client>
  </system.serviceModel>

我的.cs具有下面的代碼:

     BasicHttpBinding _Binding = new BasicHttpBinding();
            EndpointAddress address = new EndpointAddress("http://SomeURL");

            ZWSDISLINEPEDIDOSClient _Client = new ZWSDISLINEPEDIDOSClient(_Binding, address);
            _Client.ClientCredentials.UserName.UserName = "MyUserName";
            _Client.ClientCredentials.UserName.Password = "MyPassword";

When we try to call a method from the client the next error fires:

“請求的HTTP自動創建客戶端'匿名'的請求。El encabezadoautenticación接收服務器時代'基本領域=“ SAP NetWeaver應用服務器[LP1 / 100]””

任何想法?

您嘗試調用的Web服務似乎不允許匿名身份驗證。 相反,Web服務僅啟用了基本身份驗證。

要了解WCF身份驗證的工作原理,您可以閱讀一篇非常好的兩部分文章: 第1 部分第2部分

此外您可以在此處找到完整的示例(服務器端和客戶端)。

我無法重現您的情況,但似乎:

  1. 您應該使用WSHttpBinding而不是BasicHttpBinding
  2. 在您的代碼中,您沒有設置綁定的ClientCredentialType屬性(即_Binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic

希望我的提示能幫助您解決問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM