Package org.apache.axiom.soap

Examples of org.apache.axiom.soap.SOAPFactory


    }

    public void runTest(String value, String expected)
            throws XMLStreamException, FactoryConfigurationError, IOException {

        SOAPFactory factory = OMAbstractFactory.getSOAP12Factory();
        SOAPEnvelope envelope = factory.getDefaultEnvelope();
        String ns = "http://testuri.org";
        OMNamespace namespace = factory.createOMNamespace(ns, "tst");

        String ln = "Child";

        OMElement bodyChild = factory.createOMElement(ln, namespace);
        bodyChild.addChild(factory.createOMText(value));

        envelope.getBody().addChild(bodyChild);


        ByteArrayOutputStream byteOutStr = new ByteArrayOutputStream();
View Full Code Here


    }

    protected void runTest() throws Throwable {
        // Prepare the message. Note that we do this programmatically to make sure that the message
        // doesn't contain any unwanted whitespace.
        SOAPFactory factory = spec.getFactory(metaFactory);
        SOAPEnvelope orgEnvelope = factory.getDefaultEnvelope();
        orgEnvelope.getBody().addChild(soapFactory.createOMElement(qname.getLocalPart(), qname.getNamespaceURI(), qname.getPrefix()));
        String message = orgEnvelope.toString();
       
        SOAPEnvelope envelope = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, new StringReader(message)).getSOAPEnvelope();
        assertEquals(qname.getLocalPart(), envelope.getSOAPBodyFirstElementLocalName());
View Full Code Here

    }

    public void submitPurchaseOrderTest()
            throws Exception {
        SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = omFactory.getDefaultEnvelope();
        OMXMLParserWrapper builder = OMXMLBuilderFactory.createOMBuilder(
                omFactory, new InputStreamReader(
                                new ByteArrayInputStream(xmlText2.getBytes())));
        env.getBody().addChild(builder.getDocumentElement());
View Full Code Here

        assertTrue("Conversion failed", xml.indexOf("</RequestSecurityToken>") != -1);
    }

    public void testConvert1() {
        SOAPFactory fac = OMAbstractFactory.getSOAP11Factory();
        SOAPEnvelope env = fac.getDefaultEnvelope();
        fac.createOMElement(new QName("http://test.org", "Test"), env.getBody());
        env.build();

        SOAPModelBuilder doomBuilder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
                OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM),
                env.getXMLStreamReader());
View Full Code Here

        doomEnv.build();
    }

    public void testAddChild() {
        SOAPFactory fac = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getSOAP11Factory();
        SOAPEnvelope env = fac.getDefaultEnvelope();
        fac.createOMElement(new QName("http://test.org", "Test"), env.getBody());
        env.build();

        SOAPFactory llomFac = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM).getSOAP11Factory();
        OMElement elem = llomFac.createOMElement("newDomElement", null);

        OMElement firstElement = env.getBody().getFirstElement();
        firstElement.addChild(elem);

        assertTrue("New DOM child missing",
View Full Code Here

                    }
                }

                // Check the namespace and find SOAP version and factory
                String nsURI = null;
                SOAPFactory factory;
                if (env.getNamespace().getNamespaceURI().equals(
                        SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
                    nsURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
                    factory = DOOMAbstractFactory.getSOAP11Factory();
                } else {
                    nsURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
                    factory = DOOMAbstractFactory.getSOAP12Factory();
                }

                StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(
                        env.getXMLStreamReader(), factory, nsURI);
                SOAPEnvelope envelope = (stAXSOAPModelBuilder)
                        .getSOAPEnvelope();
                ((OMNode) envelope.getParent()).build();
               
                //Set the processed flag of the processed headers
                SOAPHeader header = envelope.getHeader();
                for (Iterator iter = processedHeaderQNames.iterator(); iter
                        .hasNext();) {
                    QName name = (QName) iter.next();
                    Iterator omKids = header.getChildrenWithName(name);
                    if(omKids.hasNext()) {
                        ((SOAPHeaderBlock)omKids.next()).setProcessed();
                    }
                }
               
                Element envElem = (Element) envelope;
                return envElem.getOwnerDocument();
            } else {
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                env.build();
                env.serialize(baos);
                ByteArrayInputStream bais = new ByteArrayInputStream(baos
                        .toByteArray());
                DocumentBuilderFactory factory = DocumentBuilderFactory
                        .newInstance();
                factory.setNamespaceAware(true);
                return factory.newDocumentBuilder().parse(bais);
            }
    } catch (Exception e) {
      throw new WSSecurityException(
          "Error in converting SOAP Envelope to Document", e);
    }
View Full Code Here

    }

    @Test
    public void testAxiomResponse() throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        SOAPFactory axiomFactory = OMAbstractFactory.getSOAP11Factory();
        AxiomSoapMessage request = new AxiomSoapMessage(axiomFactory);
        transformer.transform(new StringSource(REQUEST), request.getPayloadResult());
        AxiomSoapMessageFactory soapMessageFactory = new AxiomSoapMessageFactory();
        soapMessageFactory.afterPropertiesSet();
        MessageContext context = new DefaultMessageContext(request, soapMessageFactory);
View Full Code Here

    }

    @Test
    public void testAxiomNoResponse() throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        SOAPFactory axiomFactory = OMAbstractFactory.getSOAP11Factory();
        AxiomSoapMessage request = new AxiomSoapMessage(axiomFactory);
        transformer.transform(new StringSource(REQUEST), request.getPayloadResult());
        AxiomSoapMessageFactory soapMessageFactory = new AxiomSoapMessageFactory();
        soapMessageFactory.afterPropertiesSet();
        MessageContext context = new DefaultMessageContext(request, soapMessageFactory);
View Full Code Here

    }

    @Test
    public void testAxiomResponseNoPayloadCaching() throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        SOAPFactory axiomFactory = OMAbstractFactory.getSOAP11Factory();
        AxiomSoapMessage request = new AxiomSoapMessage(axiomFactory);
        transformer.transform(new StringSource(REQUEST), request.getPayloadResult());
        AxiomSoapMessageFactory soapMessageFactory = new AxiomSoapMessageFactory();
        soapMessageFactory.setPayloadCaching(false);
        soapMessageFactory.afterPropertiesSet();
View Full Code Here

    }

    @Test
    public void testAxiomNoResponseNoPayloadCaching() throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        SOAPFactory axiomFactory = OMAbstractFactory.getSOAP11Factory();
        AxiomSoapMessage request = new AxiomSoapMessage(axiomFactory);
        transformer.transform(new StringSource(REQUEST), request.getPayloadResult());
        AxiomSoapMessageFactory soapMessageFactory = new AxiomSoapMessageFactory();
        soapMessageFactory.setPayloadCaching(false);
        soapMessageFactory.afterPropertiesSet();
View Full Code Here

TOP

Related Classes of org.apache.axiom.soap.SOAPFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.