use of com.sun.xml.ws.message.saaj.SAAJMessage in project metro-jax-ws by eclipse-ee4j.
the class DomUtilTester method testSOAPEnvelope2_1.
public void testSOAPEnvelope2_1() throws Exception {
for (File f : folder.listFiles()) {
System.out.println("***********" + f.getName() + "***********");
SOAPMessage soapmsg = getSOAPMessage(f);
SAAJMessage saajmessage = new SAAJMessage(soapmsg);
XMLStreamWriter writer = staxOut.createXMLStreamWriter(new PrintStream(System.out));
saajmessage.writeTo(writer);
writer.close();
assert (true);
System.out.println("*****************************************");
}
}
use of com.sun.xml.ws.message.saaj.SAAJMessage in project metro-jax-ws by eclipse-ee4j.
the class SAAJMessageTester method writeMessage.
private void writeMessage(InputStream in) throws Exception {
MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
MimeHeaders mhs = new MimeHeaders();
mhs.addHeader("Content-Type", "text/xml");
mhs.addHeader("Content-Transfer-Encoding", "binary");
SOAPMessage sm = mf.createMessage(mhs, in);
SAAJMessage msg = new SAAJMessage(sm);
ByteArrayBuffer baos = new ByteArrayBuffer();
XMLStreamWriter writer = XMLStreamWriterFactory.create(baos);
msg.writeTo(writer);
writer.flush();
}
use of com.sun.xml.ws.message.saaj.SAAJMessage in project metro-jax-ws by eclipse-ee4j.
the class SAAJMessageTester method testDOMLevel1WriteTo.
public void testDOMLevel1WriteTo() throws Exception {
DocumentBuilderFactory builderFactory = null;
DocumentBuilder builder = null;
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage soapMessage = messageFactory.createMessage();
SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
soapEnvelope.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
soapEnvelope.setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema");
SOAPBody soapBody = soapEnvelope.getBody();
Name elementName = soapEnvelope.createName("addNumbers", "", "http://duke.org");
SOAPBodyElement bodyElement = soapBody.addBodyElement(elementName);
SAAJMessage msg = new SAAJMessage(soapMessage);
ByteArrayBuffer baos = new ByteArrayBuffer();
XMLStreamWriter writer = XMLStreamWriterFactory.createXMLStreamWriter(baos);
msg.writeTo(writer);
writer.flush();
}
use of com.sun.xml.ws.message.saaj.SAAJMessage in project metro-jax-ws by eclipse-ee4j.
the class SAAJMessageTester method init.
private void init() {
MessageFactory mf = null;
try {
mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
MimeHeaders mhs = new MimeHeaders();
mhs.addHeader("Content-Type", "text/xml");
mhs.addHeader("Content-Transfer-Encoding", "binary");
SOAPMessage sm = mf.createMessage(mhs, new ByteArrayInputStream(soap11Msg.getBytes()));
msg = new SAAJMessage(sm);
} catch (SOAPException e) {
e.printStackTrace();
assertTrue(false);
} catch (IOException e) {
e.printStackTrace();
assertTrue(false);
}
}
use of com.sun.xml.ws.message.saaj.SAAJMessage in project metro-jax-ws by eclipse-ee4j.
the class SaajMessageTest method testBodyAttr.
public void testBodyAttr() throws Exception {
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
Source src = new StreamSource(new ByteArrayInputStream(MESSAGE_535.getBytes()));
message.getSOAPPart().setContent(src);
SAAJMessage saajMsg = new SAAJMessage(message);
// breaks the underlying SOAPMessage
saajMsg.hasHeaders();
Source source = saajMsg.readEnvelopeAsSource();
SOAPMessage newMsg = factory.createMessage();
newMsg.getSOAPPart().setContent(source);
SOAPBody body = newMsg.getSOAPBody();
assertEquals("value", body.getAttribute("attr"));
}
Aggregations