[英]“Unrecognized message version” while calling SAP PI endpoint from .NET
[英]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 url的wsdl 端點。 要查找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.