Package org.apache.axiom.soap.impl.builder

Examples of org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder


            } else if (o instanceof String) {
                String soap = (String) o;
                try {
                    XMLStreamReader xmlReader =
                            StAXUtils.createXMLStreamReader(new ByteArrayInputStream(soap.getBytes()));
                    StAXBuilder builder = new StAXSOAPModelBuilder(xmlReader);
                    OMElement elem = builder.getDocumentElement();
                    elem.build();
                    if (elem instanceof SOAPEnvelope) {
                        SOAPEnvelope soapEnvelope = (SOAPEnvelope) elem;
                        String soapNamespace = soapEnvelope.getNamespace().getNamespaceURI();
                        if (soapEnvelope.getHeader() == null) {
View Full Code Here


                SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI)) {
            soapFactory = OMAbstractFactory.getSOAP12Factory();
        } else {
            soapFactory = OMAbstractFactory.getSOAP11Factory();
        }
        StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inlineElement.getXMLStreamReader(),
                soapFactory, inlineElement.getQName().getNamespaceURI());
        return builder.getSOAPEnvelope();
    }
View Full Code Here

        }
       
        SOAPEnvelope envelope;
        if (parser != null) {
            if (contentIsEnvelope) {
                envelope = new StAXSOAPModelBuilder(parser).getSOAPEnvelope();
            } else {
                envelope = OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
               
                // TODO: don't know why this is here, but without it some unit tests fail...
                OMDocument omDoc = OMAbstractFactory.getSOAP11Factory().createOMDocument();
View Full Code Here

            } catch (IOException e) {
                handleException("I/O error while reading temporary file", e);
                return null;
            }
            if (expectedOutput == ResultBuilderFactory.Output.SOAP_ENVELOPE) {
                return new StAXSOAPModelBuilder(reader).getSOAPEnvelope();
            } else {
                return new StAXOMBuilder(reader).getDocumentElement();
            }
        }
    }
View Full Code Here

     * @throws Exception
     */
    protected SOAPEnvelope createEnvelope(InputStream is) throws Exception {
        XMLStreamReader parser =
            XMLInputFactory.newInstance().createXMLStreamReader(is);
        OMXMLParserWrapper builder = new StAXSOAPModelBuilder(omMetaFactory, parser, null);
        SOAPEnvelope sourceEnv = (SOAPEnvelope) builder.getDocumentElement();
        return sourceEnv;
    }
View Full Code Here

        }
        if (lookAheadAttempted) {
            return lookAheadSuccessful;
        }
        lookAheadAttempted = true;
        StAXSOAPModelBuilder soapBuilder = (StAXSOAPModelBuilder) this.builder;
        if (soapBuilder != null &&
            soapBuilder.isCache() &&
            !soapBuilder.isCompleted() &&
            !soapBuilder.isClosed()) {
            lookAheadSuccessful = soapBuilder.lookahead();
            if (lookAheadSuccessful) {
                this.lookAheadLocalName = soapBuilder.getName();
                String ns = soapBuilder.getNamespace();
                if (ns == null) {
                    lookAheadNS = null;
                } else {
                    String prefix = soapBuilder.getPrefix();
                    lookAheadNS = factory.createOMNamespace(ns, prefix == null ? "" : prefix);
                }
            }
        }
        return lookAheadSuccessful;
View Full Code Here

        super(metaFactory, spec);
    }

    protected void runTest() throws Throwable {
        SOAPEnvelope envelope = getTestMessage("soapmessage.xml");
        StAXSOAPModelBuilder builder = (StAXSOAPModelBuilder)envelope.getBuilder();
       
        // Do a fault check.  This is normally done in the engine (Axiom) and should
        // not cause inteference with the custom builder processing
        envelope.getBody().hasFault();

        // Do the registration here...this simulates when it could occure in the engine
        // (After the fault check and during phase processing...probably dispatch phase)
        builder.registerCustomBuilderForPayload(new ByteArrayCustomBuilder("utf-8"));
       
        OMElement bodyElement = envelope.getBody().getFirstElement();
        assertTrue(bodyElement instanceof OMSourcedElement);
    }
View Full Code Here

    }

    protected void setUp() throws Exception {
        XMLStreamReader xmlStreamReader = StAXUtils.
                createXMLStreamReader(AbstractTestCase.getTestResource(TestConstants.SOAP_SOAPMESSAGE1));
        builder = new StAXSOAPModelBuilder(metaFactory, xmlStreamReader, null);
        envelope = (SOAPEnvelope) builder.getDocumentElement();
    }
View Full Code Here

                } 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();
               
View Full Code Here

                    }
               
                }
                XMLStreamReader reader = ((OMElement) doc.getDocumentElement())
                        .getXMLStreamReader();
                StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(
                        reader, null);
                SOAPEnvelope envelope = stAXSOAPModelBuilder.getSOAPEnvelope();
               
                //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();
                    }
                }
               
                envelope.build();
               
                return envelope;

            } catch (FactoryConfigurationError e) {
                throw new WSSecurityException(e.getMessage());
            }
        } else {
            try {
                ByteArrayOutputStream os = new ByteArrayOutputStream();
                XMLUtils.outputDOM(doc.getDocumentElement(), os, true);
                ByteArrayInputStream bais =  new ByteArrayInputStream(os.toByteArray());

                StAXSOAPModelBuilder stAXSOAPModelBuilder = new StAXSOAPModelBuilder(XMLInputFactory.newInstance().createXMLStreamReader(bais), null);
                return stAXSOAPModelBuilder.getSOAPEnvelope();
            } catch (Exception e) {
                throw new WSSecurityException(e.getMessage());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder

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.