1
我需要用Java生成Soap請求。這是我需要生成並通過XML文件:Java中的Soap請求
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="website"
xmlns:com="website/Common"
xmlns:xm="http://www.w3.org/2005/05/xmlmime">
<soapenv:Header/>
<soapenv:Body>
<ns:RequestName>
<ns:model>
<ns:keys query="myquery;" ></ns:keys>
<ns:instance></ns:instance>
</ns:model>
</ns:RequestName>
</soapenv:Body>
</soapenv:Envelope>
我知道有這樣做的其他方法,如wsimport的,但我想知道怎麼做了這種方式。我這樣,我的意思是創建一個Soap請求的XML文件是什麼正確的Java語法。下面是一些很基本的語法:
SOAPMessage message = messageFactory.createMessage();
SOAPHeader header = message.getSOAPHeader();
SOAPBody body = message.getSOAPBody();
// Here is the XML it produces:
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
...
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
你的意思 '這樣'? – hahn
從技術上講,生成這個xml和流是一種*方法*。你有什麼想法? – Neil
爲Soap Reuqest生成這個xml文件的正確Java語法是什麼? – drake