Problem with WCF client calling one-way operation

kay.herzam picture kay.herzam · Mar 13, 2009 · Viewed 13.3k times · Source

I have run into a problem when calling web service on a SAP PI bus from my WCF client. The operation is defined as one-way, and the method on my proxy operation contract is decorated accordingly when the service reference is added. However, the service client gets an exception when calling the according operation:

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

Using SoapUI, the method on the bus can be called successfully, and it returns a SOAP envelope with an empty body. The bus people told me, this is according to the SOAP specs:


(SOAP specs, chapter 4.7.9, One-way operations):

There are differing interpretations of how HTTP is to be used when performing one-way operations.

R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains an envelope. Specifically, the HTTP response entity-body must be empty.

R2750 A CONSUMER MUST ignore an envelope carried in a HTTP response message in a one-way operation.

R2727 For one-way operations, a CONSUMER MUST NOT interpret a successful HTTP response status code (i.e., 2xx) to mean the message is valid or that the receiver would process it.


So it seems, my WCF client doesn't comply with R2750.

I have found out that when I force the operation contract on the proxy to be IsOneWay = false, everything works.

Is there anything wrong with the way WCF handles one way operations or do I do something wrong (more likely)? Is there anything else I should do, it just doesn't seem right to override the generated WCF proxy client.

Thanks for any suggestions.

Answer

Brian Low picture Brian Low · Feb 13, 2013

It looks like SAP PI incorrectly sends an empty SOAP envelope and .NET incorrectly interprets that envelope.

Some options from this thread:

  • alter the generated proxy and remove OneWay=true (or add OneWay=false) to the method definition
  • catch the Protocol Violation in an exception handler and ignore it
  • use a 2.0 style webreference to call the service
  • apply SAP patch Note 1459995 - Soap Sender Adapter HTTP 202 and add &responsecode202=true to the url

The first and last options both worked for me. Further discussion on this sap.com thread.