Package org.xmlsoap.schemas.soap.envelope

Examples of org.xmlsoap.schemas.soap.envelope.Envelope


    }

    public static XmlObject sendRequest(XmlObject requestDoc, String action, EndpointReference epr)
    {
        EnvelopeDocument requestEnvelopeDoc = createEnvelope();
        Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
        addAddressingHeaders(requestEnvelope.getHeader(), action, epr);
        XmlBeanUtils.addChildElement(requestEnvelope.getBody(), requestDoc);
        try
        {
            URL endpointURL = new URL(epr.getAddress());
            System.out.println("Sending Request to " + endpointURL.toString());
            URI actionURI = new URI(action);
            String response = SoapClient.sendRequest(endpointURL, requestEnvelopeDoc.newInputStream(), actionURI);
            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse(response);
            Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements(responseEnvelope.getBody());
            System.out.println("Recieved response from " + endpointURL.toString());
            if (responseBodyElems.length == 0)
            {
                return null;
            }
View Full Code Here


    }

    public static XmlObject sendRequest(XmlObject requestDoc, String action, String address)
    {
        EnvelopeDocument requestEnvelopeDoc = createEnvelope();
        Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
        addAddressingHeaders(requestEnvelope.getHeader(), action, address);
        XmlBeanUtils.addChildElement(requestEnvelope.getBody(), requestDoc);
        try
        {
            System.out.println("Sending request to: " + address);
            URL endpointURL = new URL(address);
            URI actionURI = new URI(action);
            String response = SoapClient.sendRequest(endpointURL, requestEnvelopeDoc.newInputStream(), actionURI);
            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse(response);
            Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements(responseEnvelope.getBody());
            if (responseBodyElems.length == 0)
            {
                return null;
            }
            else
View Full Code Here


    protected EnvelopeDocument createEnvelope()
    {
        EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
        Envelope envelope = envelopeDoc.addNewEnvelope();
        envelope.addNewHeader();
        envelope.addNewBody();
        return envelopeDoc;
    }
View Full Code Here

    }

    public XmlObject sendRequest(XmlObject requestDoc, String action, URL url)
    {
        EnvelopeDocument requestEnvelopeDoc = createEnvelope();
        Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
        XmlBeanUtils.addChildElement( requestEnvelope.getBody(), requestDoc );
        try
        {
            URI actionURI = new URI( action );
            if ( ResourceStub.DEBUG ) { System.out.println( "Sending request: \n" + requestEnvelopeDoc ); }
           
           
            setChanged();
            String response = SoapClient.sendRequest( url, requestEnvelopeDoc.newInputStream(), actionURI );
            XmlOptions xmlOpts = new XmlOptions().setSaveOuter();
            xmlOpts.setSavePrettyPrint();           
            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse( response );
        notifyObservers(new WcmMessage(requestDoc.xmlText(xmlOpts), responseEnvelopeDoc.xmlText(xmlOpts)));

            if ( ResourceStub.DEBUG ) { System.out.println( "Received response: \n" + responseEnvelopeDoc ); }
            Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( responseEnvelope.getBody() );
            if ( responseBodyElems.length == 0 )
            {
                return null;
            }
            else
View Full Code Here

            URI actionURI = new URI( action );
            if ( ResourceStub.DEBUG ) { System.out.println( "Sending request: \n" + requestEnvelope ); }
            String response = SoapClient.sendRequest( url, requestEnvelope.newInputStream(), actionURI );
            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse( response );
            if ( ResourceStub.DEBUG ) { System.out.println( "Received response: \n" + responseEnvelopeDoc ); }
            Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( responseEnvelope.getBody() );
            if ( responseBodyElems.length == 0 )
            {
                return null;
            }
            else
View Full Code Here

    }

    private EnvelopeDocument createEnvelope()
    {
        EnvelopeDocument envelopeDoc = EnvelopeDocument.Factory.newInstance();
        Envelope envelope = envelopeDoc.addNewEnvelope();
        envelope.addNewHeader();
        envelope.addNewBody();
        return envelopeDoc;
    }
View Full Code Here

    }

    public XmlObject sendRequest( XmlObject requestDoc, String action ,String type )
    {
        EnvelopeDocument requestEnvelopeDoc = createEnvelope();
        Envelope requestEnvelope = requestEnvelopeDoc.getEnvelope();
        addAddressingHeaders( requestEnvelope.getHeader(), action );
        XmlBeanUtils.addChildElement( requestEnvelope.getBody(), requestDoc );
        try
        {
            URL endpointURL = new URL( m_epr.getAddress() );
            URI actionURI = new URI( action );
            if ( DEBUG ) { System.out.println( "Sending request: \n" + requestEnvelopeDoc ); }
            String response = SoapClient.sendRequest( endpointURL, requestEnvelopeDoc.newInputStream(), actionURI );           
            setChanged();
            XmlOptions xmlOpts = new XmlOptions().setSaveOuter();
            xmlOpts.setSavePrettyPrint();
        notifyObservers(new WcmMessage(requestDoc.xmlText(xmlOpts), response,type));           
            EnvelopeDocument responseEnvelopeDoc = (EnvelopeDocument) XmlObject.Factory.parse( response );
            if (DEBUG ) { System.out.println( "Received response: \n" + responseEnvelopeDoc ); }
            Envelope responseEnvelope = responseEnvelopeDoc.getEnvelope();
            XmlObject[] responseBodyElems = XmlBeanUtils.getChildElements( responseEnvelope.getBody() );
            if ( responseBodyElems.length == 0 )
            {
                return null;
            }
            else
View Full Code Here

            content = createFaultFromException(exception);
        } else {
            content = createBodyContentFromObject(inputObject, soapAction);
        }
        body.getAny().add(content);
        Envelope envelope = new Envelope();
        envelope.setBody(body);
        JAXBElement<Envelope> envelopeEl = new ObjectFactory().createEnvelope(envelope);
        super.marshal(exchange, envelopeEl, stream);
    }
View Full Code Here

    public Object unmarshal(Exchange exchange, InputStream stream) throws IOException {
        Object rootObject = JAXBIntrospector.getValue(super.unmarshal(exchange, stream));
        if (rootObject.getClass() != Envelope.class) {
            throw new RuntimeCamelException("Expected Soap Envelope but got " + rootObject.getClass());
        }
        Envelope envelope = (Envelope) rootObject;
        Object payloadEl = envelope.getBody().getAny().get(0);
        Object payload = JAXBIntrospector.getValue(payloadEl);
        if (payload instanceof Fault) {
            Exception exception = createExceptionFromFault((Fault) payload);
            exchange.setException(exception);
            return null;
View Full Code Here

            body.getAny().add(elem);
        }
        for (JAXBElement<?> elem : headerContent) {
            header.getAny().add(elem);
        }
        Envelope envelope = new Envelope();
        if (headerContent.size() > 0) {
            envelope.setHeader(header);
        }
        envelope.setBody(body);
        JAXBElement<Envelope> envelopeEl = new ObjectFactory().createEnvelope(envelope);
        super.marshal(exchange, envelopeEl, stream);
    }
View Full Code Here

TOP

Related Classes of org.xmlsoap.schemas.soap.envelope.Envelope

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.