Hi Oliver,

I'm using document type of SOAP message for sending. And I've also 
looked into the source code of JMSSender.java file and found some 
interesting part of code.

byte[] call(JMSEndpoint endpoint, byte[] message, long 
timeout,HashMap properties) throws Exception {
...
jmsMessage.writeBytes(message);
jmsMessage.setJMSReplyTo(reply);
int deliveryMode = extractDeliveryMode(properties);
int priority = extractPriority(properties);
long timeToLive = extractTimeToLive(properties);
if(properties != null && !properties.isEmpty())
    setProperties(properties, jmsMessage);
send(endpoint.getDestination(m_session), jmsMessage, 
deliveryMode,priority, timeToLive);
...

SOAP message is serialized and new JMSMessage is created. This is 
normal, but according to this code, you could add ObjectProperties to 
this newly created JMSMessage. Function setProperties is coded in 
folowing way:

private void setProperty(String property, Object value, Message 
message) throws JMSException {
...
    if(property.equals(JMSConstants.JMS_CORRELATION_ID)) 
message.setJMSCorrelationID((String)value);
    else if(property.equals
(JMSConstants.JMS_CORRELATION_ID_AS_BYTES)) 
message.setJMSCorrelationIDAsBytes((byte[])value);
    else if(property.equals(JMSConstants.JMS_TYPE)) message.setJMSType
((String)value);
    else message.setObjectProperty(property, value);
...

The last line is really great. It adds your property to JMSMessage. 
In this way you can pass your service name and other properties you 
might need. The only problem is that HashMap of properties is 
hardcoded to contain only following properties (BUT this can be 
changed :-)) In case it would be modified to include also other 
properties its no problem to add also IP address and other context 
information about client.

....
HashMap props = new HashMap();
if(context.containsProperty(JMSConstants.PRIORITY)) props.put
(JMSConstants.PRIORITY,context.getPropert(JMSConstants.PRIORITY));
if(context.containsProperty(JMSConstants.DELIVERY_MODE)) props.put
(JMSConstants.DELIVERY_MODE,context.getPropert
(JMSConstants.DELIVERY_MODE));
if(context.containsProperty(JMSConstants.TIME_TO_LIVE)) props.put
(JMSConstants.TIME_TO_LIVE,context.getProperty
(JMSConstants.TIME_TO_LIVE));
return props;
....

Cheers,
Michal


--------------
Subject:  AW: AW: AW: How to set JMS transport destination service
From:     "Oliver Adler" <Oliver.Adler () SYRACOM ! DE>
Date:     2003-02-13 11:48:58
[Download message RAW]


Hi Michal,
 
the way how to figure out which service you have to invoke on server 
side depents on \
the soap type. For a SOAP-RPC service are rules defined in the SOAP-
spec. For a \
DOCUMENT-style service NOT. http uses (at the moment) the soapaction. 
But with  SOAP \
1.2 the soapaction is deprecated. The specs says only that it is up 
to the service \
provider to figure out which service to call. (BTW Axis uses the 
namespace of the \
first body element to find the service). We use a soap header to 
transfer the \
servicename. As far as I know there is no standard way to do this 
over JMS. Regards
 
Oliver


--------------------
Poslouchejte Radio Impuls a vyhrajte víkendy pro dva v evropských
metropolích. Více na Radiu Impuls a http://www.netimpuls.cz!



Reply via email to