* send jms message
*/
private String sendJmsMessage(WSIFMessage input) throws WSIFException {
String correlId = null;
WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
setPropertyValues();
/**
* set the parts onto the message
*/
// The input message parts can either be a jms property
// or an input part. Input parts not defined in the
// WSDL will be ignored. Input parts will only be used
// if there is not a jms:input atribute, or the part
// name is in the jms:input list. Parts defined in the
// WSDL but not in the input message defualt to null.
String partName;
ArrayList wsdlInputParts = getWSDLInputPartNames();
HashMap propertyParts = getPropertyParts();
WSIFMessage message = createInputMessage();
for (Iterator i = input.getPartNames(); i.hasNext();) {
partName = (String) i.next();
if (propertyParts.containsKey(partName)) {
String name = (String) propertyParts.get(partName);
Object value = input.getObjectPart(partName);
if (!timeoutProperty(name, value)) {
jmsDest.setProperty(name, value);
}
} else if (wsdlInputParts.contains(partName)) {
wsdlInputParts.remove(partName);
if (fieldInput == null) {
message.setObjectPart(
partName,
input.getObjectPart(partName));
} else if (fieldInput.getParts().contains(partName)) {
message.setObjectPart(
partName,
input.getObjectPart(partName));
}
}
}
// default missing parts to null
for (Iterator i = wsdlInputParts.iterator(); i.hasNext();) {
message.setObjectPart((String) i.next(), null);
}
// properties from the context
setDestinationContext();
Service serviceModel = null;
Definition def = fieldJmsPort.getDefinition();
Map services = WSIFUtils.getAllItems(def, "Service");
Port port = fieldJmsPort.getPortModel();
for (Iterator i = services.values().iterator(); i.hasNext();) {
Service s = (Service) i.next();
if (s.getPorts().values().contains(port)) {
serviceModel = s;
break;
}
}
if (serviceModel == null) {
throw new WSIFException("cannot find service for port: " + port);
}
formatter = (JMSFormatter) fieldJmsPort.getFormatter();
WSIFRequest request = new WSIFRequest(serviceModel.getQName());
request.setIncomingMessage(message);
request.setOperationName(fieldOperation.getName());
request.setPortName(fieldJmsPort.getPortModel().getName());
request.setInputName(fieldBindingOperation.getBindingInput().getName());
javax.jms.Message jmsMessage =
jmsDest.createMessage(getJMSMessageType());
formatter.formatRequest(request, jmsMessage);
// **NS No support for listener - add that in
// The basis is off the handler - if handler is defined, we start up the listener
if (isAsyncOperation() && handler != null)
jmsDest.setAsyncMode(true);
correlId = jmsDest.send(jmsMessage, null, !inputOnlyOp);
return correlId;
}