[英]Getting an error while calling a soap service from .net core
I'm trying to call a SOAP service shared by our client (Not sure whether the soap service is a WCF or created by Java).我正在尝试调用我们的客户端共享的 SOAP 服务(不确定 soap 服务是 WCF 还是由 Java 创建的)。 I have added the service as a connected service using the Microsoft WCF Web Service Provider.
我已使用 Microsoft WCF Web 服务提供商将该服务添加为连接服务。 Basic authentication is implemented for the service.
为服务实施基本身份验证。 When I try to consume that service using the below mentioned code (c#), I'm getting an error.
当我尝试使用下面提到的代码 (c#) 使用该服务时,出现错误。
var results = new object();
string username = "abc";
string password = "xyz";
MyServiceReference.MyServiceStronglyTypedTypeClient soapClient = new MyServiceReference.MyServiceStronglyTypedTypeClient();
var httpBinding = soapClient.Endpoint.Binding as BasicHttpBinding;
httpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
soapClient.ClientCredentials.UserName.UserName = username;
soapClient.ClientCredentials.UserName.Password = password;
results = await soapClient.getTotalsByMemberIdAsync("001","ADM","");
Error message is as follows.错误信息如下。
Could not send Message.
Stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)
at System.ServiceModel.Channels.ServiceChannelProxy.TaskCreator.<>c__DisplayClass1_0.<CreateGenericTask>b__0(IAsyncResult asyncResult)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult(
I have been working on this for several hours now and any help will be highly appreciated.我已经为此工作了几个小时,我们将不胜感激任何帮助。
Lets say I add a WSDL service called 'webServ'假设我添加了一个名为“webServ”的 WSDL 服务
in the service exists a function called 'getTotalsByMemberIdAsync' which requires string username,string password, string variable1, string variable2, string variable3.在服务中存在一个名为“getTotalsByMemberIdAsync”的 function,它需要字符串用户名、字符串密码、字符串变量 1、字符串变量 2、字符串变量 3。
I would call it like so:我会这样称呼它:
webServ.WebServices ws = new webServ.WebServices();
string user = "foo";
string pass = "bar";
string XMLResults = ws.getTotalsByMemberIdAsync(user,pass,"001","ADM","");
Does this resolve your issue?这能解决您的问题吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.