简体   繁体   English

从 .net 核心调用 soap 服务时出错

[英]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.

相关问题 在 .net Core 中调用 SOAP 服务 - Calling a SOAP service in .net Core 从 .Net Core 2.0 调用 SOAP api 时出错 - Error calling a SOAP api from .Net Core 2.0 从 .NET Core 调用 VISA API 时出错 - Error while calling VISA API from .NET Core 从 .NET Core 切换到 .NET Framework 时出错 - Getting an error while switching from .NET Core to .NET Framework 将 Redis 与 ASP.Net 核心 6 集成时出错:从 Lua 脚本调用 Redis 命令的参数数量错误 - Getting error while integrating Redis with ASP.Net core 6: Wrong number of args calling Redis command From Lua script 从另一个 locahost.Net Core API 调用 locahost.Net Core API 时出现错误网关(502)错误 - Bad Gateway (502) error while calling locahost .Net Core API from another locahost .Net Core API Cors Error 'Access Control Allow Origin' while calling .net core web api from .net core mvc - Cors Error 'Access Control Allow Origin' while calling .net core web api from .net core mvc 从 Asp.net 应用程序使用 WCF SOAP 服务时出错(没有端点侦听) - Error (There was no endpoint listening at) while consuming the WCF SOAP Service from Asp.net Application 在 window worker service dot.net core 连接到数据库时出现错误? - In window worker service dot net core while connectiong to database i am getting error? 与Java客户端调用.NET SOAP Web服务的SOAP信封有所不同 - Difference in SOAP envelope from Java Client calling .NET SOAP Web-Service
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM