Package org.apache.axis

Examples of org.apache.axis.Message


       AxisEngine engine = new AxisServer();
       engine.init();
       MessageContext msgContext = new MessageContext(engine);
       msgContext.setHighFidelity(true);
        String request = header + request1 + footer;
       Message message = new Message(request);
       message.setMessageContext(msgContext);

       // Now completely round trip it
       SOAPEnvelope envelope = message.getSOAPEnvelope();
       envelope.addHeader(new SOAPHeaderElement("foo1", "foo1"));
       envelope.addHeader(new SOAPHeaderElement("foo2", "foo2"));
       envelope.addHeader(new SOAPHeaderElement("foo3", "foo3"));
       String result = message.getSOAPPartAsString();

       assertTrue(result.indexOf("foo1")!=-1);
       assertTrue(result.indexOf("foo2")!=-1);
       assertTrue(result.indexOf("foo3")!=-1);

       Message message2 = new Message(result);
       message2.setMessageContext(msgContext);
       SOAPEnvelope envelope2 = message2.getSOAPEnvelope();
       String result2 = message2.getSOAPPartAsString();

       assertTrue(result2.indexOf("foo1")!=-1);
       assertTrue(result2.indexOf("foo2")!=-1);
       assertTrue(result2.indexOf("foo3")!=-1);
    }
View Full Code Here


       AxisEngine engine = new AxisServer();
       engine.init();
       MessageContext msgContext = new MessageContext(engine);
       msgContext.setHighFidelity(true);
       String request = header + request2 + footer;
       Message message = new Message(request);
       message.setMessageContext(msgContext);
       SOAPEnvelope envelope = message.getSOAPEnvelope();
       SOAPBodyElement bodyElement = (SOAPBodyElement)envelope.getBodyElements().elementAt(0);
       MessageElement me = (MessageElement) bodyElement.getChildren().get(0);
       org.xml.sax.Attributes atts = me.getCompleteAttributes();
       assertTrue(atts.getLength()==2);
    }
View Full Code Here

       
        MessageContext msgContext = context.getMessageContext();

        // Figure out if we should be looking for out params or in params
        // (i.e. is this message a response?)
        Message msg = msgContext.getCurrentMessage();
        boolean isResponse = ((msg != null) &&
                              Message.RESPONSE.equals(msg.getMessageType()));

        // We're going to need this below, so create one.
        RPCHandler rpcHandler = new RPCHandler(this, isResponse);

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

        deserialize(data, expected, false);
    }
    protected void deserialize(String data, Object expected, boolean tryConvert)
       throws Exception
    {
       Message message = new Message(header + data + footer);
       message.setMessageContext(new MessageContext(server));

       SOAPEnvelope envelope = (SOAPEnvelope)message.getSOAPEnvelope();
       assertNotNull("SOAP envelope should not be null", envelope);

       RPCElement body = (RPCElement)envelope.getFirstBody();
       assertNotNull("SOAP body should not be null", body);
View Full Code Here

                    // It's possible that we haven't yet parsed the
                    // message at this point.  This is a kludge to
                    // make sure we have.  There probably wants to be
                    // some kind of declarative "parse point" on the handler
                    // chain instead....
                    Message rm = msgContext.getRequestMessage();
                    rm.getSOAPEnvelope().getFirstBody();
                    h = msgContext.getService();
                    if (h == null)
                        throw new AxisFault("Server.NoService",
                                            Messages.getMessage("noService05",
                                                                 "" + msgContext.getTargetService()),
View Full Code Here

                    // It's possible that we haven't yet parsed the
                    // message at this point.  This is a kludge to
                    // make sure we have.  There probably wants to be
                    // some kind of declarative "parse point" on the handler
                    // chain instead....
                    Message rm = msgContext.getRequestMessage();
                    if (rm != null) {
                        rm.getSOAPEnvelope().getFirstBody();
                        h = msgContext.getService();
                    }
                    if (h == null) {
                        throw new AxisFault(Constants.QNAME_NO_SERVICE_FAULT_CODE,
                                            Messages.getMessage("noService05",
View Full Code Here

            if ( !(params[0] instanceof SOAPEnvelope) )
                for ( i = 0 ; i < params.length ; i++ )
                    env.addBodyElement( (SOAPBodyElement) params[i] );

            Message msg = new Message( env );
            setRequestMessage(msg);

            invoke();

            msg = msgContext.getResponseMessage();
            if (msg == null) {
              if (FAULT_ON_NO_RESPONSE) {
                throw new AxisFault(Messages.getMessage("nullResponse00"));
              } else {
                return null;
              }
            }

            env = msg.getSOAPEnvelope();
            return( env.getBodyElements() );
        }


        if ( operationName == null )
View Full Code Here

     * @exception AxisFault
     */
    public SOAPEnvelope invoke(SOAPEnvelope env)
                                  throws java.rmi.RemoteException {
        try {
            Message msg = null ;

            msg = new Message( env );
            setRequestMessage( msg );
            invoke();
            msg = msgContext.getResponseMessage();
            if (msg == null) {
              if (this.FAULT_ON_NO_RESPONSE) {
                throw new AxisFault(Messages.getMessage("nullResponse00"));
              } else {
                return null;
              }
            }
            return( msg.getSOAPEnvelope() );
        }
        catch( Exception exp ) {
            if ( exp instanceof AxisFault ) throw (AxisFault) exp ;

            entLog.info(Messages.getMessage("toAxisFault00"), exp);
View Full Code Here

        }

        SOAPEnvelope         reqEnv =
                new SOAPEnvelope(msgContext.getSOAPConstants());
        SOAPEnvelope         resEnv = null ;
        Message              reqMsg = new Message( reqEnv );
        Message              resMsg = null ;
        Vector               resArgs = null ;
        Object               result = null ;

        // Clear the output params
        outParams = new HashMap();
        outParamsList = new ArrayList();

        // Set both the envelope and the RPCElement encoding styles
        try {
            body.setEncodingStyle(getEncodingStyle());

            setRequestMessage(reqMsg);

            reqEnv.addBodyElement(body);
            reqEnv.setMessageType(Message.REQUEST);

            invoke();
        } catch (Exception e) {
            entLog.info(Messages.getMessage("toAxisFault00"), e);
            throw AxisFault.makeFault(e);
        }

        resMsg = msgContext.getResponseMessage();

        if (resMsg == null) {
          if (FAULT_ON_NO_RESPONSE) {
            throw new AxisFault(Messages.getMessage("nullResponse00"));
          } else {
            return null;
          }
        }

        resEnv = resMsg.getSOAPEnvelope();
        SOAPBodyElement bodyEl = resEnv.getFirstBody();
        if (bodyEl instanceof RPCElement) {
            try {
                resArgs = ((RPCElement) bodyEl).getParams();
            } catch (Exception e) {
View Full Code Here

    public void invoke() throws AxisFault {
        if (log.isDebugEnabled()) {
            log.debug("Enter: Call::invoke()");
        }

        Message      reqMsg  = null ;
        SOAPEnvelope reqEnv  = null ;

        msgContext.reset();
        msgContext.setResponseMessage(null);
        msgContext.setProperty( MessageContext.CALL, this );
        msgContext.setProperty( WSDL_SERVICE, service );
        msgContext.setProperty( WSDL_PORT_NAME, getPortName() );
        if ( isMsg )
          msgContext.setProperty( MessageContext.IS_MSG, "true" );

        if (username != null) {
            msgContext.setUsername(username);
        }
        if (password != null) {
            msgContext.setPassword(password);
        }
        msgContext.setMaintainSession(maintainSession);

        if (operation != null) {
            msgContext.setOperation(operation);

            operation.setStyle(getOperationStyle());
            operation.setUse(getOperationUse());
        }
        msgContext.setOperationStyle(getOperationStyle());
        msgContext.setOperationUse(getOperationUse());

        if (useSOAPAction) {
            msgContext.setUseSOAPAction(true);
        }
        if (SOAPActionURI != null) {
            msgContext.setSOAPActionURI(SOAPActionURI);
        }
        if (timeout != null) {
            msgContext.setTimeout(timeout.intValue());
        }

        // Determine client target service
        if (myService != null) {
            // If we have a SOAPService kicking around, use that directly
            msgContext.setService(myService);
        } else {
            if (portName != null) {
                // No explicit service.  If we have a target service name,
                // try that.
                msgContext.setTargetService(portName.getLocalPart());
            } else {
                // No direct config, so try the namespace of the first body.
                reqMsg = msgContext.getRequestMessage();

                if (reqMsg != null) {
                    reqEnv = reqMsg.getSOAPEnvelope();

                    SOAPBodyElement body = reqEnv.getFirstBody();

                    // Does this make any sense to anyone?  If not, we should remove it.
                    // --Glen 03/16/02
                    //if ( body.getPrefix() == null )       body.setPrefix( "m" );
                    if ( body.getNamespaceURI() == null ) {
                        throw new AxisFault("Call.invoke",
                                            Messages.getMessage("cantInvoke00", body.getName()),
                                            null, null);
                    } else {
                        msgContext.setTargetService(body.getNamespaceURI());
                    }
                }
            }

            SOAPService svc = msgContext.getService();
            if (svc != null) {
                svc.setPropertyParent(myProperties);
            } else {
                msgContext.setPropertyParent(myProperties);
            }
        }
        if (log.isDebugEnabled()) {
            log.debug(Messages.getMessage("targetService",
                    msgContext.getTargetService()));
        }

        Message requestMessage = msgContext.getRequestMessage();
        if (requestMessage != null) {
            reqEnv = requestMessage.getSOAPEnvelope();

            // If we have headers to insert, do so now.
            for (int i = 0 ; myHeaders != null && i < myHeaders.size() ; i++ ) {
                reqEnv.addHeader((SOAPHeaderElement)myHeaders.get(i));
            }
View Full Code Here

TOP

Related Classes of org.apache.axis.Message

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.