본문 바로가기
TIL/Java

injecting XML(Document) into SOAP body(SOAPBody)

by DandyU 2016. 11. 15.

XML 데이터를 SOAP Body에 넣기


public static SOAPMessage makeSoapRequest(Document document)

throws Exception {

MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.DEFAULT_SOAP_PROTOCOL);

SOAPMessage soapMessage = messageFactory.createMessage();

SOAPPart soapPart = soapMessage.getSOAPPart();


SOAPEnvelope envelope = soapPart.getEnvelope();

SOAPBody soapBody = envelope.getBody();

soapBody.addDocument(document);


soapMessage.saveChanges();

return soapMessage;

}



'TIL > Java' 카테고리의 다른 글

GSON Type 정의 관련 정리  (0) 2017.11.21
Marshalling and Unmarshalling by the JAXB  (0) 2016.11.15
Convert date(String) to XMLGregorianCalendar  (0) 2016.11.15

댓글