简体   繁体   English

在WCF Web服务中调用SAP ME Web服务

[英]Calling a SAP ME web Service in wcf web service

I have a soap web service (sap me web service), I generated the wcf proxy. 我有一个肥皂网络服务(sap me网络服务),我生成了wcf代理。 no problem, I developed a WinForms application no problem Now i try to use it in my wcf service (webHttpBinding binding in domain network) but i have an authentication error: WCF - The HTTP request is unauthorized with client authentication scheme 'Basic'. 没问题,我开发了WinForms应用程序,没问题现在,我尝试在wcf服务(域网络中的webHttpBinding绑定)中使用它,但出现身份验证错误:WCF-HTTP请求未经客户端身份验证方案“基本”授权。 The authentication header received from the server was 'Basic realm="mySoapServiceName" It is IIS User problem ? 从服务器收到的身份验证标头是“ Basic realm =“ mySoapServiceName”。这是IIS用户问题吗?

Thanks 谢谢

SAP is using basic auth. SAP正在使用基本身份验证。 You need to specify the username and password after you have created the proxy, for example: 创建代理后,需要指定用户名和密码,例如:

proxy.Credentials.UserName.UserName = "joe";
proxy.Credentials.UserName.Password = "doe";
BasicHttpBinding myBinding = new BasicHttpBinding();

myBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;

myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
EndpointAddress ea = new EndpointAddress("url de mon web service soap");

SfcServices.SFCProcessingInClient myClient = new SfcServices.SFCProcessingInClient(myBinding, ea);

myClient.ClientCredentials.UserName.UserName = _MESwsLogin;
myClient.ClientCredentials.UserName.Password = _MESwsPassword;

SfcServices.SFCStateRequestMessage_sync srm = new SfcServices.SFCStateRequestMessage_sync();
SfcServices.SFCStateRequest sr = new SfcServices.SFCStateRequest();
srm.SfcStateRequest = sr;
sr.SiteRef = new SfcServices.SiteRef();
sr.SiteRef.Site = _MESsite;
sr.SfcRef = new SfcServices.SFCRef();
sr.SfcRef.Sfc = "12345678903";

sr.includeSFCStepList = true;

SfcServices.SFCStateConfirmationMessage_sync response = myClient.FindStateByBasicData(srm);
strOrdreFab = response.SfcStateResponse.SFCStatus.Sfc.ShopOrderRef.ShopOrder;
strCodeProduit = response.SfcStateResponse.SFCStatus.Sfc.ItemRef.Item;
strIndice = response.SfcStateResponse.SFCStatus.Sfc.ItemRef.Revision;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM