从SOAP消息获取dataHandler

时间:2018-12-13 11:05:15

标签: java soap

我需要一种方法将dataHandler字段更改为cid:generated cid

如何从SOAP消息中获取dataHandler元素?

这种方法行不通:

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

有帮助吗?

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

信封:

<?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> 

1 个答案:

答案 0 :(得分:0)

我认为您应该使用camelCase尝试使用它,而不是

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

尝试以下操作:

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

编辑

根据您的评论,我认为您应该尝试:

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