Package javax.xml.soap

Examples of javax.xml.soap.SOAPEnvelope


    Text t = (Text)n;
    assertTrue(!t.isComment());
    }

    public void testText3() throws Exception {
        SOAPEnvelope envelope = getSOAPEnvelope();
      SOAPElement se = envelope.addTextNode("<!-- This is a comment -->");
      Iterator iterator = se.getChildElements();
      Node n = null;
      while (iterator.hasNext()) {
            n = (Node)iterator.next();
            if (n instanceof Text)
View Full Code Here


        SOAPConnectionFactory scFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection con = scFactory.createConnection();

        MessageFactory factory = MessageFactory.newInstance();
        SOAPMessage message = factory.createMessage();
        SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
        return envelope;
    }
View Full Code Here

        super(name);
    }

    public void testSOAPEnvelope() throws Exception {
        // Create an example SOAP envelope
        SOAPEnvelope env = new org.apache.axis.message.SOAPEnvelope();
        SOAPHeader h = env.getHeader();
        SOAPBody b = env.getBody();
        Name heName = env.createName("localName", "prefix", "http://uri");
        SOAPHeaderElement he = h.addHeaderElement(heName);
        he.setActor("actor");

        // Serialize the SOAP envelope
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream os = new ObjectOutputStream(bos);
        os.writeObject(env);

        // Deserializet the SOAP envelope
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream is = new ObjectInputStream(bis);
        SOAPEnvelope env2 = (SOAPEnvelope)is.readObject();

        // Check that the SOAP envelope survived the round trip
        SOAPHeader h2 = env2.getHeader();
        SOAPHeaderElement he2 = (SOAPHeaderElement)h2.
            examineHeaderElements("actor").next();
        Name heName2 = he2.getElementName();
        assertEquals("Local name did not survive java ser+deser",
                     heName.getLocalName(), heName2.getLocalName());
View Full Code Here

    {
        try
        {
            LOG.debug( MSG.getMessage( Keys.RECEIVED_REQUEST ) );
            SOAPMessageContext soapMsgContext = (SOAPMessageContext) msgContext;
            SOAPEnvelope envelope = soapMsgContext.getMessage().getSOAPPart().getEnvelope();
            if ( LOG.isDebugEnabled() )
            {
                LOG.debug( "Received SOAP request: \n" + envelope );
            }
            org.apache.ws.util.soap.Body body = getSoapBody( envelope );
View Full Code Here

    public boolean handleResponse( MessageContext messageContext )
    {
        try
        {
            LOG.debug( MSG.getMessage( Keys.HANDLING_RESPONSE ) );
            SOAPEnvelope responseEnvelope = getResponseEnvelope( (SOAPMessageContext) messageContext );
            List responseBodyElems = (List) messageContext.getProperty( WSRF_RESPONSE_XMLOBJECT_LIST );
            LOG.debug( MSG.getMessage( Keys.FOUND_RESP_ELEMS, Integer.toString( responseBodyElems.size() ) ) );
            if ( responseBodyElems != null )
            {
                SOAPBody responseBody = responseEnvelope.getBody();
                for ( int i = 0; i < responseBodyElems.size(); i++ )
                {
                    XmlObject responseBodyElem = (XmlObject) responseBodyElems.get( i );
                    SOAPBodyElement[] soapBodyElements = createSOAPBodyElements( responseBodyElem );
                    for ( int j = 0; j < soapBodyElements.length; j++ )
View Full Code Here

                     * System.out.println("-----------soap---------");
                     * msg.writeTo(System.out);
                     * System.out.println("-----------soap---------");
                     */

                    SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
                    SOAPBody body = env.getBody();
                    Iterator it = body.getChildElements();
                    while (it.hasNext()) {
                       
                        Object elem = it.next();
                        if (elem instanceof SOAPElement) {

                            Iterator it2 = ((SOAPElement)elem).getChildElements();
                            while (it2.hasNext()) {
                                Object elem2 = it2.next();
                                if (elem2 instanceof SOAPElement) {
                                    String value = ((SOAPElement)elem2).getValue();
                                    String name = ((SOAPElement)elem2).getLocalName();
                                    if (name.indexOf("arg0") >= 0 && value.equalsIgnoreCase("11")) {
                                        value = "12";
                                        ((SOAPElement)elem2).setValue(value);
                                    }
                                    if (name.indexOf("arg1") >= 0 && value.equalsIgnoreCase("21")) {
                                        value = "22";
                                        ((SOAPElement)elem2).setValue(value);
                                    }
                                }
                            }
                        }
                    }
                    msg.saveChanges();          
                } else {
                    SOAPMessage msg = ctx.getMessage();
                    /*
                     * System.out.println("-----------soap---------");
                     * msg.writeTo(System.out);
                     * System.out.println("-----------soap---------");
                     */

                    SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
                    SOAPBody body = env.getBody();
                    Iterator it = body.getChildElements();
                    while (it.hasNext()) {
                       
                        Object elem = it.next();
                        if (elem instanceof SOAPElement) {
View Full Code Here

                super.handleFault(ctx);
                try {
                    Boolean outbound = (Boolean)
                        ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
                    if (!outbound) {
                        SOAPEnvelope env =
                            ctx.getMessage().getSOAPPart().getEnvelope();
                        assertTrue("expected SOAPFault in SAAJ model",
                                   env.getBody().hasFault());
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    fail(e.toString());
                }
View Full Code Here

        if ( keyName == null )
        {
            throw new IllegalArgumentException( MSG.getMessage( Keys.NULL_RESOURCEKEY_QNAME ) );
        }

        SOAPEnvelope env = msg.getSOAPPart().getEnvelope();
        SOAPHeader header = env.getHeader();

        if ( header == null )
        {
            return null;
        }
View Full Code Here

   {
      List children;

      children = new ArrayList(  );

      SOAPEnvelope soap_env = (SOAPEnvelope) soap_elem;
      SOAPHeader   header = null;
      SOAPBody     body   = null;

      try
      {
         header    = soap_env.getHeader(  );
         body      = soap_env.getBody(  );
      }
      catch ( SOAPException soape )
      {
         //LOG.warn( ResourceKeys.MSG.getMsg( ResourceKeys.EX_FAILED_TO_GET_SOAP_BODY, soape ) );
      }
View Full Code Here

            SOAPMessage msg = ctx.getMessage();
            if (isServerSideHandler()) {
                if (outbound) {
                    QName qname = new QName("http://cxf.apache.org/mu", "MU");
                    SOAPPart soapPart = msg.getSOAPPart();
                    SOAPEnvelope envelope = soapPart.getEnvelope();
                    SOAPHeader header = envelope.getHeader();
                    if (header == null) {
                        header = envelope.addHeader();
                    }

                    SOAPHeaderElement headerElement = header.addHeaderElement(qname);

                    // QName soapMustUnderstand = new QName("http://schemas.xmlsoap.org/soap/envelope/",
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.