Search in sources :

Example 6 with SOAPMessage

use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.

the class TestGetCharsetEncodingWithParser method runTest.

@Override
protected void runTest() throws Throwable {
    String encoding = "iso-8859-15";
    SOAPEnvelope orgEnvelope = soapFactory.getDefaultEnvelope();
    soapFactory.createOMElement("echo", soapFactory.createOMNamespace("urn:test", null)).setText("test");
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    OMOutputFormat format = new OMOutputFormat();
    format.setCharSetEncoding(encoding);
    orgEnvelope.serialize(baos, format);
    SOAPMessage message = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, new ByteArrayInputStream(baos.toByteArray()), encoding).getSOAPMessage();
    assertEquals(encoding, message.getCharsetEncoding());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OMOutputFormat(org.apache.axiom.om.OMOutputFormat) SOAPMessage(org.apache.axiom.soap.SOAPMessage)

Example 7 with SOAPMessage

use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.

the class TestSetOMDocumentElement method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPMessage message = soapFactory.createSOAPMessage();
    OMElement envelope = soapFactory.getDefaultEnvelope();
    message.setOMDocumentElement(envelope);
    assertSame(envelope, message.getFirstOMChild());
}
Also used : OMElement(org.apache.axiom.om.OMElement) SOAPMessage(org.apache.axiom.soap.SOAPMessage)

Example 8 with SOAPMessage

use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.

the class TestSetOMDocumentElementNonSOAPEnvelope method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPMessage message = soapFactory.createSOAPMessage();
    OMElement element = soapFactory.createOMElement(new QName("test"));
    try {
        message.setOMDocumentElement(element);
        fail("Expected OMException");
    } catch (OMException ex) {
    // Expected
    }
}
Also used : QName(javax.xml.namespace.QName) OMElement(org.apache.axiom.om.OMElement) SOAPMessage(org.apache.axiom.soap.SOAPMessage) OMException(org.apache.axiom.om.OMException)

Example 9 with SOAPMessage

use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.

the class TestCreateSOAPModelBuilderFromDOMSource method runTest.

@Override
protected void runTest() throws Throwable {
    Document document = DOMImplementation.XERCES.parse(new InputSource(SOAPSampleSet.SIMPLE_FAULT.getMessage(spec).getUrl().toString()));
    SOAPMessage message = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, new DOMSource(document)).getSOAPMessage();
    assertAbout(xml()).that(xml(OMDocument.class, message)).ignoringWhitespaceInPrologAndEpilog().hasSameContentAs(document);
    assertThat(message.getSOAPEnvelope().getBody().getFault()).isNotNull();
}
Also used : InputSource(org.xml.sax.InputSource) DOMSource(javax.xml.transform.dom.DOMSource) Document(org.w3c.dom.Document) OMDocument(org.apache.axiom.om.OMDocument) SOAPMessage(org.apache.axiom.soap.SOAPMessage) OMDocument(org.apache.axiom.om.OMDocument)

Example 10 with SOAPMessage

use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.

the class SOAPFactoryImpl method createDefaultSOAPMessage.

@Override
public final SOAPMessage createDefaultSOAPMessage() {
    SOAPMessage message = createSOAPMessage();
    SOAPEnvelope env = createSOAPEnvelope();
    message.addChild(env);
    createSOAPBody(env);
    return message;
}
Also used : SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) SOAPMessage(org.apache.axiom.soap.SOAPMessage) AxiomSOAPMessage(org.apache.axiom.soap.impl.intf.AxiomSOAPMessage)

Aggregations

SOAPMessage (org.apache.axiom.soap.SOAPMessage)16 OMDocument (org.apache.axiom.om.OMDocument)4 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)4 Document (org.w3c.dom.Document)4 OMElement (org.apache.axiom.om.OMElement)3 SOAPSampleAdapter (org.apache.axiom.ts.soap.SOAPSampleAdapter)3 OMCloneOptions (org.apache.axiom.om.OMCloneOptions)2 OMInformationItem (org.apache.axiom.om.OMInformationItem)2 OMNode (org.apache.axiom.om.OMNode)2 WSSecHeader (org.apache.ws.security.message.WSSecHeader)2 InputSource (org.xml.sax.InputSource)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 Vector (java.util.Vector)1 QName (javax.xml.namespace.QName)1 SAXParserFactory (javax.xml.parsers.SAXParserFactory)1 DOMSource (javax.xml.transform.dom.DOMSource)1 SAXSource (javax.xml.transform.sax.SAXSource)1 OMComment (org.apache.axiom.om.OMComment)1