簡體   English   中英

當我嘗試從 .NET 中的 SAP 訪問數據時,我收到錯誤消息“無法識別的消息版本”。

[英]When I try to access data from SAP in .NET I get an error 'Unrecognized message version.'

我正在嘗試從 .NET 訪問 sap soap API,但收到錯誤“無法識別的消息版本”。 我的代碼

String endpointurl = "http://link/wsdl/flv_10002A111AD1/bndg_url/sap/bc/srt/rfc/sap/zhr_emp_leave_balance_chk/410/zhr_emp_leave_balance_chk/zhr_emp_leave_balance_chk?sap-client=410";
BasicHttpBinding binding = new BasicHttpBinding();
//If you need HTTP with Basic Auth for internal network or dev environments. Otherwise remove these two lines:
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

EndpointAddress endpoint = new EndpointAddress(endpointurl);
ZHR_EMP_LEAVE_BALANCE_CHKClient wsclient = new ServiceReference1.ZHR_EMP_LEAVE_BALANCE_CHKClient(binding, endpoint);

wsclient.ClientCredentials.UserName.UserName = "user";
wsclient.ClientCredentials.UserName.Password = "password";

//Here you can use client
ServiceReference1.ZhrGetEmployeeLeaveWs re = new ZhrGetEmployeeLeaveWs();
re.IvPernr = "id";

var request = new ServiceReference1.ZhrGetEmployeeLeaveWsRequest(re);

var response = await wsclient.ZhrGetEmployeeLeaveWsAsync(re);
r = response.ZhrGetEmployeeLeaveWsResponse.EsDtls.LeaveBalance.ToString();

看起來您使用的是wsdl 鏈接而不是wsdl 端點 我在使用SAP wsdl文件時遇到了同樣的問題。 . 就我而言,我注意到我使用的是wsdl url而不是wsdl 端點

我的wsdl url就像:http: //192.168.0.11 :8088/sap/bc/srt/wsdl/bndg_WBTSRN34RT681000000C0A8010A/wsdl11/allinone/ws_policy/document?sap-client=200

我所需要的只是使用wsdl urlwsdl 端點 要查找wsdl 端點,請打開wsdl 文件並檢查wsdl:service標記下的address location

  <wsdl:service name="ZWS_FILEService">
    <wsdl:port name="ZWS_FILE" binding="tns:ZWS_FILE">
      <soap:address location="http://192.168.0.11:8088/sap/bc/srt/rfc/sap/zws_file/200/zws_file/zws_file"/>
    </wsdl:port>
  </wsdl:service>

暫無
暫無

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

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