Package org.apache.ws.commons.soap

Examples of org.apache.ws.commons.soap.SOAPEnvelope


                    > -1) {
                soapNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
            }

            StAXBuilder builder = new StAXSOAPModelBuilder(reader, soapNamespaceURI);
            SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();

            msgContext.setEnvelope(envelope);

            if (envelope.getBody().hasFault()) {
                engine.receiveFault(msgContext);
            } else {
                engine.receive(msgContext);
            }
        } catch (Exception e) {
View Full Code Here


    public void testConvertToDOOM() throws Exception {
        String xml = "<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header /><soapenv:Body><ns1:createAccountRequest xmlns:ns1=\"http://www.wso2.com/types\"><ns1:clientinfo><name xmlns=\"\">bob</name><ssn xmlns=\"\">123456789</ssn></ns1:clientinfo><password xmlns=\"\">passwd</password></ns1:createAccountRequest></soapenv:Body></soapenv:Envelope>";

        StAXSOAPModelBuilder builder2 = new StAXSOAPModelBuilder(getTestEnvelope().getXMLStreamReader(), DOOMAbstractFactory.getSOAP11Factory(), SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        SOAPEnvelope envelope = builder2.getSOAPEnvelope();
        envelope.build();
       
        StringWriter writer = new StringWriter();
        envelope.serialize(writer);
        writer.flush();
       
        XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(writer.toString()));
        PrintEvents.print(r);
       
View Full Code Here

        ADBSOAPModelBuilder builder = new ADBSOAPModelBuilder(request
                .getPullParser(CreateAccountRequest.MY_QNAME),
                OMAbstractFactory.getSOAP11Factory());

        SOAPEnvelope env = builder.getEnvelope();

        StAXSOAPModelBuilder builder2 = new StAXSOAPModelBuilder(getTestEnvelope().getXMLStreamReaderWithoutCaching(), DOOMAbstractFactory.getSOAP11Factory(), SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
        SOAPEnvelope envelope = builder2.getSOAPEnvelope();
        envelope.build();

        StringWriter writer = new StringWriter();
        envelope.serialize(writer);
        writer.flush();

        XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(writer.toString()));
        PrintEvents.print(r);
View Full Code Here

     * @throws AxisFault
     */
    protected MessageContext prepareTheSOAPEnvelope(OMElement toSend) throws AxisFault {
        MessageContext msgctx = new MessageContext();
        msgctx.setConfigurationContext(serviceContext.getConfigurationContext());
        SOAPEnvelope envelope = createDefaultSOAPEnvelope();

        if (toSend != null) {
            envelope.getBody().addChild(toSend);
        }

        msgctx.setEnvelope(envelope);

        return msgctx;
View Full Code Here

            // Send the SOAP Message and receive a response
            MessageContext response = send(msgctx, clientOptions.getTransportIn());

            // check for a fault and return the result
            SOAPEnvelope resenvelope = response.getEnvelope();

            if (resenvelope.getBody().hasFault()) {
                SOAPFault soapFault = resenvelope.getBody().getFault();
                Exception ex = soapFault.getException();

                if (clientOptions.isExceptionToBeThrownOnSOAPFault()) {

                    // does the SOAPFault has a detail element for Excpetion
View Full Code Here

        responseMessageContext.setServiceGroupContext(msgctx.getServiceGroupContext());

        // If request is REST we assume the responseMessageContext is REST, so set the variable
        responseMessageContext.setDoingREST(msgctx.isDoingREST());

        SOAPEnvelope resenvelope = TransportUtils.createSOAPMessage(responseMessageContext,
                msgctx.getEnvelope().getNamespace().getName());

        if (resenvelope != null) {
            responseMessageContext.setEnvelope(resenvelope);
            engine = new AxisEngine(msgctx.getConfigurationContext());
View Full Code Here

        log.debug(Messages.getMessage("enginestarted"));
        this.engineContext = engineContext;
    }

    private void checkMustUnderstand(MessageContext msgContext) throws AxisFault {
        SOAPEnvelope se = msgContext.getEnvelope();
        if (se.getHeader() == null) {
            return;
        }
        Iterator hbs = se.getHeader().examineAllHeaderBlocks();
        while (hbs.hasNext()) {
            SOAPHeaderBlock hb = (SOAPHeaderBlock) hbs.next();
            // if this header block has been processed or mustUnderstand isn't
            // turned on then its cool
            if (hb.isProcessed() || !hb.getMustUnderstand()) {
                continue;
            }
            // if this header block is not targetted to me then its not my
            // problem. Currently this code only supports the "next" role; we
            // need to fix this to allow the engine/service to be in one or more
            // additional roles and then to check that any headers targetted for
            // that role too have been dealt with.

            String role = hb.getRole();

            String prefix = se.getNamespace().getPrefix();

            if (!msgContext.isSOAP11()) {

                // if must understand and soap 1.2 the Role should be NEXT , if it is null we considerr
                // it to be NEXT
View Full Code Here

                // send the request and wait for reponse
                MessageContext response = send(msgctx, clientOptions.getTransportIn());

                // call the callback
                SOAPEnvelope resenvelope = response.getEnvelope();
                SOAPBody body = resenvelope.getBody();

                if (body.hasFault()) {
                    Exception ex = body.getFault().getException();

                    if (ex != null) {
View Full Code Here

        faultContext.setOperationContext(processingContext.getOperationContext());
        faultContext.setProcessingFault(true);
        faultContext.setServerSide(true);

        SOAPEnvelope envelope;

        faultContext.setProperty(Constants.OUT_TRANSPORT_INFO,
                processingContext.getProperty(Constants.OUT_TRANSPORT_INFO));

        if (processingContext.isSOAP11()) {
            envelope = OMAbstractFactory.getSOAP11Factory().getDefaultFaultEnvelope();
        } else {

            // Following will make SOAP 1.2 as the default, too.
            envelope = OMAbstractFactory.getSOAP12Factory().getDefaultFaultEnvelope();
        }

        extractFaultInformationFromMessageContext(processingContext, envelope.getBody().getFault(),
                e);
        faultContext.setEnvelope(envelope);
        faultContext.setProperty(Constants.OUT_TRANSPORT_INFO,
                processingContext.getProperty(Constants.OUT_TRANSPORT_INFO));
View Full Code Here

        MessageContext msgctx = prepareTheSOAPEnvelope(toSend);

        this.lastResponseMsgCtx = super.invokeBlocking(opDesc, msgctx);

        SOAPEnvelope resEnvelope = lastResponseMsgCtx.getEnvelope();

        return resEnvelope.getBody().getFirstElement();
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.soap.SOAPEnvelope

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.