// on the binding information available.
Protocol proto = Protocol.getProtocolForBinding(endpointDesc.getClientBindingID());
Message message = null;
if (mode.equals(Mode.PAYLOAD)) {
try {
MessageFactory mf =
(MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
block = factory.createFrom(value, null, null);
message = mf.create(proto);
message.setBodyBlock(block);
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
}
} else if (mode.equals(Mode.MESSAGE)) {
try {
MessageFactory mf =
(MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
// If the value contains just the xml data, then you can create the Message directly from the
// Block. If the value contains attachments, you need to do more.
// TODO For now the only value that contains Attachments is SOAPMessage
if (value instanceof SOAPMessage) {
message = mf.createFrom((SOAPMessage)value);
} else {
block = factory.createFrom(value, null, null);
message = mf.createFrom(block, null, proto);
}
} catch (Exception e) {
throw ExceptionFactory.makeWebServiceException(e);
}
}