Package javax.xml.soap

Examples of javax.xml.soap.SOAPEnvelope


        SOAPMessage msg = msgContext.getMessage();
        if (msg == null)
        {
            return;
        }
        SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
        MuleSoapHeaders headers = new MuleSoapHeaders(env.getHeader());

        if (headers.getCorrelationId() != null)
        {
            msgContext.setProperty(MuleProperties.MULE_CORRELATION_ID_PROPERTY, headers.getCorrelationId());
        }
View Full Code Here


     */
    protected String getChildTextContent
        (SOAPMessage message, SOAPElement element, String prefix, String name)
        throws SOAPException {
        SOAPPart part = message.getSOAPPart();
        SOAPEnvelope envelope = part.getEnvelope();
        Name nm = envelope.createName(name, prefix, Consts.ASAP_NS);
        Iterator i = element.getChildElements(nm);
        if (!i.hasNext()) {
            return null;
        }
        SOAPElement child = (SOAPElement) i.next();
View Full Code Here

     *            Error in the SOAP message.
     */
    void fillResponseHeader(SOAPMessage reqMsg, SOAPMessage respMsg)
        throws SOAPException {
               
        SOAPEnvelope respEnv = respMsg.getSOAPPart().getEnvelope();
        SOAPHeader respHeader = respEnv.getHeader();
        SOAPHeaderElement respNode
            = respHeader.addHeaderElement
            (respEnv.createName(Consts.RESPONSE_HEADER, Consts.ASAP_PREFIX,
                    Consts.ASAP_NS));
       
        // Set the sender to me. This might differ from the value, given in
        // the request as ReceiverKey. We set it to the URL under which we were
        // called.
View Full Code Here

     *         error creating the SOAP nodes.
     */
    protected SOAPBodyElement createWfxmlResponseNode(SOAPMessage respMsg,
            String nodeName)
        throws SOAPException {
        SOAPEnvelope respEnv = respMsg.getSOAPPart().getEnvelope();
        SOAPBody respBody = respEnv.getBody();
        Name respName = respEnv.createName(nodeName, Consts.WFXML_PREFIX,
                Consts.WFXML_NS);
       
        SOAPBodyElement node = respBody.addBodyElement(respName);
        node.addNamespaceDeclaration(Consts.ASAP_PREFIX, Consts.ASAP_NS);
       
View Full Code Here

     *         error creating the SOAP nodes.
     */
    protected SOAPBodyElement createAsapResponseNode(SOAPMessage respMsg,
            String nodeName)
        throws SOAPException {
        SOAPEnvelope respEnv = respMsg.getSOAPPart().getEnvelope();
        SOAPBody respBody = respEnv.getBody();
        Name respName = respEnv.createName(nodeName, Consts.ASAP_PREFIX,
                Consts.ASAP_NS);

        SOAPBodyElement node = respBody.addBodyElement(respName);

        return node;
View Full Code Here

     *         Error in the SOAP message.
     */
    protected static void importSAXAsChild
        (SOAPMessage message, SOAPElement parent, SAXEventBuffer sax)
        throws SOAPException {
        SOAPEnvelope env = message.getSOAPPart().getEnvelope();

        HandlerStack hs = new HandlerStack (new SOAPBuilder(parent));
        hs.setContextData ("envelope", env);
        try {
            sax.emit(hs.contentHandler());
View Full Code Here

     * @throws SOAPException
     *         error setting the fault string.
     */
    static void setFault(SOAPMessage message, Throwable throwable)
        throws SOAPException {
        SOAPEnvelope respEnv = message.getSOAPPart().getEnvelope();

        SOAPFault fault = respEnv.getBody().addFault();
        fault.setFaultString(throwable.toString());
    }
View Full Code Here

     *         error setting the fault string.
     */
    static void setFault(SOAPMessage message, int errorCode,
            String errorMessage)
        throws SOAPException {
        SOAPEnvelope se = message.getSOAPPart().getEnvelope();

        // Work around for Bug 6581434 in JDK 1.6:
        // javax.xml.soap.Detail.addDetailEntry is broken
        /*
        SOAPFault fault = se.getBody().addFault();
        fault.setFaultString(errorMessage);
       
        Detail detail = fault.addDetail();
        detail.addNamespaceDeclaration(Consts.ASAP_PREFIX, Consts.ASAP_NS);
       
        Name codeName
            = se.createName("ErrorCode", Consts.ASAP_PREFIX, null);
        DetailEntry codeDetail = detail.addDetailEntry(codeName);
        codeDetail.addTextNode(Integer.toString(errorCode));

        Name messageName
            = se.createName("ErrorMessage", Consts.ASAP_PREFIX, null);
        DetailEntry messageDetail = detail.addDetailEntry(messageName);
        messageDetail.addTextNode(errorMessage);
        */
       
        final String SOAP_ENV = "http://schemas.xmlsoap.org/soap/envelope/";
        SOAPBody sb = se.getBody();
        SOAPBodyElement fault
            = sb.addBodyElement(se.createName("Fault", "SOAP_ENV", SOAP_ENV));
        fault.addChildElement("faultstring")
            .addTextNode(errorMessage);
        SOAPElement detail = fault.addChildElement("detail");
        detail.addChildElement
            ("ErrorCode", Consts.ASAP_PREFIX, Consts.ASAP_NS)
View Full Code Here

        boolean pass = true;
        try {
            MessageFactory factory = MessageFactory.newInstance();
            SOAPMessage message = factory.createMessage();
            SOAPPart soapPart = message.getSOAPPart();
            SOAPEnvelope envelope = soapPart.getEnvelope();
            SOAPBody body = envelope.getBody();

            Name name = envelope.createName("MyChild");
            SOAPElement se = body.addChildElement(name);
            assertNotNull(se);
            Iterator childs = body.getChildElements(name);
            int childElementCount = 0;
            for (int a = 0; childs.hasNext(); a++) {
View Full Code Here

    public void testSetElementQName() {
        try {
            MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
            SOAPMessage message = factory.createMessage();
            SOAPPart soapPart = message.getSOAPPart();
            SOAPEnvelope envelope = soapPart.getEnvelope();
            SOAPBody body = envelope.getBody();

            QName qname1 = new QName("http://fooURI.com", "fooElement", "foo");
            QName qname2 = new QName("http://foo2URI.com", "fooElement2", "foo2");
            SOAPElement se = body.addChildElement(qname1);
            QName qname = se.getElementQName();
View Full Code Here

TOP

Related Classes of javax.xml.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.