Package org.apache.axis2.jaxws.message

Examples of org.apache.axis2.jaxws.message.Message


        // Enable MTOM on the Message if the property was set on the SOAPBinding.
        Binding bnd = (Binding) getBinding();
        if (bnd != null && bnd instanceof SOAPBinding) {
            if (((SOAPBinding)bnd).isMTOMEnabled()) {
                Message requestMsg = request.getMessage();
                requestMsg.setMTOMEnabled(true);
                int threshold = ((org.apache.axis2.jaxws.binding.SOAPBinding)bnd).getMTOMThreshold();
                request.setProperty(org.apache.axis2.Constants.Configuration.MTOM_THRESHOLD,
                        new Integer(threshold));
            }
            if (((org.apache.axis2.jaxws.binding.SOAPBinding)bnd).isRespectBindingEnabled()) {
View Full Code Here


        ClassLoader cl = chooseClassLoader(seiClazz, serviceDesc);
       
        // Make sure the same classloader is used on the response
        request.setProperty(Constants.CACHE_CLASSLOADER, cl);
       
        Message message = MethodMarshallerFactory.getMarshaller(operationDesc, true, null)
                .marshalRequest(args, operationDesc, this.getRequestContext());

        if (log.isDebugEnabled()) {
            log.debug("Request Message created successfully.");
        }
View Full Code Here

     * @param operationDesc   - The OperationDescription that for the invoked method.
     * @return
     */
    protected Object createResponse(Method method, Object[] args, MessageContext responseContext,
                                    OperationDescription operationDesc) throws Throwable {
        Message responseMsg = responseContext.getMessage();
        try {

            if (log.isDebugEnabled()) {
                log.debug("Processing the response Message to create the return value(s).");
            }

            // Find out if there was a fault on the response and create the appropriate
            // exception type.
            if (hasFaultResponse(responseContext)) {
                Throwable t = getFaultResponse(responseContext, operationDesc);
                throw t;
            }
           
            // Get the classloader that was used for the request processing
            ClassLoader cl = (ClassLoader) responseContext.getProperty(Constants.CACHE_CLASSLOADER);
            if (cl == null) {
                InvocationContext ic = responseContext.getInvocationContext();
                if (ic != null) {
                    MessageContext requestMC = ic.getRequestMessageContext();
                    if (requestMC != null) {
                        cl = (ClassLoader) responseContext.getProperty(Constants.CACHE_CLASSLOADER);
                        if (cl != null) {
                            if (log.isDebugEnabled()) {
                                log.debug("Obtained ClassLoader for the request context: " + cl);
                            }
                        }
                    }
                }
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("Obtained ClassLoader for the response context: " + cl);
                }
            }
            Object object =
                    MethodMarshallerFactory.getMarshaller(operationDesc, true, cl)
                                       .demarshalResponse(responseMsg, args, operationDesc);
            if (log.isDebugEnabled()) {
                log.debug("The response was processed and the return value created successfully.");
            }
            return object;
        } finally {
            responseMsg.close();
            // Free incoming stream
            try {
                responseContext.freeInputStream();
            }
            catch (Throwable t) {
View Full Code Here

        }
    }

    protected static Throwable getFaultResponse(MessageContext msgCtx,
                                                OperationDescription opDesc) {
        Message msg = msgCtx.getMessage();
        //Operation Description for Async method does not store the fault description as Asyc operation
        //will never have throws clause in the method signature.
        //we will fetch the OperationDescription of the sync method and this should give us the
        //correct fault description so we can throw the right user defined exception.

        try {
            if (opDesc.isJAXWSAsyncClientMethod()) {
                opDesc = opDesc.getSyncOperation();
            }
            if (msg != null && msg.isFault()) {
                ClassLoader cl = (ClassLoader) msgCtx.getProperty(Constants.CACHE_CLASSLOADER);
                Object object = MethodMarshallerFactory.getMarshaller(opDesc, true, cl)
                .demarshalFaultResponse(msg, opDesc);
                if (log.isDebugEnabled() && object != null) {
                    log.debug("A fault was found and processed.");
View Full Code Here

       
        BlockFactory blkFactory = (JAXBBlockFactory) FactoryRegistry.getFactory(JAXBBlockFactory.class);
        Block block = blkFactory.createFrom(request, context, null);
       
        MessageFactory msgFactory = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
        Message msg = msgFactory.create(Protocol.soap11);
       
        msg.setBodyBlock(block);
       
        msg.setMTOMEnabled(true);
       
        SOAPEnvelope soapOM = (SOAPEnvelope) msg.getAsOMElement();
       
        OMOutputFormat format = new OMOutputFormat();
        format.setDoOptimize(true);
        format.setSOAP11(true);
              
View Full Code Here

            // be sure to use whatever handlerresolver is registered on the Service
            Binding binding = (Binding) getBinding();
            invocationContext.setHandlers(binding.getHandlerChain());

            Message requestMsg = createRequestMessage(obj);
          
            setupMessageProperties(requestMsg);
            requestMsgCtx.setMessage(requestMsg);

            // Migrate the properties from the client request context bag to
            // the request MessageContext.
            ApplicationContextMigratorUtil.performMigrationToMessageContext(
                    Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
                    getRequestContext(), requestMsgCtx);

            // Perform the WebServiceFeature configuration requested by the user.
            binding.configure(requestMsgCtx, this);

            // Send the request using the InvocationController
            ic.invoke(invocationContext);

            MessageContext responseMsgCtx = invocationContext.getResponseMessageContext();
            responseMsgCtx.setEndpointDescription(requestMsgCtx.getEndpointDescription());

            // Migrate the properties from the response MessageContext back
            // to the client response context bag.
            ApplicationContextMigratorUtil.performMigrationFromMessageContext(
                    Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
                    getResponseContext(), responseMsgCtx);

            if (hasFaultResponse(responseMsgCtx)) {
                WebServiceException wse = BaseDispatch.getFaultResponse(responseMsgCtx);
                throw wse;
            }

            Message responseMsg = responseMsgCtx.getMessage();
            Object returnObj = getValueFromMessage(responseMsg);

            //Check to see if we need to maintain session state
            checkMaintainSessionState(requestMsgCtx, invocationContext);
View Full Code Here

            // be sure to use whatever handlerresolver is registered on the Service
            Binding binding = (Binding) getBinding();
            invocationContext.setHandlers(binding.getHandlerChain());

            Message requestMsg = createRequestMessage(obj);

            setupMessageProperties(requestMsg);
            requestMsgCtx.setMessage(requestMsg);

            // Migrate the properties from the client request context bag to
View Full Code Here

            // be sure to use whatever handlerresolver is registered on the Service
            Binding binding = (Binding) getBinding();
            invocationContext.setHandlers(binding.getHandlerChain());

            Message requestMsg = createRequestMessage(obj);

            setupMessageProperties(requestMsg);
            requestMsgCtx.setMessage(requestMsg);

            // Migrate the properties from the client request context bag to
View Full Code Here

            // be sure to use whatever handlerresolver is registered on the Service
            Binding binding = (Binding) getBinding();
            invocationContext.setHandlers(binding.getHandlerChain());

            Message requestMsg = createRequestMessage(obj);

            setupMessageProperties(requestMsg);
            requestMsgCtx.setMessage(requestMsg);

            // Migrate the properties from the client request context bag to
View Full Code Here

     *
     * @param msgCtx
     * @return
     */
    public static WebServiceException getFaultResponse(MessageContext msgCtx) {
        Message msg = msgCtx.getMessage();
        if (msg != null && msg.isFault()) {
            //XMLFault fault = msg.getXMLFault();
            // 4.3.2 conformance bullet 1 requires a ProtocolException here
            ProtocolException pe =
                    MethodMarshallerUtils.createSystemException(msg.getXMLFault(), msg);
            return pe;
        } else if (msgCtx.getLocalException() != null) {
            // use the factory, it'll throw the right thing:
            return ExceptionFactory.makeWebServiceException(msgCtx.getLocalException());
        }
View Full Code Here

TOP

Related Classes of org.apache.axis2.jaxws.message.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.