[wsf-c-dev] [WSF4PHP] RM one-way and two-way

Paul Fremantle paul at wso2.com
Thu Jan 25 03:34:50 PST 2007


Yesterday I tried to get RM working in PHP for the one-way and two-way 
cases. I'll try to summarize where I got to, tho its fairly complex!

The first bug I found is that every message is marked as LastMessage. So 
if I send two messages from the same script I get:

CS
Msg1, Last
Msg2, Last
TS

This is obviously wrong. Either the messages shouldn't be marked last, 
or we should terminate and then create a new sequence for the second 
message. Worryingly the server didn't seem to mind!

The second comment is that the system is not at all robust. If there are 
problems - for example the server is down - the engine gets a bit 
muddled and nothing happens. The only solution seems to be to rebuild 
the database and restart the server. We have to make it much more robust 
at recovering from situations, and also logging what is wrong.

I tried to do two way RM with the client->request() approach. I only got 
RM on the outgoing flow, and I got back two envelopes in a single HTTP 
response - one with the actual response and one with the ack. Basically 
the code isn't "piggybacking" the acknowledgement into the existing message.

So before we can really do RM two-way I think we need a clearly defined 
approach for doing two-way async calling in PHP.

Here is my suggestion.

Suppose I want to call a req-resp service (http://server/rr.php and have 
the response handled asynchronously. I create a PHP script to handle the 
response message (as a service). Let's call this http://client/callback.php

Now I set:

$client = new WSClient(
	array("to"=>"http://server/rr.php",
		"useWSA"=>TRUE,
		"replyTo"=>"http://client/callback.php"));

$client->send($request);

This actually works pretty well.

So I tried this with RM. Unfortunately the CS message also picks up the 
same address as the replyTo. This means that the CSR goes to 
http://client/callback.php. In theory, there is nothing wrong with that 
(I did define this service to have "reliable"=>TRUE). But it doesn't 
like it.

There are two solutions. One is that we could make the CS use Anon for 
its replyTo/acksTo. That would be reasonable. The other is that we could 
make sure it works when the CS response comes in to another URL.

I then tried the following, to see if I could make progress. I decided 
to send two messages. The first was one-way only, and had an anonymous 
replyTo. This meant that the CSR came back ok. Then I sent my two-way 
with the callback.php replyTo address.

This actually almost worked! The server sent a new CreateSequence to 
callback.php and got a response. Then the server sent the message to 
callback.php with the right sequenceid and message number. The only 
thing was that we never got an acknowledgement or a terminate sequence.

Paul

-- 
Paul Fremantle
VP/Technology and Partnerships, WSO2
OASIS WS-RX TC Co-chair

http://bloglines.com/blog/paulfremantle
paul at wso2.com
(646) 290 8050

"Oxygenating the Web Service Platform", www.wso2.com





More information about the Wsf-c-dev mailing list