Monday 23 August 2010

"The one-way operation returned a non-null message with Action=''." Error when calling a SAP Web Service from a MS .NET WCF Client

I received the following exception today when attempting to call a new service in SAP PI (Process Integration), the equivalent of MS Biztalk in the SAP world:

The one-way operation returned a non-null message with Action=''.

Using WireShark, I looked in on the HTTP traffic:



Looking closely, it turns out that SAP returns an Empty SOAP body in the response (ie NOT just a blank string/nothing) as per the screenshot below:


As discussed here http://www.go4answers.com/Example/exception-while-making-way-call-wcf-56416.aspx   , there is a hotfix for the issue that can be found at  http://forums.sdn.sap.com/message.jspa?messageID=9031931 
- however the simplest fix is to handle the System.ServiceModel.ProtocolException and effectively ignore this exception.

//Execute call
            var client = WCFClientFactory.CreateClient(CredentialType.PI);
            try
            {
                client.SI_EmpSave_Async_Out(empObj);
            }
            catch (System.ServiceModel.ProtocolException ex) //Just handle this specific exception. 
            //Otherwise bubble up
            {
                if (!ex.Message.Equals("The one-way operation returned a non-null message with Action=''."))
                    throw;
            }

DDK

No comments: