I am currently trying to invoke a SOAP service from my Azure Function which is giving me following error:

However, I am successfully able to process the request from .NET application.

HTTP Status 500 - Request processing failed; nested exception is org.springframework.ws.soap.saaj.SaajSoapEnvelopeException: Could not access envelope: Unable to create envelope from given source: ; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:

This is a third-party service and its written in Java. I have no idea of how it is deployed, but yes, as it works from Console App, I feel there isn't anything wrong with the service:

string soapEndPoint = "https://<<url>>/endpoints";
string serviceOperationName = "SendLotListService";

SendLotListRequest sendLotListRequest = new SendLotListRequest();
SendLotListResponse sendLotListResponse = null;
sendLotListRequest.LotList = lotRecords.ToArray();

System.ServiceModel.BasicHttpsBinding binding = new BasicHttpsBinding(BasicHttpsSecurityMode.Transport);
binding.BypassProxyOnLocal = true;

EndpointAddress address = new EndpointAddress(soapEndPoint);

using (SendLotListServiceClient sendLotListServiceClient = new SendLotListServiceClient(binding, address))
{
    OperationDescription sendLotListOperation = new OperationDescription(serviceOperationName, new ContractDescription(serviceOperationName));
    sendLotListOperation.Messages.Add(new MessageDescription(serviceOperationName, MessageDirection.Input));
    sendLotListServiceClient.Endpoint.Contract.Operations.Add(sendLotListOperation);
    sendLotListServiceClient.Open();
    sendLotListResponse = sendLotListServiceClient.SendLotList(sendLotListRequest);
}

Could anyone please suggest what could be wrong here?

Thanks in advance for your help

2

There are 2 best solutions below

0
On BEST ANSWER

Thanks Peter and vivasaayi for your comments and I did investigations in those directions.

But, as I have no control over spring framework on server, I couldn't upgrade it. Also, my requests were of relatively small duration in terms of execution time, so the timeout was not an issue either.

I could fix it by adding following line of code in my .NET client

System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
0
On

There was a similar issue on MSDN, and a reply explain by a MSFT for this case which there is a 230 second timeout for requests that are not sending any data back, please see below.

After some investigation, I see what's going on. There is a 230 second (i.e. a little less than 4 mins) timeout for requests that are not sending any data back. After that, the client gets the 500 you saw, even though in reality the request is allowed to continue server side.

If you are expecting to do server side processing that lasts this long, I would suggest using an alternate flow that works in a more async way. i.e. let the user queue up the report generation, and then allow them to download it when it's complete. Or as an alternative, you could upload the result to blob storage, and have it be available there for pickup.

I would argue that even without this timeout, the majority of users would themselves give up on the request if they saw it spinning in their browser for that long. So the async pattern makes for a better user experience.

Hope it helps.