org.apache.axis.MessageContext - java examples

Here are the examples of the java api org.apache.axis.MessageContext taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

18 View Complete Implementation : DefaultSOAPEncodingTypeMappingImpl.java
Copyright Apache License 2.0
Author : apache
public static TypeMappingDelegate createWithDelegate() {
    TypeMappingDelegate ret = new TypeMappingDelegate(new DefaultSOAPEncodingTypeMappingImpl());
    MessageContext mc = MessageContext.getCurrentContext();
    TypeMappingDelegate tm = null;
    if (mc != null) {
        tm = (TypeMappingDelegate) mc.getTypeMappingRegistry().getDefaultTypeMapping();
    } else {
        tm = DefaultTypeMappingImpl.getSingletonDelegate();
    }
    ret.setNext(tm);
    return ret;
}

18 View Complete Implementation : JavaProvider.java
Copyright Apache License 2.0
Author : apache
/**
 * Return a new service object which, if it implements the ServiceLifecycle
 * interface, has been init()ed.
 *
 * @param msgContext the MessageContext
 * @param clsName the name of the clreplaced to instantiate
 * @return an initialized service object
 */
private Object getNewServiceObject(MessageContext msgContext, String clsName) throws Exception {
    Object serviceObject = makeNewServiceObject(msgContext, clsName);
    if (serviceObject != null && serviceObject instanceof ServiceLifecycle) {
        ((ServiceLifecycle) serviceObject).init(msgContext.getProperty(Constants.MC_SERVLET_ENDPOINT_CONTEXT));
    }
    return serviceObject;
}

18 View Complete Implementation : JavaProvider.java
Copyright Apache License 2.0
Author : apache
// /////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////
// ///// Default methods for java clreplacedes. Override, eg, for
// /////   ejbeans
// /////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////
/**
 * Default java service object comes from simply instantiating the
 * clreplaced wrapped in jc
 */
protected Object makeNewServiceObject(MessageContext msgContext, String clsName) throws Exception {
    ClreplacedLoader cl = msgContext.getClreplacedLoader();
    ClreplacedCache cache = msgContext.getAxisEngine().getClreplacedCache();
    JavaClreplaced jc = cache.lookup(clsName, cl);
    return jc.getJavaClreplaced().newInstance();
}

17 View Complete Implementation : LocalTransport.java
Copyright Apache License 2.0
Author : apache
/**
 * Set up any transport-specific derived properties in the message context.
 * @param mc the context to set up
 * @param call the client service instance
 * @param engine the engine containing the registries
 */
public void setupMessageContextImpl(MessageContext mc, Call call, AxisEngine engine) {
    if (server != null)
        mc.setProperty(LOCAL_SERVER, server);
    if (remoteServiceName != null)
        mc.setProperty(REMOTE_SERVICE, remoteServiceName);
}

17 View Complete Implementation : Admin.java
Copyright Apache License 2.0
Author : apache
/**
 * The meat of the Admin service.  Process an xML doreplacedent rooted with
 * a "deploy", "undeploy", "list", or "quit" element.
 *
 * @param msgContext the MessageContext we're processing
 * @param root the root Element of the XML
 * @return an XML Doreplacedent indicating the results.
 */
public Doreplacedent process(MessageContext msgContext, Element root) throws Exception {
    // Check security FIRST.
    /**
     * Might do something like this once security is a little more
     * integrated.
     *        if (!engine.hreplacedafePreplacedword() &&
     *            !action.equals("preplacedwd"))
     *            throw new AxisFault("Server.MustSetPreplacedword",
     *          "You must change the admin preplacedword before administering Axis!",
     *                                 null, null);
     */
    verifyHostAllowed(msgContext);
    String rootNS = root.getNamespaceURI();
    AxisEngine engine = msgContext.getAxisEngine();
    // If this is WSDD, process it correctly.
    if (rootNS != null && rootNS.equals(WSDDConstants.URI_WSDD)) {
        return processWSDD(msgContext, engine, root);
    }
    // Else fault
    // TODO: Better handling here
    throw new Exception(Messages.getMessage("adminServiceNoWSDD"));
}

17 View Complete Implementation : URLMapper.java
Copyright Apache License 2.0
Author : apache
public void invoke(MessageContext msgContext) throws AxisFault {
    log.debug("Enter: URLMapper::invoke");
    /**
     * If there's already a targetService then just return.
     */
    if (msgContext.getService() == null) {
        // path may or may not start with a "/". see http://issues.apache.org/jira/browse/AXIS-1372
        String path = (String) msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETPATHINFO);
        if ((path != null) && (path.length() >= 1)) {
            // rules out the cases of path="", path=null
            if (path.startsWith("/"))
                // chop the extra "/"
                path = path.substring(1);
            msgContext.setTargetService(path);
        }
    }
    log.debug("Exit: URLMapper::invoke");
}

17 View Complete Implementation : RPCHeaderParam.java
Copyright Apache License 2.0
Author : apache
/**
 * outputImpl serializes the RPCParam
 */
protected void outputImpl(SerializationContext context) throws Exception {
    MessageContext msgContext = context.getMessageContext();
    // Get the RPCParam and serialize it
    RPCParam rpcParam = (RPCParam) getObjectValue();
    if (encodingStyle != null && encodingStyle.equals("")) {
        context.registerPrefixForURI("", rpcParam.getQName().getNamespaceURI());
    }
    rpcParam.serialize(context);
}

17 View Complete Implementation : Admin.java
Copyright Apache License 2.0
Author : apache
/**
 * Process a given XML doreplacedent - needs cleanup.
 */
public Element[] AdminService(Element[] xml) throws Exception {
    log.debug("Enter: Admin::AdminService");
    MessageContext msgContext = MessageContext.getCurrentContext();
    Doreplacedent doc = process(msgContext, xml[0]);
    Element[] result = new Element[1];
    result[0] = doc.getDoreplacedentElement();
    log.debug("Exit: Admin::AdminService");
    return result;
}

17 View Complete Implementation : TestMessageElement.java
Copyright Apache License 2.0
Author : apache
public void testMessageElementNullOngetNamespaceURI() throws Exception {
    String data = "<anElement xmlns:ns1=\"aNamespace\" href=\"unknownProtocol://data\"/>";
    data = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"><SOAP-ENV:Body>" + data + "</SOAP-ENV:Body></SOAP-ENV:Envelope>";
    MessageContext ctx = new MessageContext(new AxisClient());
    DeserializationContext dser = new DeserializationContext(new org.xml.sax.InputSource(new StringReader(data)), ctx, Message.REQUEST);
    dser.parse();
    MessageElement elem = dser.getEnvelope().getBodyByName("", "anElement");
    replacedertEquals("aNamespace", elem.getNamespaceURI("ns1"));
    replacedertEquals("ns1", elem.getPrefix("aNamespace"));
}

17 View Complete Implementation : EJBProvider.java
Copyright Apache License 2.0
Author : apache
/**
 * Get the clreplaced description for the EJB Remote or Local Interface,
 * which is what we are interested in exposing to the world (i.e. in WSDL).
 *
 * @param msgContext the message context (can be null)
 * @param beanJndiName the JNDI name of the EJB
 * @return the clreplaced info of the EJB remote or local interface
 */
protected Clreplaced getServiceClreplaced(String beanJndiName, SOAPService service, MessageContext msgContext) throws AxisFault {
    Clreplaced interfaceClreplaced = null;
    try {
        // First try to get the interface clreplaced from the configuation
        // Note that we don't verify that remote remoteInterfaceName is used for
        // remote ejb and localInterfaceName for local ejb. Should we ?
        String remoteInterfaceName = getStrOption(OPTION_REMOTEINTERFACENAME, service);
        String localInterfaceName = getStrOption(OPTION_LOCALINTERFACENAME, service);
        String interfaceName = (remoteInterfaceName != null ? remoteInterfaceName : localInterfaceName);
        if (interfaceName != null) {
            ClreplacedLoader cl = (msgContext != null) ? msgContext.getClreplacedLoader() : Thread.currentThread().getContextClreplacedLoader();
            interfaceClreplaced = ClreplacedUtils.forName(interfaceName, true, cl);
        } else {
            // cannot get the interface name from the configuration, we get
            // it from the EJB Home (if remote)
            if (isRemoteEjb(service)) {
                interfaceClreplaced = getRemoteInterfaceClreplacedFromHome(beanJndiName, service, msgContext);
            } else if (isLocalEjb(service)) {
                // we cannot get the local interface from the local ejb home
                // localInterfaceName is mandatory for local ejbs
                throw new AxisFault(Messages.getMessage("noOption00", OPTION_LOCALINTERFACENAME, service.getName()));
            } else {
                // neither a local ejb or a remote one ...
                throw new AxisFault(Messages.getMessage("noOption00", OPTION_HOMEINTERFACENAME, service.getName()));
            }
        }
    } catch (Exception e) {
        throw AxisFault.makeFault(e);
    }
    // got it, return it
    return interfaceClreplaced;
}

17 View Complete Implementation : RPCElement.java
Copyright Apache License 2.0
Author : apache
protected void outputImpl(SerializationContext context) throws Exception {
    MessageContext msgContext = context.getMessageContext();
    boolean hasOperationElement = (msgContext == null || msgContext.getOperationStyle() == Style.RPC || msgContext.getOperationStyle() == Style.WRAPPED);
    // When I have MIME and a no-param doreplacedent WSDL, if I don't check
    // for no params here, the server chokes with "can't find Body".
    // because it will be looking for the enclosing element always
    // found in an RPC-style (and wrapped) request
    boolean noParams = getParams2().size() == 0;
    if (hasOperationElement || noParams) {
        // Set default namespace if appropriate (to avoid prefix mappings
        // in literal style).  Do this only if there is no encodingStyle.
        if (encodingStyle != null && encodingStyle.equals("")) {
            context.registerPrefixForURI("", getNamespaceURI());
        }
        context.startElement(new QName(getNamespaceURI(), name), attributes);
    }
    if (noParams) {
        if (children != null) {
            for (Iterator it = children.iterator(); it.hasNext(); ) {
                ((NodeImpl) it.next()).output(context);
            }
        }
    } else {
        List params = getParams2();
        for (int i = 0; i < params.size(); i++) {
            RPCParam param = (RPCParam) params.get(i);
            if (!hasOperationElement && encodingStyle != null && encodingStyle.equals("")) {
                context.registerPrefixForURI("", param.getQName().getNamespaceURI());
            }
            param.serialize(context);
        }
    }
    if (hasOperationElement || noParams) {
        context.endElement();
    }
}

17 View Complete Implementation : TestService.java
Copyright Apache License 2.0
Author : apache
/**
 * Calculate and return the length of the preplaceded String.  If a
 * MessageContext property indicates that we've received a particular
 * header, then double the result before returning it.
 */
public int countChars(String str) {
    int ret = str.length();
    MessageContext mc = MessageContext.getCurrentContext();
    if (mc.isPropertyTrue(TestHeaderAttrs.PROP_DOUBLEIT)) {
        ret = ret * 2;
    }
    return ret;
}

17 View Complete Implementation : SOAPMonitorHandler.java
Copyright Apache License 2.0
Author : apache
/**
 * Process and SOAP message
 */
public void invoke(MessageContext messageContext) throws AxisFault {
    String target = messageContext.getTargetService();
    // Check for null target
    if (target == null) {
        target = "";
    }
    // Get id, type and content
    Long id;
    Integer type;
    Message message;
    if (!messageContext.getPastPivot()) {
        id = replacedignMessageId(messageContext);
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_REQUEST);
        message = messageContext.getRequestMessage();
    } else {
        id = getMessageId(messageContext);
        type = new Integer(SOAPMonitorConstants.SOAP_MONITOR_RESPONSE);
        message = messageContext.getResponseMessage();
    }
    // Get the SOAP portion of the message
    String soap = null;
    if (message != null) {
        soap = ((SOAPPart) message.getSOAPPart()).getreplacedtring();
    }
    // If we have an id and a SOAP portion, then send the
    // message to the SOAP monitor service
    if ((id != null) && (soap != null)) {
        SOAPMonitorService.publishMessage(id, type, target, soap);
    }
}

17 View Complete Implementation : HTTPActionHandler.java
Copyright Apache License 2.0
Author : apache
public void invoke(MessageContext msgContext) throws AxisFault {
    log.debug("Enter: HTTPActionHandler::invoke");
    /**
     * If there's already a targetService then just return.
     */
    if (msgContext.getService() == null) {
        String action = (String) msgContext.getSOAPActionURI();
        log.debug("  HTTP SOAPAction: " + action);
        /**
         * The idea is that this handler only goes in the chain IF this
         * service does a mapping between SOAPAction and target.  Therefore
         * if we get here with no action, we're in trouble.
         */
        if (action == null) {
            throw new AxisFault("Server.NoHTTPSOAPAction", Messages.getMessage("noSOAPAction00"), null, null);
        }
        action = action.trim();
        // handle empty SOAPAction
        if (action.length() > 0 && action.charAt(0) == '\"') {
            // replacedertTrue(action.endsWith("\"")
            if (action.equals("\"\"")) {
                action = "";
            } else {
                action = action.substring(1, action.length() - 1);
            }
        }
        // if action is zero-length string, don't set anything
        if (action.length() > 0) {
            msgContext.setTargetService(action);
        }
    }
    log.debug("Exit: HTTPActionHandler::invoke");
}

17 View Complete Implementation : EJBProvider.java
Copyright Apache License 2.0
Author : apache
/**
 * Create an EJB using a remote home object
 *
 * @param msgContext the message context
 * @param beanJndiName The JNDI name of the EJB remote home clreplaced
 * @param homeClreplaced the clreplaced of the home interface
 * @return an EJB
 */
private Object createRemoteEJB(MessageContext msgContext, String beanJndiName, Clreplaced homeClreplaced) throws Exception {
    // Get the EJB Home object from JNDI
    Object ejbHome = getEJBHome(msgContext.getService(), msgContext, beanJndiName);
    Object ehome = javax.rmi.PortableRemoteObject.narrow(ejbHome, homeClreplaced);
    // Invoke the create method of the ejbHome clreplaced without actually
    // touching any EJB clreplacedes (i.e. no cast to EJBHome)
    Method createMethod = homeClreplaced.getMethod("create", empty_clreplaced_array);
    Object result = createMethod.invoke(ehome, empty_object_array);
    return result;
}

17 View Complete Implementation : EJBProvider.java
Copyright Apache License 2.0
Author : apache
/**
 * Create an EJB using a local home object
 *
 * @param msgContext the message context
 * @param beanJndiName The JNDI name of the EJB local home clreplaced
 * @param homeClreplaced the clreplaced of the home interface
 * @return an EJB
 */
private Object createLocalEJB(MessageContext msgContext, String beanJndiName, Clreplaced homeClreplaced) throws Exception {
    // Get the EJB Home object from JNDI
    Object ejbHome = getEJBHome(msgContext.getService(), msgContext, beanJndiName);
    // the home object is a local home object
    Object ehome;
    if (homeClreplaced.isInstance(ejbHome))
        ehome = ejbHome;
    else
        throw new ClreplacedCastException(Messages.getMessage("badEjbHomeType"));
    // Invoke the create method of the ejbHome clreplaced without actually
    // touching any EJB clreplacedes (i.e. no cast to EJBLocalHome)
    Method createMethod = homeClreplaced.getMethod("create", empty_clreplaced_array);
    Object result = createMethod.invoke(ehome, empty_object_array);
    return result;
}

16 View Complete Implementation : SignedSOAPEnvelope.java
Copyright Apache License 2.0
Author : apache
private Doreplacedent getSOAPEnvelopeAsDoreplacedent(SOAPEnvelope env, MessageContext msgContext) throws Exception {
    StringWriter writer = new StringWriter();
    SerializationContext serializeContext = new SerializationContext(writer, msgContext);
    env.output(serializeContext);
    writer.close();
    Reader reader = new StringReader(writer.getBuffer().toString());
    Doreplacedent doc = XMLUtils.newDoreplacedent(new InputSource(reader));
    if (doc == null)
        throw new Exception(Messages.getMessage("noDoc00", writer.getBuffer().toString()));
    return doc;
}

16 View Complete Implementation : EJBProvider.java
Copyright Apache License 2.0
Author : apache
/**
 * Get the remote interface of an ejb from its home clreplaced.
 * This function can only be used for remote ejbs
 *
 * @param beanJndiName the jndi name of the ejb
 * @param service the soap service
 * @param msgContext the message context (can be null)
 */
private Clreplaced getRemoteInterfaceClreplacedFromHome(String beanJndiName, SOAPService service, MessageContext msgContext) throws Exception {
    // Get the EJB Home object from JNDI
    Object ejbHome = getEJBHome(service, msgContext, beanJndiName);
    String homeName = getStrOption(OPTION_HOMEINTERFACENAME, service);
    if (homeName == null)
        throw new AxisFault(Messages.getMessage("noOption00", OPTION_HOMEINTERFACENAME, service.getName()));
    // Load the Home clreplaced name given in the config file
    ClreplacedLoader cl = (msgContext != null) ? msgContext.getClreplacedLoader() : Thread.currentThread().getContextClreplacedLoader();
    Clreplaced homeClreplaced = ClreplacedUtils.forName(homeName, true, cl);
    // Make sure the object we got back from JNDI is the same type
    // as the what is specified in the config file
    Object ehome = javax.rmi.PortableRemoteObject.narrow(ejbHome, homeClreplaced);
    // This code requires the use of ejb.jar, so we do the stuff below
    // EJBHome ejbHome = (EJBHome) ehome;
    // EJBMetaData meta = ejbHome.getEJBMetaData();
    // Clreplaced interfaceClreplaced = meta.getRemoteInterfaceClreplaced();
    // Invoke the getEJBMetaData method of the ejbHome clreplaced without
    // actually touching any EJB clreplacedes (i.e. no cast to EJBHome)
    Method getEJBMetaData = homeClreplaced.getMethod("getEJBMetaData", empty_clreplaced_array);
    Object metaData = getEJBMetaData.invoke(ehome, empty_object_array);
    Method getRemoteInterfaceClreplaced = metaData.getClreplaced().getMethod("getRemoteInterfaceClreplaced", empty_clreplaced_array);
    return (Clreplaced) getRemoteInterfaceClreplaced.invoke(metaData, empty_object_array);
}

16 View Complete Implementation : LocalResponder.java
Copyright Apache License 2.0
Author : apache
public void invoke(MessageContext msgContext) throws AxisFault {
    if (log.isDebugEnabled()) {
        log.debug("Enter: LocalResponder::invoke");
    }
    String msgStr = msgContext.getResponseMessage().getSOAPPartreplacedtring();
    if (log.isDebugEnabled()) {
        log.debug(msgStr);
        log.debug("Exit: LocalResponder::invoke");
    }
}

16 View Complete Implementation : TestChainFault.java
Copyright Apache License 2.0
Author : apache
/**
 * Extract the fault string from the Soap Response
 */
String getFaultString(MessageContext msgContext) {
    String stRetval = null;
    Message message = msgContext.getResponseMessage();
    try {
        if (message != null) {
            SOAPBody oBody = message.getSOAPEnvelope().getBody();
            stRetval = oBody.getFault().getFaultString();
        }
    } catch (javax.xml.soap.SOAPException e) {
        e.printStackTrace();
        replacedertTrue("Unforseen soap exception", false);
    } catch (AxisFault f) {
        f.printStackTrace();
        replacedertTrue("Unforseen axis fault", false);
    }
    return stRetval;
}

16 View Complete Implementation : RPCElement.java
Copyright Apache License 2.0
Author : apache
public void updateOperationsByName() throws AxisFault {
    if (context == null) {
        return;
    }
    MessageContext msgContext = context.getMessageContext();
    if (msgContext == null) {
        return;
    }
    // Obtain our possible operations
    SOAPService service = msgContext.getService();
    if (service == null) {
        return;
    }
    ServiceDesc serviceDesc = service.getInitializedServiceDesc(msgContext);
    String lc = JavaUtils.xmlNameToJava(name);
    if (serviceDesc == null) {
        throw AxisFault.makeFault(new ClreplacedNotFoundException(Messages.getMessage("noClreplacedForService00", lc)));
    }
    this.operations = serviceDesc.getOperationsByName(lc);
}

16 View Complete Implementation : HTTPSender.java
Copyright Apache License 2.0
Author : apache
/**
 * invoke creates a socket connection, sends the request SOAP message and then
 * reads the response SOAP message back from the SOAP server
 *
 * @param msgContext the messsage context
 *
 * @throws AxisFault
 */
public void invoke(MessageContext msgContext) throws AxisFault {
    if (log.isDebugEnabled()) {
        log.debug(Messages.getMessage("enter00", "HTTPSender::invoke"));
    }
    SocketHolder socketHolder = new SocketHolder(null);
    try {
        BooleanHolder useFullURL = new BooleanHolder(false);
        StringBuffer otherHeaders = new StringBuffer();
        targetURL = new URL(msgContext.getStrProp(MessageContext.TRANS_URL));
        String host = targetURL.getHost();
        int port = targetURL.getPort();
        // Send the SOAP request to the server
        InputStream inp = writeToSocket(socketHolder, msgContext, targetURL, otherHeaders, host, port, msgContext.getTimeout(), useFullURL);
        // Read the response back from the server
        Hashtable headers = new Hashtable();
        inp = readHeadersFromSocket(socketHolder, msgContext, inp, headers);
        readFromSocket(socketHolder, msgContext, inp, headers);
    } catch (Exception e) {
        log.debug(e);
        try {
            if (socketHolder.getSocket() != null) {
                socketHolder.getSocket().close();
            }
        } catch (IOException ie) {
        // we shouldn't get here.
        }
        throw AxisFault.makeFault(e);
    }
    if (log.isDebugEnabled()) {
        log.debug(Messages.getMessage("exit00", "HTTPDispatchHandler::invoke"));
    }
}

16 View Complete Implementation : EJBProvider.java
Copyright Apache License 2.0
Author : apache
// /////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////
// ///// Default methods from JavaProvider ancestor, overridden
// /////   for ejbeans
// /////////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////////
/**
 * Return a object which implements the service.
 *
 * @param msgContext the message context
 * @param clsName The JNDI name of the EJB home clreplaced
 * @return an object that implements the service
 */
protected Object makeNewServiceObject(MessageContext msgContext, String clsName) throws Exception {
    String remoteHomeName = getStrOption(OPTION_HOMEINTERFACENAME, msgContext.getService());
    String localHomeName = getStrOption(OPTION_LOCALHOMEINTERFACENAME, msgContext.getService());
    String homeName = (remoteHomeName != null ? remoteHomeName : localHomeName);
    if (homeName == null) {
        // cannot find both remote home and local home
        throw new AxisFault(Messages.getMessage("noOption00", OPTION_HOMEINTERFACENAME, msgContext.getTargetService()));
    }
    // Load the Home clreplaced name given in the config file
    Clreplaced homeClreplaced = ClreplacedUtils.forName(homeName, true, msgContext.getClreplacedLoader());
    // we create either the ejb using either the RemoteHome or LocalHome object
    if (remoteHomeName != null)
        return createRemoteEJB(msgContext, clsName, homeClreplaced);
    else
        return createLocalEJB(msgContext, clsName, homeClreplaced);
}

16 View Complete Implementation : SOAPHeader.java
Copyright Apache License 2.0
Author : apache
/**
 * Get a header by name, filtering for headers targeted at this
 * engine depending on the accessAllHeaders parameter.
 */
SOAPHeaderElement getHeaderByName(String namespace, String localPart, boolean accessAllHeaders) {
    QName name = new QName(namespace, localPart);
    SOAPHeaderElement header = (SOAPHeaderElement) getChildElement(name);
    // If we're operating within an AxisEngine, respect its actor list
    // unless told otherwise
    if (!accessAllHeaders) {
        MessageContext mc = MessageContext.getCurrentContext();
        if (mc != null) {
            if (header != null) {
                String actor = header.getActor();
                // Always respect "next" role
                String nextActor = getEnvelope().getSOAPConstants().getNextRoleURI();
                if (nextActor.equals(actor))
                    return header;
                SOAPService soapService = mc.getService();
                if (soapService != null) {
                    ArrayList actors = mc.getService().getActors();
                    if ((actor != null) && (actors == null || !actors.contains(actor))) {
                        header = null;
                    }
                }
            }
        }
    }
    return header;
}

16 View Complete Implementation : TestSimpleChain.java
Copyright Apache License 2.0
Author : apache
public void testSimpleChainAddHandlerAfterInvoke() {
    try {
        SimpleChain c = new SimpleChain();
        Handler h1 = new TestHandler();
        c.addHandler(h1);
        // A null engine is good enough for this test
        MessageContext mc = new MessageContext(null);
        c.invoke(mc);
        // while testing, disable noise
        boolean oldLogging = InternalException.getLogging();
        InternalException.setLogging(false);
        try {
            Handler h2 = new TestHandler();
            c.addHandler(h2);
            replacedertTrue("Handler added after chain invoked", false);
        } catch (Exception e) {
        // Correct behaviour. Exact exception isn't critical
        }
        // resume noise
        InternalException.setLogging(oldLogging);
    } catch (AxisFault af) {
        replacedertTrue("Unexpected exception", false);
    }
}

15 View Complete Implementation : TestHandler.java
Copyright Apache License 2.0
Author : apache
public void onFault(MessageContext msgContext) {
    try {
        SOAPEnvelope env = msgContext.getResponseMessage().getSOAPEnvelope();
        SOAPHeaderElement header = new SOAPHeaderElement("ns", "local", "val");
        env.addHeader(header);
    } catch (Exception e) {
        throw new RuntimeException("Exception during onFault processing");
    }
}

15 View Complete Implementation : AxisClient.java
Copyright Apache License 2.0
Author : apache
/**
 * @param context Stores the Service, port QName and optionnaly a HandlerInfoChainFactory
 * @return Returns a HandlerChain if one has been specified
 */
protected HandlerChain getJAXRPChandlerChain(MessageContext context) {
    java.util.List chain = null;
    HandlerInfoChainFactory hiChainFactory = null;
    boolean clientSpecified = false;
    Service service = (Service) context.getProperty(Call.WSDL_SERVICE);
    if (service == null) {
        return null;
    }
    QName portName = (QName) context.getProperty(Call.WSDL_PORT_NAME);
    if (portName == null) {
        return null;
    }
    javax.xml.rpc.handler.HandlerRegistry registry;
    registry = service.getHandlerRegistry();
    if (registry != null) {
        chain = registry.getHandlerChain(portName);
        if ((chain != null) && (!chain.isEmpty())) {
            hiChainFactory = new HandlerInfoChainFactory(chain);
            clientSpecified = true;
        }
    }
    // Otherwise, use the container support
    if (!clientSpecified) {
        SOAPService soapService = context.getService();
        if (soapService != null) {
            // A client configuration exists for this service.  Check
            // to see if there is a HandlerInfoChain configured on it.
            hiChainFactory = (HandlerInfoChainFactory) soapService.getOption(Constants.ATTR_HANDLERINFOCHAIN);
        }
    }
    if (hiChainFactory == null) {
        return null;
    }
    return hiChainFactory.createHandlerChain();
}

15 View Complete Implementation : TestHandler.java
Copyright Apache License 2.0
Author : apache
public void invoke(MessageContext msgContext) throws AxisFault {
    SOAPEnvelope env = msgContext.getRequestMessage().getSOAPEnvelope();
    if (env.getHeaderByName(TestHeaderAttrs.GOOD_HEADER_NS, TestHeaderAttrs.GOOD_HEADER_NAME) != null) {
        // Just the header's presence is enough - mark the property
        // so it can be picked up by the service (see below)
        msgContext.setProperty(TestHeaderAttrs.PROP_DOUBLEIT, Boolean.TRUE);
    }
    if (env.getHeaderByName(TestOnFaultHeaders.TRIGGER_NS, TestOnFaultHeaders.TRIGGER_NAME) != null) {
        // Fault trigger header is there, so throw an Exception
        throw new AxisFault("triggered exception");
    }
}

15 View Complete Implementation : JMSVendorAdapter.java
Copyright Apache License 2.0
Author : apache
public void setupApplicationProperties(MessageContext context, Call call, JMSURLHelper jmsurl) {
    // start with application properties from the URL
    Map appProps = new HashMap();
    if (jmsurl != null && jmsurl.getApplicationProperties() != null) {
        for (Iterator itr = jmsurl.getApplicationProperties().iterator(); itr.hasNext(); ) {
            String name = (String) itr.next();
            appProps.put(name, jmsurl.getPropertyValue(name));
        }
    }
    // next add application properties from the message context
    Map ctxProps = (Map) context.getProperty(JMSConstants.JMS_APPLICATION_MSG_PROPS);
    if (ctxProps != null) {
        appProps.putAll(ctxProps);
    }
    // finally add the properties from the call
    Map callProps = (Map) call.getProperty(JMSConstants.JMS_APPLICATION_MSG_PROPS);
    if (callProps != null) {
        appProps.putAll(callProps);
    }
    // now tore these properties within the context
    context.setProperty(JMSConstants.JMS_APPLICATION_MSG_PROPS, appProps);
}

15 View Complete Implementation : JMSSender.java
Copyright Apache License 2.0
Author : apache
/**
 * Return a map of properties that makeup the application-specific
 *        for the JMS Messages.
 */
protected HashMap createApplicationProperties(MessageContext context) {
    HashMap props = null;
    if (context.containsProperty(JMSConstants.JMS_APPLICATION_MSG_PROPS)) {
        props = new HashMap();
        props.putAll((Map) context.getProperty(JMSConstants.JMS_APPLICATION_MSG_PROPS));
    }
    return props;
}

15 View Complete Implementation : TestHandler.java
Copyright Apache License 2.0
Author : apache
public void invoke(MessageContext msgContext) throws AxisFault {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        msgContext.getCurrentMessage().writeTo(baos);
    } catch (Exception e) {
        throw new AxisFault("exception", e);
    }
    String msg = baos.toString();
    System.out.println("msg = " + msg);
    if (msg.indexOf("xsi:type") >= 0) {
        throw new AxisFault("message contains xsi:type");
    }
}

15 View Complete Implementation : HTTPAuthHandler.java
Copyright Apache License 2.0
Author : apache
public void invoke(MessageContext msgContext) throws AxisFault {
    log.debug("Enter: HTTPAuthHandler::invoke");
    /* Process the Basic Auth stuff in the headers */
    /**
     * *******************************************
     */
    String tmp = (String) msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION);
    if (tmp != null)
        tmp = tmp.trim();
    if (tmp != null && tmp.startsWith("Basic ")) {
        String user = null;
        int i;
        tmp = new String(Base64.decode(tmp.substring(6)));
        i = tmp.indexOf(':');
        if (i == -1)
            user = tmp;
        else
            user = tmp.substring(0, i);
        msgContext.setUsername(user);
        log.debug(Messages.getMessage("httpUser00", user));
        if (i != -1) {
            String pwd = tmp.substring(i + 1);
            if (pwd != null && pwd.equals(""))
                pwd = null;
            if (pwd != null) {
                msgContext.setPreplacedword(pwd);
                log.debug(Messages.getMessage("httpPreplacedword00", pwd));
            }
        }
    }
    log.debug("Exit: HTTPAuthHandler::invoke");
}

15 View Complete Implementation : TestFaultHandler.java
Copyright Apache License 2.0
Author : apache
public void onFault(MessageContext msgContext) {
    try {
        SOAPEnvelope env = msgContext.getResponseMessage().getSOAPEnvelope();
        SOAPHeaderElement header = new SOAPHeaderElement(TestOnFaultHeaders.TRIGGER_NS, TestOnFaultHeaders.RESP_NAME, "here's the value");
        env.addHeader(header);
    } catch (Exception e) {
        throw new RuntimeException("Exception during onFault processing");
    }
}

15 View Complete Implementation : TestSer.java
Copyright Apache License 2.0
Author : apache
public void testEmptyXMLNS() throws Exception {
    MessageContext msgContext = new MessageContext(new AxisServer());
    String req = "<xsd1:A xmlns:xsd1=\"urn:myNamespace\">" + "<xsd1:B>" + "<xsd1:C>foo bar</xsd1:C>" + "</xsd1:B>" + "</xsd1:A>";
    StringWriter stringWriter = new StringWriter();
    StringReader reqReader = new StringReader(req);
    InputSource reqSource = new InputSource(reqReader);
    Doreplacedent doreplacedent = XMLUtils.newDoreplacedent(reqSource);
    String msgString = null;
    SOAPEnvelope msg = new SOAPEnvelope();
    RPCParam arg1 = new RPCParam("urn:myNamespace", "testParam", doreplacedent.getFirstChild());
    arg1.setXSITypeGeneration(Boolean.FALSE);
    RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[] { arg1 });
    msg.addBodyElement(body);
    body.setEncodingStyle(Constants.URI_LITERAL_ENC);
    SerializationContext context = new SerializationContext(stringWriter, msgContext);
    msg.output(context);
    msgString = stringWriter.toString();
    replacedertTrue(msgString.indexOf("xmlns=\"\"") == -1);
}

15 View Complete Implementation : ServiceHandler.java
Copyright Apache License 2.0
Author : apache
public void invoke(MessageContext msgContext) throws AxisFault {
    SOAPEnvelope env = new SOAPEnvelope();
    RPCParam retVal = new RPCParam("return", RESPONSE);
    RPCParam outParam1 = new RPCParam("out1", OUTPARAM1);
    RPCParam outParam2 = new RPCParam("out2", OUTPARAM2);
    RPCElement rpc = new RPCElement("namespace", "response", new Object[] { retVal, outParam1, outParam2 });
    env.addBodyElement(rpc);
    msgContext.setResponseMessage(new Message(env));
}

15 View Complete Implementation : Admin.java
Copyright Apache License 2.0
Author : apache
/**
 * host validation logic goes here
 * @param msgContext
 * @throws AxisFault
 */
private void verifyHostAllowed(MessageContext msgContext) throws AxisFault {
    /**
     * For now, though - make sure we can only admin from our own
     * IP, unless the remoteAdmin option is set.
     */
    Handler serviceHandler = msgContext.getService();
    if (serviceHandler != null && !JavaUtils.isTrueExplicitly(serviceHandler.getOption("enableRemoteAdmin"))) {
        String remoteIP = msgContext.getStrProp(Constants.MC_REMOTE_ADDR);
        if (remoteIP != null && !(remoteIP.equals(NetworkUtils.LOCALHOST) || remoteIP.equals(NetworkUtils.LOCALHOST_IPV6))) {
            try {
                InetAddress myAddr = InetAddress.getLocalHost();
                InetAddress remoteAddr = InetAddress.getByName(remoteIP);
                if (log.isDebugEnabled()) {
                    log.debug("Comparing remote caller " + remoteAddr + " to " + myAddr);
                }
                if (!myAddr.equals(remoteAddr)) {
                    log.error(Messages.getMessage("noAdminAccess01", remoteAddr.toString()));
                    throw new AxisFault("Server.Unauthorized", Messages.getMessage("noAdminAccess00"), null, null);
                }
            } catch (UnknownHostException e) {
                throw new AxisFault("Server.UnknownHost", Messages.getMessage("unknownHost00"), null, null);
            }
        }
    }
}

14 View Complete Implementation : TestSOAPService.java
Copyright Apache License 2.0
Author : apache
/**
 * @throws Exception
 */
public void testRequestHandlerThrowsSFE() throws Exception {
    SOAPService soapService = new SOAPService();
    // SETUP THE 2nd HANDLER IN THE REQUEST CHAIN TO THROW SOAPFaultException
    handler1Config.put("HANDLE_REQUEST_RETURN_VALUE", new SOAPFaultException(null, "f", "f", new Detail()));
    TestHandlerInfoChainFactory factory = buildInfoChainFactory();
    soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
    soapService.init();
    MessageContext msgContext = new TestMessageContext();
    soapService.invoke(msgContext);
    AAAHandler handlerZero = factory.getHandlers()[0];
    AAAHandler handlerOne = factory.getHandlers()[1];
    AAAHandler handlerTwo = factory.getHandlers()[2];
    replacedertHandlerRuntime("handlerZero", handlerZero, 1, 0, 1);
    replacedertHandlerRuntime("handlerOne", handlerOne, 1, 0, 1);
    replacedertHandlerRuntime("handlerTwo", handlerTwo, 0, 0, 0);
}

14 View Complete Implementation : TestSOAPService.java
Copyright Apache License 2.0
Author : apache
/**
 * Tests to see if we handle the scenario of a handler throwing a
 * runtime exception during the handleFault(...) processing correctly
 * <p/>
 * Expected chain sequence:
 * H0.handleRequest
 * H1.handleRequest
 * H2.handleRequest SOAPFaultException
 * H2.handleFault
 * H1.handleFault throws JAXRPCException
 *
 * @throws Exception
 */
public void testFaultHandlerThrowsJAXRPCException() throws Exception {
    SOAPService soapService = new SOAPService();
    // SETUP THE LAST HANDLER IN THE REQUEST CHAIN TO THROW SOAPFaultException
    handler2Config.put("HANDLE_REQUEST_RETURN_VALUE", new SOAPFaultException(null, "f", "f", new Detail()));
    handler1Config.put("HANDLE_FAULT_RETURN_VALUE", new JAXRPCException());
    TestHandlerInfoChainFactory factory = buildInfoChainFactory();
    soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
    soapService.init();
    MessageContext msgContext = new TestMessageContext();
    try {
        soapService.invoke(msgContext);
        fail("Expected AxisFault to be thrown");
    } catch (AxisFault e) {
        AAAHandler handlerZero = factory.getHandlers()[0];
        AAAHandler handlerOne = factory.getHandlers()[1];
        AAAHandler handlerTwo = factory.getHandlers()[2];
        replacedertHandlerRuntime("handlerZero", handlerZero, 1, 0, 0);
        replacedertHandlerRuntime("handlerOne", handlerOne, 1, 0, 1);
        replacedertHandlerRuntime("handlerTwo", handlerTwo, 1, 0, 1);
    }
}

14 View Complete Implementation : TestSOAPService.java
Copyright Apache License 2.0
Author : apache
/**
 * Tests to see if we handle the scenario of a handler throwing a
 * runtime exception during the handleFault(...) processing correctly
 * <p/>
 * Expected chain sequence:
 * H0.handleRequest
 * H1.handleRequest
 * H2.handleRequest throws SOAPFaultException
 * H2.handleFault
 * H1.handleFault throws RuntimeException
 *
 * @throws Exception
 */
public void testFaultHandlerThrowsRuntimeException() throws Exception {
    SOAPService soapService = new SOAPService();
    // SETUP THE LAST HANDLER IN THE REQUEST CHAIN TO THROW SOAPFaultException
    handler2Config.put("HANDLE_REQUEST_RETURN_VALUE", new SOAPFaultException(null, "f", "f", new Detail()));
    handler1Config.put("HANDLE_FAULT_RETURN_VALUE", new RuntimeException());
    TestHandlerInfoChainFactory factory = buildInfoChainFactory();
    soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
    soapService.init();
    MessageContext msgContext = new TestMessageContext();
    try {
        soapService.invoke(msgContext);
        fail("Expected AxisFault to be thrown");
    } catch (AxisFault e) {
        AAAHandler handlerZero = factory.getHandlers()[0];
        AAAHandler handlerOne = factory.getHandlers()[1];
        AAAHandler handlerTwo = factory.getHandlers()[2];
        replacedertHandlerRuntime("handlerZero", handlerZero, 1, 0, 0);
        replacedertHandlerRuntime("handlerOne", handlerOne, 1, 0, 1);
        replacedertHandlerRuntime("handlerTwo", handlerTwo, 1, 0, 1);
    }
}

14 View Complete Implementation : TestSOAPService.java
Copyright Apache License 2.0
Author : apache
public void testResponseHandlerThrowsJAXRPCException() throws Exception {
    SOAPService soapService = new SOAPService();
    // SETUP THE 2nd HANDLER IN THE CHAIN TO THROW JAXRPCException on handleResponse
    handler1Config.put("HANDLE_RESPONSE_RETURN_VALUE", new JAXRPCException());
    TestHandlerInfoChainFactory factory = buildInfoChainFactory();
    soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
    soapService.init();
    MessageContext msgContext = new TestMessageContext();
    try {
        soapService.invoke(msgContext);
        fail("Expected AxisFault to be thrown");
    } catch (AxisFault e) {
        AAAHandler handlerZero = factory.getHandlers()[0];
        AAAHandler handlerOne = factory.getHandlers()[1];
        AAAHandler handlerTwo = factory.getHandlers()[2];
        replacedertHandlerRuntime("handlerZero", handlerZero, 1, 0, 0);
        replacedertHandlerRuntime("handlerOne", handlerOne, 1, 1, 0);
        replacedertHandlerRuntime("handlerTwo", handlerTwo, 1, 1, 0);
    }
}

14 View Complete Implementation : TestSOAPService.java
Copyright Apache License 2.0
Author : apache
public void testResponseHandlerThrowsRuntimeException() throws Exception {
    SOAPService soapService = new SOAPService();
    // SETUP THE 2nd HANDLER IN THE CHAIN TO THROW RuntimeException on handleResponse
    handler1Config.put("HANDLE_RESPONSE_RETURN_VALUE", new RuntimeException());
    TestHandlerInfoChainFactory factory = buildInfoChainFactory();
    soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
    soapService.init();
    MessageContext msgContext = new TestMessageContext();
    try {
        soapService.invoke(msgContext);
        fail("Expected AxisFault to be thrown");
    } catch (AxisFault e) {
        AAAHandler handlerZero = factory.getHandlers()[0];
        AAAHandler handlerOne = factory.getHandlers()[1];
        AAAHandler handlerTwo = factory.getHandlers()[2];
        replacedertHandlerRuntime("handlerZero", handlerZero, 1, 0, 0);
        replacedertHandlerRuntime("handlerOne", handlerOne, 1, 1, 0);
        replacedertHandlerRuntime("handlerTwo", handlerTwo, 1, 1, 0);
    }
}

14 View Complete Implementation : TestSOAPService.java
Copyright Apache License 2.0
Author : apache
/**
 * @throws Exception
 */
public void testRequestHandlerThrowsJAXRPCException() throws Exception {
    SOAPService soapService = new SOAPService();
    // SETUP THE 2nd HANDLER IN THE REQUEST CHAIN TO THROW JAXRPCException
    handler1Config.put("HANDLE_REQUEST_RETURN_VALUE", new JAXRPCException());
    TestHandlerInfoChainFactory factory = buildInfoChainFactory();
    soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
    soapService.init();
    MessageContext msgContext = new TestMessageContext();
    try {
        soapService.invoke(msgContext);
    } catch (AxisFault e) {
        AAAHandler handlerZero = factory.getHandlers()[0];
        AAAHandler handlerOne = factory.getHandlers()[1];
        AAAHandler handlerTwo = factory.getHandlers()[2];
        replacedertHandlerRuntime("handlerZero", handlerZero, 1, 0, 0);
        replacedertHandlerRuntime("handlerOne", handlerOne, 1, 0, 0);
        replacedertHandlerRuntime("handlerTwo", handlerTwo, 0, 0, 0);
    }
}

14 View Complete Implementation : TestMUValues.java
Copyright Apache License 2.0
Author : apache
public void checkVal(String val, boolean desiredResult, String ns) throws Exception {
    String request = header + ns + middle + val + footer;
    // create a message in context
    MessageContext msgContext = new MessageContext(engine);
    Message message = new Message(request);
    message.setMessageContext(msgContext);
    // Parse the message and check the mustUnderstand value
    SOAPEnvelope envelope = message.getSOAPEnvelope();
    SOAPHeaderElement header = envelope.getHeaderByName("", "test");
    replacedertEquals("MustUnderstand value wasn't right using value '" + val + "'", desiredResult, header.getMustUnderstand());
}

14 View Complete Implementation : SimpleSecurityProvider.java
Copyright Apache License 2.0
Author : apache
/**
 * Authenticate a user from a username/preplacedword pair.
 *
 * @return an AuthenticatedUser or null
 */
public AuthenticatedUser authenticate(MessageContext msgContext) {
    if (!initialized) {
        initialize(msgContext);
    }
    String username = msgContext.getUsername();
    String preplacedword = msgContext.getPreplacedword();
    if (users != null) {
        if (log.isDebugEnabled()) {
            log.debug(Messages.getMessage("user00", username));
        }
        // in order to authenticate, the user must exist
        if (username == null || username.equals("") || !users.containsKey(username))
            return null;
        String valid = (String) users.get(username);
        if (log.isDebugEnabled()) {
            log.debug(Messages.getMessage("preplacedword00", preplacedword));
        }
        // if a preplacedword is defined, then it must match
        if (valid.length() > 0 && !valid.equals(preplacedword))
            return null;
        if (log.isDebugEnabled()) {
            log.debug(Messages.getMessage("auth00", username));
        }
        return new SimpleAuthenticatedUser(username);
    }
    return null;
}

14 View Complete Implementation : TypeMappingImpl.java
Copyright Apache License 2.0
Author : apache
/**
 * isDotNetSoapEncFixNeeded - Do we need to compensate for the dotnet bug.
 * check the service specific flag before using the global flag
 * @return
 */
private boolean isDotNetSoapEncFixNeeded() {
    MessageContext msgContext = MessageContext.getCurrentContext();
    if (msgContext != null) {
        SOAPService service = msgContext.getService();
        if (service != null) {
            String dotNetSoapEncFix = (String) service.getOption(AxisEngine.PROP_DOTNET_SOAPENC_FIX);
            if (dotNetSoapEncFix != null) {
                return JavaUtils.isTrue(dotNetSoapEncFix);
            }
        }
    }
    return TypeMappingImpl.dotnet_soapenc_bugfix;
}

14 View Complete Implementation : RPCProvider.java
Copyright Apache License 2.0
Author : apache
protected OperationDesc getOperationDesc(MessageContext msgContext, RPCElement body) throws SAXException, AxisFault {
    SOAPService service = msgContext.getService();
    ServiceDesc serviceDesc = service.getServiceDescription();
    String methodName = body.getMethodName();
    // FIXME (there should be a cleaner way to do this)
    OperationDesc operation = msgContext.getOperation();
    if (operation == null) {
        QName qname = new QName(body.getNamespaceURI(), body.getName());
        operation = serviceDesc.getOperationByElementQName(qname);
        if (operation == null) {
            SOAPConstants soapConstants = msgContext == null ? SOAPConstants.SOAP11_CONSTANTS : msgContext.getSOAPConstants();
            if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
                AxisFault fault = new AxisFault(Constants.FAULT_SOAP12_SENDER, Messages.getMessage("noSuchOperation", methodName), null, null);
                fault.addFaultSubCode(Constants.FAULT_SUBCODE_PROC_NOT_PRESENT);
                throw new SAXException(fault);
            } else {
                throw new AxisFault(Constants.FAULT_CLIENT, Messages.getMessage("noSuchOperation", methodName), null, null);
            }
        } else {
            msgContext.setOperation(operation);
        }
    }
    return operation;
}

14 View Complete Implementation : TestSer.java
Copyright Apache License 2.0
Author : apache
/**
 * Confirm that default namespaces when writing doc/lit messages don't
 * trample namespace mappings.
 *
 * @throws Exception
 */
public void testDefaultNamespace() throws Exception {
    MessageContext msgContext = new MessageContext(new AxisServer());
    String req = "<xsd1:A xmlns:xsd1=\"urn:myNamespace\">" + // Note that B and C are in no namespace!
    "<B>" + "<C>foo bar</C>" + "</B>" + "</xsd1:A>";
    StringWriter stringWriter = new StringWriter();
    StringReader reqReader = new StringReader(req);
    InputSource reqSource = new InputSource(reqReader);
    Doreplacedent doreplacedent = XMLUtils.newDoreplacedent(reqSource);
    String msgString = null;
    SOAPEnvelope msg = new SOAPEnvelope();
    RPCParam arg1 = new RPCParam("urn:myNamespace", "testParam", doreplacedent.getFirstChild());
    arg1.setXSITypeGeneration(Boolean.FALSE);
    RPCElement body = new RPCElement("urn:myNamespace", "method1", new Object[] { arg1 });
    msg.addBodyElement(body);
    body.setEncodingStyle(Constants.URI_LITERAL_ENC);
    SerializationContext context = new SerializationContext(stringWriter, msgContext);
    msg.output(context);
    msgString = stringWriter.toString();
    // Now reparse into DOM so we can check namespaces.
    StringReader resReader = new StringReader(msgString);
    InputSource resSource = new InputSource(resReader);
    Doreplacedent doc = XMLUtils.newDoreplacedent(resSource);
    // Go make sure B and C are in fact in no namespace
    Element el = findChildElementByLocalName(doc.getDoreplacedentElement(), "B");
    replacedertNotNull("Couldn't find <B> element!", el);
    replacedertNull("Element <B> has a namespace!", el.getNamespaceURI());
    el = findChildElementByLocalName(el, "C");
    replacedertNotNull("Couldn't find <C> element!", el);
    replacedertNull("Element <C> has a namespace!", el.getNamespaceURI());
}

14 View Complete Implementation : HTTPTransport.java
Copyright Apache License 2.0
Author : apache
/**
 * Set up any transport-specific derived properties in the message context.
 * @param mc the context to set up
 * @param call the call (unused?)
 * @param engine the engine containing the registries
 * @throws AxisFault if service cannot be found
 */
public void setupMessageContextImpl(MessageContext mc, Call call, AxisEngine engine) throws AxisFault {
    if (action != null) {
        mc.setUseSOAPAction(true);
        mc.setSOAPActionURI(action);
    }
    // Set up any cookies we know about
    if (cookie != null)
        mc.setProperty(HTTPConstants.HEADER_COOKIE, cookie);
    if (cookie2 != null)
        mc.setProperty(HTTPConstants.HEADER_COOKIE2, cookie2);
    // Allow the SOAPAction to determine the service, if the service
    // (a) has not already been determined, and (b) if a service matching
    // the soap action has been deployed.
    if (mc.getService() == null) {
        mc.setTargetService((String) mc.getSOAPActionURI());
    }
}

14 View Complete Implementation : TestSOAPService.java
Copyright Apache License 2.0
Author : apache
public void testRequestHandlerThrowsRuntimeException() throws Exception {
    SOAPService soapService = new SOAPService();
    // SETUP THE 2nd HANDLER IN THE REQUEST CHAIN TO THROW JAXRPCException
    handler1Config.put("HANDLE_REQUEST_RETURN_VALUE", new RuntimeException());
    TestHandlerInfoChainFactory factory = buildInfoChainFactory();
    soapService.setOption(Constants.ATTR_HANDLERINFOCHAIN, factory);
    soapService.init();
    MessageContext msgContext = new TestMessageContext();
    try {
        soapService.invoke(msgContext);
    } catch (AxisFault e) {
        AAAHandler handlerZero = factory.getHandlers()[0];
        AAAHandler handlerOne = factory.getHandlers()[1];
        AAAHandler handlerTwo = factory.getHandlers()[2];
        replacedertHandlerRuntime("handlerZero", handlerZero, 1, 0, 0);
        replacedertHandlerRuntime("handlerOne", handlerOne, 1, 0, 0);
        replacedertHandlerRuntime("handlerTwo", handlerTwo, 0, 0, 0);
    }
}

14 View Complete Implementation : JWSHandler.java
Copyright Apache License 2.0
Author : apache
/**
 * Just set up the service, the inner service will do the rest...
 */
public void invoke(MessageContext msgContext) throws AxisFault {
    if (log.isDebugEnabled()) {
        log.debug("Enter: JWSHandler::invoke");
    }
    try {
        setupService(msgContext);
    } catch (Exception e) {
        log.error(Messages.getMessage("exception00"), e);
        throw AxisFault.makeFault(e);
    }
}