简体   繁体   中英

Get dataHandler from a SOAP message

I need a way to change the dataHandler field to cid:generated cid

How do I get the dataHandler element from the SOAP message?

This approach doesn't work:

env.getBody().getElementByID("datahandler")

Any help?

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(
            "dmsSOAP.fiso.denue.fisglobal.com",
            "dispatchDocument")));

env.getBody().getElementByID("datahandler"); // this is wrong

Envelope:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <ns1:dispatchDocumentRequest>  
         <dataDescription>   
            <dataHandler>HERE</dataHandler>
         </dataDescription>
      </ns1:dispatchDocumentRequest>
   </soapenv:Body>
</soapenv:Envelope> 

I think you should try it with camelCase, so instead of

COPYenv.getBody().getElementByID("datahandler")

Try the following:

COPYenv.getBody().getElementByID("dataHandler")

EDIT

According to your comment i think you should try:

COPYenv.getBody().getElementByID("dataHandler").setText("something")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM