Hi,
yes it is possible to use WS-RM with Muse. But it doesn't come out of the box.
As Muse uses for Client communication HTTP, you have to implement some classes
yourself.
You have to extend the 'SimpleSubscriptionManager' class to allow for setting
of a new 'SimpleSoapClient' class (configure this in muse.xml). Something like:
protected NotificationConsumerClient createConsumerClient() {
EndpointReference consumer = getConsumerReference();
EndpointReference producer = getProducerReference();
Environment env = getEnvironment();
// set new SOAP client
// SoapClient soapClient = null;
// try {
// soapClient = new WsnOssjAxis2SoapClient();
// }
// catch (AxisFault ex) {
//
// soapClient = new SimpleSoapClient();
// }
SoapClient soapClient = new WsnOssjAckSoapClient();
env.setSoapClient(soapClient);
NotificationConsumerClient client = new
WsnOssjNotificationConsumerClient(consumer, producer, env);
client.setTrace(isUsingTrace());
return client;
}
Then you have to create a new 'SimpleSoapClient' class where you replace the
send method with something like this:
public Element[] send(final EndpointReference src, final EndpointReference
dest, final String wsaAction,
final Element[] body, final Element[] extraHeaders) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Use constum SOAP client!");
}
if (dest == null) {
throw new NullPointerException("NullDestinationEPR");
}
if (wsaAction == null) {
throw new NullPointerException("NullActionURI");
}
Element[] soapBody = body;
if (soapBody == null) {
soapBody = EMPTY_ARRAY;
}
Element[] soapHeaders = extraHeaders;
if (extraHeaders == null) {
soapHeaders = EMPTY_ARRAY;
}
// create the request message and turn it into bytes
final Element soapRequest = this.createMessage(src, dest, wsaAction,
soapBody, soapHeaders);
if (this.isUsingTrace()) {
this.trace(soapRequest, false);
}
// send / receive Axis2 messages
try {
final Options opts = new Options();
opts.setAction(wsaAction);
org.apache.axis2.addressing.EndpointReference axis2Epr = new
org.apache.axis2.addressing.EndpointReference(
dest.getAddress().toString());
opts.setTo(axis2Epr);
// axis2Epr = new
//
org.apache.axis2.addressing.EndpointReference(src.getAddress().toString());
// opts.setFrom(axis2Epr);
// opts.setReplyTo(axis2Epr);
// opts.setUseSeparateListener(true);
opts.setTransportInProtocol(Constants.TRANSPORT_HTTP);
opts.setProperty(Constants.Configuration.CHARACTER_SET_ENCODING,
"UTF-8");
opts.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, "true");
// opts.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
// opts.setProperty(SandeshaClientConstants.SANDESHA_LISTENER,
// new SandeshaListener() {
// public void onError(AxisFault fault) {
// LOGGER.info("Sandesha listener SOAP fault: "
// + fault.getFaultCode());
// }
//
// public void onTimeOut(SequenceReport report) {
// LOGGER.info("Sandesha listener SOAP fault: "
// + report.getSequenceID());
// }
// });
this.axis2Client.setOptions(opts);
// omResponse =
// axis2Client.sendReceive(this.convertToAxiom(soapBody[0]));
// axis2Client.sendRobust(this.convertToAxiom(soapBody[0]));
this.axis2Client.sendReceiveNonBlocking(this.convertToAxiom(soapBody[0]), new
TestCallback("WsnOssjTest"));
// SandeshaClient.waitUntilSequenceCompleted(this.axis2Client);
}
catch (final AxisFault af) {
LOGGER.error("Axis2 client exception caught!", af);
}
// don't return null, as this will cause a NPE
return new Element[0];
}
Then the call to the client goes via Axis2. Of course you have also to set up
services.xml. This is more or less also the way to integrate Rampart. But with
Rampart you can use WSS4J directly and only add the header to the soap header
and then send the envelope over http.
At last you should then have Sandesha2 working. There is some error which I
didn't find the reason for. The SoapAction and the wsa:Action don't match,
which breaks the terminationSequence call (some users on this list supposed
that it has something to do with the muse-wsa module, I don't know). For the
Axis2 client you can avoid setting the SoapAction by setting the following
option
opts.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, "true");
But for the Sandesha2 handler himself I didn't find a way.
Nevertheless I didn't use Sandesha2 because you don't have a callback method at
the server side. So it is not possible to acknowledge the receipt of the
message yourself. Sandesha2 only guarantees that the message is received by the
Sandesha2 handler, but not by the Muse consumer. I couldn't find a way to
acknowledge the reception of the message myself. So I use the HTTP OK code to
know on the producer side that the message was delivered and only then I send
the next message.
Hope this helps to get you running. If you get it working, please post your
solution.
Best regards
Matthias
-----Ursprüngliche Nachricht-----
Von: Kin Onn Low [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 8. Mai 2007 05:50
An: [email protected]
Betreff: WS-ReliableMessaging with Muse
Hi. I'm using Muse 2.2.0 and WS-Notification deployed in Axis2. Is it
possible to implement WS-ReliableMessaging for outbound notification
messages generated from Muse? I'd like to make use of Sandesha2 but my
understanding is that NotificationProducer does not make use of Axis2
client to send the notification messages.
Thanks for your help.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]