Basically my dataHandler
content should be a string referencing the id of the soap attachment but my Stub puts the base64string based on the DataHandler object passed to the Stub instead.
How can I "hack" into the body of the message before sending?
env.getBody().toString().replaceAll(pattern, "<dataHandler>cid:" + cid + "</dataHandler")
does exactly what I want but env.getBody().setText
doesn't set the text of the body**
// create a message context
_messageContext = new org.apache.axis2.context.MessageContext();
// Modified
// Attachment
String cid = _messageContext.addAttachment(dispatchDocumentRequest8.getDataDescription().getDataHandler());
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env = null;
env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
dispatchDocumentRequest8,
optimizeContent(new javax.xml.namespace.QName("com.test",
"dispatchDocument")));
// Modified
String pattern = "(?s)<dataHandler[^>]*>.*?</dataHandler>";
env.getBody().setText(env.getBody().toString().replaceAll(pattern, "
<dataHandler>cid:" + cid + "</dataHandler"));