// 4) The type of the data block is defined by schema; thus in most cases
// an xsi:type will not be present
// Get the operation information
ParameterDescription[] pds = operationDesc.getParameterDescriptions();
MarshalServiceRuntimeDescription marshalDesc =
MethodMarshallerUtils.getMarshalDesc(endpointDesc);
TreeSet<String> packages = marshalDesc.getPackages();
// Create the message
MessageFactory mf = (MessageFactory)FactoryRegistry.getFactory(MessageFactory.class);
Message m = mf.create(protocol);
// Put the return object onto the message
Class returnType = operationDesc.getResultActualType();
if (returnType != void.class) {
AttachmentDescription attachmentDesc =
operationDesc.getResultAttachmentDescription();
if (attachmentDesc != null) {
if (attachmentDesc.getAttachmentType() == AttachmentType.SWA) {
// Create an Attachment object with the signature value
Attachment attachment = new Attachment(returnObject,
returnType,
attachmentDesc,
operationDesc.getResultPartName());
m.addDataHandler(attachment.getDataHandler(),
attachment.getContentID());
m.setDoingSWA(true);
} else {
throw ExceptionFactory.
makeWebServiceException(Messages.getMessage("pdElementErr"));
}
} else {
Element returnElement = null;
QName returnQName = new QName(operationDesc.getResultTargetNamespace(),
operationDesc.getResultName());
if (marshalDesc.getAnnotationDesc(returnType).hasXmlRootElement()) {
returnElement = new Element(returnObject, returnQName);
} else {
/* when a schema defines a SimpleType with xsd list jaxws tooling generates art-effects with array rather than a java.util.List
* However the ObjectFactory definition uses a List and thus marshalling fails. Lets convert the Arrays to List.
*/