Refine search
import javax.xml.bind.*; import javax.xml.soap.*; public class Demo { public static void main(String[] args) throws Exception { MessageFactory mf = MessageFactory.newInstance(); SOAPMessage message = mf.createMessage(); SOAPBody body = message.getSOAPBody(); Foo foo = new Foo(); foo.setBar("Hello World"); JAXBContext jc = JAXBContext.newInstance(Foo.class); Marshaller marshaller = jc.createMarshaller(); marshaller.marshal(foo, body); message.saveChanges(); message.writeTo(System.out); } }
MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart();
MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart();
MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart();
+ "</soapenv:Body>" + "</soapenv:Envelope>"; SOAPMessage message = MessageFactory.newInstance() .createMessage(new MimeHeaders(), new ByteArrayInputStream(soap.getBytes("UTF-8"))); SoapMessage soapMessage = new SaajSoapMessage(message); DefaultSoapHeaderMapper mapper = new DefaultSoapHeaderMapper();
@Test public void testDoNotOverriderSoapAction() throws Exception { MimeHeaders mimeHeaders = new MimeHeaders(); String testSoapAction = "fooAction"; mimeHeaders.setHeader(TransportConstants.HEADER_SOAP_ACTION, testSoapAction); String soap = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"></soapenv:Envelope>"; SOAPMessage message = MessageFactory.newInstance() .createMessage(mimeHeaders, new ByteArrayInputStream(soap.getBytes())); SaajSoapMessage soapMessage = new SaajSoapMessage(message); DefaultSoapHeaderMapper headerMapper = new DefaultSoapHeaderMapper(); headerMapper.fromHeadersToRequest(new MessageHeaders(null), soapMessage); assertEquals(testSoapAction, soapMessage.getSoapAction()); }
SaajSoapMessage message = new SaajSoapMessage(MessageFactory.newInstance().createMessage());
/** * Creates a SOAP message for SOAP 1.2 or 1.1 * * @param soapVersion * SOAP version * @return Version depending SOAP message * @throws SOAPException * if an error occurs. */ public static SOAPMessage getSoapMessageForProtocol(String soapVersion) throws SOAPException { return MessageFactory.newInstance(soapVersion).createMessage(); }
/** * Create a SOAP 1.2 Message * * @return * @throws SOAPException */ public static SOAPMessage createSOAP12() throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); SOAPMessage soapMessage = messageFactory.createMessage(); return soapMessage; }
/** * Create a SOAP 1.2 Message * * @return * * @throws SOAPException */ public static SOAPMessage createSOAP12() throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); SOAPMessage soapMessage = messageFactory.createMessage(); return soapMessage; }
/** * Given a stream of {@link SOAPMessage}, construct the {@link SOAPMessage} * * @param is * @return * @throws IOException * @throws SOAPException */ public static SOAPMessage getSOAPMessage(InputStream is) throws IOException, SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); return messageFactory.createMessage(null, is); }
/** * Create an empty {@link SOAPMessage} * @return * @throws SOAPException */ public static SOAPMessage create() throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); return soapMessage; }
/** * Create an empty {@link SOAPMessage} * @return * @throws SOAPException */ public static SOAPMessage create() throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); return soapMessage; }
/** * Creates a SOAP message for SOAP 1.2 or 1.1 * * @param soapVersion * SOAP version * @return Version depending SOAP message * @throws SOAPException * if an error occurs. */ public static SOAPMessage getSoapMessageForProtocol(String soapVersion) throws SOAPException { return MessageFactory.newInstance(soapVersion).createMessage(); }
/** * The response is ALWAYS completely empty - there is no way to communicate back to the * originator in any way as they should not be aware that we exist. * * @return an empty SOAPMessage * @throws SOAPException */ SOAPMessage getReturnCode() throws SOAPException { MessageFactory factory = MessageFactory.newInstance(); return factory.createMessage(); }
/** * Create an empty {@link SOAPMessage} * * @return * @throws SOAPException */ public static SOAPMessage create() throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); return soapMessage; }
/** * Given a stream of {@link SOAPMessage}, construct the {@link SOAPMessage} * @param is * @return * @throws IOException * @throws SOAPException */ public static SOAPMessage getSOAPMessage(InputStream is) throws IOException, SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); return messageFactory.createMessage(null, is); }
/** * Given a stream of {@link SOAPMessage}, construct the {@link SOAPMessage} * @param is * @return * @throws IOException * @throws SOAPException */ public static SOAPMessage getSOAPMessage(InputStream is) throws IOException, SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); return messageFactory.createMessage(null, is); }
/** * The response is ALWAYS completely empty - there is no way to communicate back to the * originator in any way as they should not be aware that we exist. * * @return an empty SOAPMessage * @throws SOAPException */ SOAPMessage getReturnCode() throws SOAPException { MessageFactory factory = MessageFactory.newInstance(); return factory.createMessage(); }
/** * Create an empty {@link SOAPMessage} * * @return * * @throws SOAPException */ public static SOAPMessage create() throws SOAPException { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); return soapMessage; }