/* safe to ignore */
}
throw new SOAPFaultException(soapFault);
}
XMLRoot xmlRoot = null;
try {
XMLContext xmlContext = dbwsAdapter.getXMLContext();
XMLUnmarshaller unmarshaller = xmlContext.createUnmarshaller();
if (attachments != null && attachments.size() > 0) {
unmarshaller.setAttachmentUnmarshaller(new XMLAttachmentUnmarshaller() {
Map<String,DataHandler> attachments;
public XMLAttachmentUnmarshaller setAttachments(Map<String, DataHandler> attachments) {
this.attachments = attachments;
return this;
}
public boolean isXOPPackage() {
return true;
}
public DataHandler getAttachmentAsDataHandler(String id) {
// strip off 'cid:' (Is this needed?)
String attachmentRefId = id;
if (attachmentRefId.startsWith("cid:")) {
attachmentRefId = attachmentRefId.substring(4);
}
return attachments.get(attachmentRefId);
}
public byte[] getAttachmentAsByteArray(String id) {
ByteArrayOutputStream out = null;
try {
DataHandler dh = attachments.get(id);
if (dh == null) {
return null;
}
InputStream in = dh.getInputStream();
out = new ByteArrayOutputStream(1024);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
}
catch (IOException e) {
// e.printStackTrace();
}
if (out != null) {
return out.toByteArray();
}
return null;
}
}.setAttachments(attachments));
dbwsAdapter.setCurrentAttachmentUnmarshaller(unmarshaller.getAttachmentUnmarshaller());
}
xmlRoot = (XMLRoot)unmarshaller.unmarshal(body, Invocation.class);
}
catch (Exception e) {
SOAPFault soapFault = null;
try {
SOAPFactory soapFactory = null;
if (usesSOAP12) {
soapFactory = SOAPFactory.newInstance(SOAP_1_2_PROTOCOL);
} else {
soapFactory = SOAPFactory.newInstance();
}
QName faultCodeQName = null;
if (usesSOAP12) {
faultCodeQName = SENDER_QNAME;
} else {
faultCodeQName = CLIENT_QNAME;
}
Throwable e1 = e;
if (e.getCause() != null) {
e1 = e.getCause();
}
soapFault = soapFactory.createFault("SOAPMessage request format error - " + e1, faultCodeQName);
} catch (SOAPException se) {
// ignore
}
throw new SOAPFaultException(soapFault);
}
Invocation invocation = (Invocation)xmlRoot.getObject();
invocation.setName(xmlRoot.getLocalName());
Operation op = dbwsAdapter.getOperation(invocation.getName());
/*
* Fix up types for arguments - scan the extended schema for the operation's Request type.
*
* For most parameters, the textual node content is fine, but for date/time and