我在Eclipse中使用JDOM进行了许多集成,但这是我第一次遇到问题,因为我的SOAP XML消息应该包含一个具有特定元素的HEADER
元素。这是我的全部信息:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agi="http://agilent.parlayx.sms">
<soapenv:Header>
<cppass>test</cppass>
<cpuname>test</cpuname>
</soapenv:Header>
<soapenv:Body>
<agi:sendBulkSms>
<address>tel:3876123456</address>
</agi:sendBulkSms>
</soapenv:Body>
</soapenv:Envelope>
我创建了BODY
结构:
Element top = new Element("sendBulkSms", agi);
Document jDoc = new Document(top);
Element address = new Element("address", agi);
address.setText("tel:3876123456");
top.addContent(address);
这个工作正常,我以前做过很多次。但是是否可以使用JDOM创建消息的header元素呢?因为据我所知,只有BODY元素可以被定义但是我的消息对于web服务请求是无效的
Thank you, I will appreciate help
你只是创建标准的XML没有"header"你只是有一个名为"header"的元素命名空间="soapenv"。所以在我看来,它应该像创建任何其他JDOM元素。