简体   繁体   中英

How i get response from ASYNC SOAP webservice in .net core?

Firstly im newbie in .net core and soap webserive in .net. We're working on a project about requesting data from SOAP-Based webserive(from WSDL). Maybe the question seems so easy or wierd, i apologize for that.

Here i draw our system: 在此处输入图片说明

The system works like that, first client request a save request from our web API, and we're add some authentication information for SOAP webservice and query from SOAP webservice. Than SOAP webservice returns a unique queryNumber to query results at a later date. Problem is that i couldnt get queryNumber from response.

i added references via WSDL adress using WCF webservice provider and all methods are implemented in references : saveRequest (paramaters, userid for auth., pass for auth.), saveResponse (queryNumber), saveAsync (same as saveRequest). saveAsync method calls saveRequest already.

The usage of saveAsync is seems in reference like:

ServiceClient.saveResponse = await ServiceClient.saveAsync(params);

So i wrote that code:

static async Task<ServiceClient.saveResponse> _run (params){
   Service.ServiceClient = new Service.ServiceClient();
   ServiceClient.saveResponse getResult= await ServiceClient.saveAsync(params);
   return getResult;
}

And than i called this Async method in main or somewhere. But when i called that async method and tried to get queryNumber, I got Internal Server Error (500).

Actually im sending parameters using FormBody (with XML).

I tried same task using SOAPUI and get result XML without any error. Also i tracked code and it's seen that the code stuck in exactly in there:

ServiceClient.saveResponse getResult= await ServiceClient.saveAsync(params);

I'm not sure did i use code block correctly. Do you see any wrong block about code ? or misuse ? Maybe i used async method wrongly but saveAsync wants code blocks exactly like this.

thank you in advance.

Edit 1 : Our 3rd party SOAP web starting with HTTPS://... . is error relevant to that ?

I had the solution. The problem was about .Net Core 2.0 version or System.ServiceModel.Http version. I applied steps in Connecting to a SOAP service with .Net Core 2.0 behind a proxy and problem is solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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