Roland Merrick wrote:
ACTION: eric to come up with more
example text for section 2.2.3.1
or 2.2.2.1
[recorded in http://www.w3.org/2008/07/29-soap-jms-minutes.html#action02]
For section 2.2.2.1:
import java.naming.Context;
import javax.jms.DeliveryMode;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageProducer;
...
class ... {
// add appropriate error checking for your use....
public void someMethod(Context ctx, MessageProducer producer, Message
jmsMessage,
String deliveryModeStr, String replyToName, int priority, long
timeToLive) {
// set the delivery mode to the appropriate constant value.
int deliveryMode = deliveryModeStr.equals("PERSISTENT") ?
DeliveryMode.PERSISTENT, DeliveryMode.NON_PERSISTENT;
jmsMessage.setJMSDeliveryMode( deliveryMode );
// Set the reply destination, first looking it up using JNDI
Destination replyDestination = ctx.lookup(replyToName);
jmsMessage.setJMSReplyTo(replyDestination);
// set the priority on the message.
jmsMessage.setJMSPriority(priority);
// set when the message is set to expire.
producer.setTimeToLive(timeToLive);
// and finally, send the message.
producer.send(jmsMessage);
// alternately, a bunch of the lines above could be collapsed to:
// producer.send(jmsMessage, deliveryMode, priority, timeToLive);
}
}
For section 2.2.3.1, a similar pattern:
import javax.jms.Message;
import javax.mail.internet.ContentType;
...
class ... {
public void anotherMethod(Message jmsMessage, String targetService,
ContentType type, URI requestURI) {
jmsMessage.setStringProperty("SOAPJMS_targetService",
targetService);
// at least for this definition of the binding, the version here is
always "1.0"
jmsMessage.setStringProperty("SOAPJMS_bindingVersion", "1.0");
// set the content type using the ContentType value already defined
by javax.mail.
jmsMessage.setStringProperty("SOAPJMS_contentType", type.toString()
);
jmsMessage.setStringProperty("SOAPJMS_soapAction", "");
// for the first message in an exchange, not a fault1
jmsMessage.setBooleanProperty("SOAPJMS_isFault", false);
jmsMessage.setStringProperty("SOAPJMS_requestURI,
requestURI.toString() );
}
}
Thus concludes my pending action items.
-Eric.