Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * $Id: AxisMessageRequester.java 11079 2008-02-27 15:52:01Z tcarlson $
   * --------------------------------------------------------------------------------------
   * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
   *
   * The software in this package is published under the terms of the CPAL v1.0
   * license, a copy of which has been included with this distribution in the
   * LICENSE.txt file.
   */
 
 package org.mule.transport.soap.axis;
 
 
 
 
 import  org.apache.axis.AxisProperties;
 import  org.apache.axis.EngineConfiguration;
 import  org.apache.axis.Message;
 import  org.apache.axis.client.Call;
 import  org.apache.axis.client.Service;
 import  org.apache.axis.configuration.FileProvider;

AxisMessageDispatcher is used to make soap requests via the Axis soap client.
 
 {
 
     protected EngineConfiguration clientConfig;
     protected AxisConnector connector;
     protected Service service;
 
     public AxisMessageRequester(InboundEndpoint endpoint)
     {
         super(endpoint);
         this. = (AxisConnector)endpoint.getConnector();
         AxisProperties.setProperty("axis.doAutoTypes", Boolean.toString(.isDoAutoTypes()));
     }
 
     protected void doConnect() throws Exception
     {
         if ( == null)
         {
              = createService();
         }
     }
 
     protected void doDisconnect() throws Exception
     {
         if ( != null)
         {
              = null;
         }
     }
 
     protected void doDispose()
     {
         // template method
     }
 
     protected synchronized EngineConfiguration getClientConfig(ImmutableEndpoint endpoint)
     {
         if ( == null)
         {
             // Allow the client config to be set on the endpoint
             String config;
             config = (String)endpoint.getProperty(.);
 
             if (config != null)
             {
                  = new FileProvider(config);
             }
             else
             {
                  = .getClientProvider();
             }
         }
         return ;
     }
 
     protected Service createService(ImmutableEndpoint endpointthrows Exception
     {
         // Create a simple axis service without wsdl
         EngineConfiguration config = getClientConfig(endpoint);
         return new Service(config);
     }

    
Make a specific request to the underlying transport

Parameters:
timeout the maximum time the operation should block before returning. The call should return immediately if there is data available. If no data becomes available before the timeout elapses, null will be returned
Returns:
the result of the request wrapped in a MuleMessage object. Null will be returned if no data was avaialable
Throws:
Exception if the call to the underlying protocal cuases an exception
    protected MuleMessage doRequest(long timeoutthrows Exception
    {
        Call call = new Call();
        String uri = .getEndpointURI().toString();
        call.setSOAPActionURI(uri);
        call.setTargetEndpointAddress(uri);
        Properties params = .getEndpointURI().getUserParams();
        String method = (String)params.remove(.);
        call.setOperationName(method);
        String args[] = new String[params.size()];
        int i = 0;
        for (Iterator iterator = params.values().iterator(); iterator.hasNext(); i++)
        {
            args[i] = iterator.next().toString();
        }
        call.setOperationName(method);
        call.setProperty(.);
        Object result = call.invoke(methodargs);
        return AxisMessageDispatcher.createMessage(resultcall);
    }
    public MuleMessage request(String endpointObject[] argsthrows Exception
    {
        Call call = new Call();
        call.setSOAPActionURI(endpoint);
        call.setTargetEndpointAddress(endpoint);
        if (!endpoint.startsWith("axis:"))
        {
            endpoint = "axis:" + endpoint;
        }
        EndpointURI ep = new MuleEndpointURI(endpoint);
        call.setOperationName(method);
        call.setOperationName(method);
        Object result = call.invoke(methodargs);
        return AxisMessageDispatcher.createMessage(resultcall);
    }
    public MuleMessage request(String endpointSOAPEnvelope envelopethrows Exception
    {
        Call call = new Call();
        call.setSOAPActionURI(endpoint);
        call.setTargetEndpointAddress(endpoint);
        Object result = call.invoke(new Message(envelope));
        return AxisMessageDispatcher.createMessage(resultcall);
    }
New to GrepCode? Check out our FAQ X