Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with WCF client calling one-way operation

Tags:

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.

like image 852
kay.herzam Avatar asked Mar 13 '09 15:03

kay.herzam


People also ask

In which case does a oneway call block a client?

If the client issues a one-way call and then closes the proxy while the method executes, the client will still be blocked until the operation completes.

What is one-way operation in WCF?

In a request-reply pattern, the client waits for the reply message, even if the service operation is represented in code as a void method. With a one-way operation, only one message is transmitted. The receiver does not send a reply message, nor does the sender expect one.

What is callback contract in WCF?

Abstract: In WCF, callback is used to implement PUSH mechanism, so that delayed or long running operation results can be automatically pushed back to the client application. WCF actively supports callback to its client, over the instance context established.

What are WCF calls?

WCF is a general-purpose, message-based communication system to enable you to create distributed systems - you have a bunch of services somewhere on your servers, which offer up to perform certain functions on the client's behalf, when they call. WCF is something like web services - only much more than that.


2 Answers

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.

like image 86
Brian Low Avatar answered Sep 21 '22 23:09

Brian Low


I would take a look at this article as well by Gerben van Loon here. One way operation might not really be one way according to the standards.

like image 44
Bryan Corazza Avatar answered Sep 24 '22 23:09

Bryan Corazza