cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP WebException: request aborted / canceled

stefan_offermann
Explorer
0 Kudos

Hi,

I am developing a C# tool which is calling BAPIs via SOAP Webservice calls. The tool is being successfully implemented at a number of customers. However, one customer has detected that sometimes a webservice call throws an exception, while many other webservice calls runs successfully. There is no pattern detectable, why the exception is thrown.

This is the stack trace:

System.Net.WebException: System.Net.WebException: The request was aborted: The request was canceled

   at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)

   at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)

   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

   at MyTools.RFC_READ_TABLE.RFC_READ_TABLEService.RFC_READ_TABLE(TAB512[]& DATA, String DELIMITER, RFC_DB_FLD[]& FIELDS, String NO_DATA, RFC_DB_OPT[]& OPTIONS, String QUERY_TABLE, Int32 ROWCOUNT, Boolean ROWCOUNTSpecified, Int32 ROWSKIPS, Boolean ROWSKIPSSpecified)

Unfortunately, no further reason is given for the cancellation of the request.

What can I do to debug this error? Is there a logging mechanism inside the SAP server which maybe has some more error details?

By the way: I know NCo3.0 and may be the SOAP webservice interface will be replaced by NCo 3.0, but I have to solve the problem in less time 😉

Best regards,

Stefan

Accepted Solutions (1)

Accepted Solutions (1)

phil_soady
Participant
0 Kudos

If the error was on the SAP server, see transaction SRT_UTIL

I cant see enough of the stack trace to see what the problem is.

based on your description... some work some dont,  it is most likely a content issue for the specific service call. More details inside SRT_UTIL

stefan_offermann
Explorer
0 Kudos

Thanks for your answer.

Based on a (german) blogpost I could get a workaround for the problem.

http://www.markusreich.at/?p=546

The blogpost mentioned a problem might occur with the keep alive settings of the web services. A solution is to alter the Reference.cs class of each service and overwriting the GetWebRequest method with the following code:

public partial class xyzService : System.Web.Services.Protocols.SoapHttpClientProtocol {

...

    protected override System.Net.WebRequest GetWebRequest(Uri uri)

    {

        System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)base.GetWebRequest(uri);

        request.KeepAlive = false;

        request.ProtocolVersion = System.Net.HttpVersion.Version10;

        return request;

    }

...

}

works for me 🙂

matt
Active Contributor
0 Kudos

I assume you mean transaction SRT_TOOLS? srt_util not being a tranasaction on my system.

phil_soady
Participant
0 Kudos

SRT_UTIL or SRT_UTILS

Dont have access to check now sorry

matt
Active Contributor
0 Kudos

It was a 7.00 system. Tried on a 7.01 system and SRT_UTIL is there... oh well. In any case, this thread solved my problem by passing it on to the developer of the remote system.

The same functionality is available throught SRT_TOOLS in 7.00, in case anyone wonders.

Former Member
0 Kudos

Thanks!

This method seem to be work for me.

        protected override System.Net.WebRequest GetWebRequest(Uri uri)
        {
            System.Net.HttpWebRequest webRequest

               = (System.Net.HttpWebRequest)base.GetWebRequest(uri);


            webRequest.KeepAlive = false;

            return webRequest;
        }

Answers (1)

Answers (1)

owen_carnes
Participant
0 Kudos

We were running into this problem also, but didn't want to set the keep-alive timeout to false for the workaround.  SAP actually provides a solution for this in SAP Note 1737707, it involves a KERNEL patch and setting the following parameter in the instance profile:

icm/HTTP/expect_100_close_on_error = false.

Hopefully this helps anyone else encountering this error.

Two other related and applicable notes are 1662376, and its follow-up 1713675.