axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject svn commit: r701375 - in /webservices/axis2/trunk/java/modules: jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java kernel/src/org/apache/axis2/client/ServiceClient.java
Date Fri, 03 Oct 2008 13:25:46 GMT
Author: gdaniels
Date: Fri Oct  3 06:25:46 2008
New Revision: 701375

URL: http://svn.apache.org/viewvc?rev=701375&view=rev
Log:
* Don't swallow exceptions in tests! 

* Code cleanup

Modified:
    webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java

Modified: webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java?rev=701375&r1=701374&r2=701375&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java
(original)
+++ webservices/axis2/trunk/java/modules/jaxws-integration/test/org/apache/axis2/jaxws/handler/header/tests/HandlerTests.java
Fri Oct  3 06:25:46 2008
@@ -21,7 +21,6 @@
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
 import org.apache.axis2.jaxws.TestLogger;
 import org.apache.axis2.jaxws.framework.AbstractTestCase;
 
@@ -34,41 +33,37 @@
     public static Test suite() {
         return getTestSetup(new TestSuite(HandlerTests.class));
     }
-    
-    public void testHandler_getHeader_invocation(){
+
+    public void testHandler_getHeader_invocation() {
         TestLogger.logger.debug("----------------------------------");
         TestLogger.logger.debug("test: " + getName());
-        Object res = null;
+        Object res;
         //Add myHeader to SOAPMessage that will be injected by handler.getHeader().
-        String soapMessage = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
+        String soapMessage =
+                "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
         String url = "http://localhost:6060/axis2/services/DemoService.DemoServicePort";
         QName name = new QName("http://demo/", "DemoService");
         QName portName = new QName("http://demo/", "DemoServicePort");
-        try {
-            //Create Service
-            Service s = Service.create(name);
-            assertNotNull(s);
-            //add port
-            s.addPort(portName, null, url);
-            
-            //Create Dispatch
-            Dispatch<String> dispatch = s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
-            assertNotNull(dispatch);
-            res = dispatch.invoke(soapMessage);
-            assertNotNull(res);
-            TestLogger.logger.debug("----------------------------------");
-        } catch(Exception e) {
-            TestLogger.logger.debug("Caught unexpected exception", e);
-            fail("Caught unexpected exception " + e);
-        }       
+        //Create Service
+        Service s = Service.create(name);
+        assertNotNull(s);
+        //add port
+        s.addPort(portName, null, url);
+
+        //Create Dispatch
+        Dispatch<String> dispatch = s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
+        assertNotNull(dispatch);
+        res = dispatch.invoke(soapMessage);
+        assertNotNull(res);
+        TestLogger.logger.debug("----------------------------------");
     }
-    
-    public void test_MU_Failure(){
+
+    public void test_MU_Failure() {
         TestLogger.logger.debug("----------------------------------");
         TestLogger.logger.debug("test: " + getName());
-        Object res = null;
-        //Add bad header to SOAPMessage, we expect MU to fail 
-        String soapMessage = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:badHeader soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
+        //Add bad header to SOAPMessage, we expect MU to fail
+        String soapMessage =
+                "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:badHeader soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
         String url = "http://localhost:6060/axis2/services/DemoService.DemoServicePort";
         QName name = new QName("http://demo/", "DemoService");
         QName portName = new QName("http://demo/", "DemoServicePort");
@@ -77,96 +72,90 @@
             Service s = Service.create(name);
             assertNotNull(s);
             //add port
-            s.addPort(portName, null, url);                
+            s.addPort(portName, null, url);
             //Create Dispatch
-            Dispatch<String> dispatch = s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
+            Dispatch<String> dispatch =
+                    s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
             assertNotNull(dispatch);
-            res = dispatch.invoke(soapMessage);
+            dispatch.invoke(soapMessage);
             fail("Did not get expected SOAPFaultException for not understood MustUnderstand
header");
             TestLogger.logger.debug("----------------------------------");
-        } catch(SOAPFaultException e) {       	
+        } catch (SOAPFaultException e) {
             TestLogger.logger.debug("Got expected SOAPFault", e);
-            assertTrue(e.toString().indexOf("Must Understand check failed for header soap
: {http://demo/}badHeader") != -1);
+            assertTrue(e.toString().indexOf(
+                    "Must Understand check failed for header soap : {http://demo/}badHeader")
!=
+                                                                                        
     -1);
             TestLogger.logger.debug("MustUnderstand failed as exptected");
             TestLogger.logger.debug("----------------------------------");
-        }       
+        }
     }
-    
+
     /**
-     * Test that a mustUnderstand header with a specific SOAP role that the endpoint is acting
in 
+     * Test that a mustUnderstand header with a specific SOAP role that the endpoint is acting
in
      * doesn't cause a NotUnderstood fault if the header QName is one that the handler understands.
      */
     public void testSoapRoleActedIn() {
         TestLogger.logger.debug("----------------------------------");
         TestLogger.logger.debug("test: " + getName());
-        Object res = null;
+        Object res;
         //Add myHeader to SOAPMessage that will be injected by handler.getHeader().
-        String soapMessage = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader soap:actor=\"http://DemoHandler/Role\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
+        String soapMessage =
+                "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader soap:actor=\"http://DemoHandler/Role\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
         String url = "http://localhost:6060/axis2/services/DemoService.DemoServicePort";
         QName name = new QName("http://demo/", "DemoService");
         QName portName = new QName("http://demo/", "DemoServicePort");
-        try {
-            //Create Service
-            Service s = Service.create(name);
-            assertNotNull(s);
-            //add port
-            s.addPort(portName, null, url);
-            
-            //Create Dispatch
-            Dispatch<String> dispatch = s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
-            assertNotNull(dispatch);
-            res = dispatch.invoke(soapMessage);
-            assertNotNull(res);
-            TestLogger.logger.debug("----------------------------------");
-        } catch(Exception e) {
-            TestLogger.logger.debug("Caught unexpected exception", e);
-            fail("Caught unexpected exception " + e);
-        }       
+        //Create Service
+        Service s = Service.create(name);
+        assertNotNull(s);
+        //add port
+        s.addPort(portName, null, url);
+
+        //Create Dispatch
+        Dispatch<String> dispatch = s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
+        assertNotNull(dispatch);
+        res = dispatch.invoke(soapMessage);
+        assertNotNull(res);
+        TestLogger.logger.debug("----------------------------------");
     }
-    
+
     /**
-     * Test that a mustUnderstand header with a specific SOAP role that the endpoint is acting
in 
+     * Test that a mustUnderstand header with a specific SOAP role that the endpoint is acting
in
      * doesn't cause a NotUnderstood fault if the header QName is one that the handler understands.
      */
     public void testSoapRoleNotActedIn() {
         TestLogger.logger.debug("----------------------------------");
         TestLogger.logger.debug("test: " + getName());
-        Object res = null;
+        Object res;
         //Add myHeader to SOAPMessage that will be injected by handler.getHeader().
-        String soapMessage = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader soap:actor=\"http://DemoHandler/NotActedIn\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
+        String soapMessage =
+                "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myheader soap:actor=\"http://DemoHandler/NotActedIn\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
         String url = "http://localhost:6060/axis2/services/DemoService.DemoServicePort";
         QName name = new QName("http://demo/", "DemoService");
         QName portName = new QName("http://demo/", "DemoServicePort");
-        try {
-            //Create Service
-            Service s = Service.create(name);
-            assertNotNull(s);
-            //add port
-            s.addPort(portName, null, url);
-            
-            //Create Dispatch
-            Dispatch<String> dispatch = s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
-            assertNotNull(dispatch);
-            res = dispatch.invoke(soapMessage);
-            assertNotNull(res);
-            TestLogger.logger.debug("----------------------------------");
-        } catch(Exception e) {
-            TestLogger.logger.debug("Caught unexpected exception", e);
-            fail("Caught unexpected exception " + e);
-        }       
+        //Create Service
+        Service s = Service.create(name);
+        assertNotNull(s);
+        //add port
+        s.addPort(portName, null, url);
+
+        //Create Dispatch
+        Dispatch<String> dispatch = s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
+        assertNotNull(dispatch);
+        res = dispatch.invoke(soapMessage);
+        assertNotNull(res);
+        TestLogger.logger.debug("----------------------------------");
     }
 
     /**
      * Test that a mustUnderstand header with a specific SOAP role that the endpoint is acting
in
-     * which has a mustUnderstand header that will not be processed by the handler 
-     * causes a fault.
+     * which has a mustUnderstand header that will not be processed by the handler causes
a fault.
      */
     public void testSoapRoleActedInNotUnderstoodFault() {
         TestLogger.logger.debug("----------------------------------");
         TestLogger.logger.debug("test: " + getName());
-        Object res = null;
         //Add myHeader to SOAPMessage that will be injected by handler.getHeader().
-        String soapMessage = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myNOTUNDERSTOODheader soap:actor=\"http://DemoHandler/Role\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
+        String soapMessage =
+                "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:demo=\"http://demo/\"><soap:Header> <demo:myNOTUNDERSTOODheader soap:actor=\"http://DemoHandler/Role\"
soap:mustUnderstand=\"1\"/></soap:Header><soap:Body><demo:echo><arg0>test</arg0></demo:echo></soap:Body></soap:Envelope>";
         String url = "http://localhost:6060/axis2/services/DemoService.DemoServicePort";
         QName name = new QName("http://demo/", "DemoService");
         QName portName = new QName("http://demo/", "DemoServicePort");
@@ -176,17 +165,20 @@
             assertNotNull(s);
             //add port
             s.addPort(portName, null, url);
-            
+
             //Create Dispatch
-            Dispatch<String> dispatch = s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
+            Dispatch<String> dispatch =
+                    s.createDispatch(portName, String.class, Service.Mode.MESSAGE);
             assertNotNull(dispatch);
-            res = dispatch.invoke(soapMessage);
+            dispatch.invoke(soapMessage);
             fail("Did not received expected notUnderstood fault");
-        } catch(Exception e) {
+        } catch (Exception e) {
             TestLogger.logger.debug("Caught expected exception", e);
-            assertTrue(e.toString().indexOf("Must Understand check failed for header soap
: {http://demo/}myNOTUNDERSTOODheader") != -1);
+            assertTrue(e.toString().indexOf(
+                    "Must Understand check failed for header soap : {http://demo/}myNOTUNDERSTOODheader")
!=
+                                                                                        
                 -1);
             TestLogger.logger.debug("----------------------------------");
-        }       
+        }
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?rev=701375&r1=701374&r2=701375&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
Fri Oct  3 06:25:46 2008
@@ -48,57 +48,52 @@
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.ListenerManager;
 import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.namespace.Constants;
 import org.apache.axis2.util.Counter;
 import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.axis2.namespace.Constants;
-
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
 import java.net.URL;
 import java.util.ArrayList;
-import java.util.Iterator;
 
 /**
- * Client access to a service. Each instance of this class is associated with a
- * particular {@link org.apache.axis2.description.AxisService}, and the methods
- * support operations using that service. {@link Options} instances are used to
- * configure various aspects of the service access.
+ * Client access to a service. Each instance of this class is associated with a particular
{@link
+ * org.apache.axis2.description.AxisService}, and the methods support operations using that
service.
+ * {@link Options} instances are used to configure various aspects of the service access.
  */
 public class ServiceClient {
     protected static final Log log = LogFactory.getLog(ServiceClient.class);
 
-    /**
-     * Base name used for a service created without an existing configuration.
-     */
+    /** Base name used for a service created without an existing configuration. */
     public static final String ANON_SERVICE = "anonService";
 
     /** Counter used to generate the anonymous service name. */
     private static Counter anonServiceCounter = new Counter();
 
     /**
-     * Operation name used for an anonymous out-only operation (meaning we send
-     * a message with no response allowed from the service, equivalent to a WSDL
-     * In-Only operation).
+     * Operation name used for an anonymous out-only operation (meaning we send a message
with no
+     * response allowed from the service, equivalent to a WSDL In-Only operation).
      */
     public static final QName ANON_OUT_ONLY_OP = new QName(
             Constants.AXIS2_NAMESPACE_URI, "anonOutonlyOp", Constants.AXIS2_NAMESPACE_PREFIX);
 
     /**
-     * Operation name used for an anonymous robust-out-only operation
-     * (meaning we send a message, with the only possible response a fault,
-     * equivalent to a WSDL Robust-In-Only operation).
+     * Operation name used for an anonymous robust-out-only operation (meaning we send a
message,
+     * with the only possible response a fault, equivalent to a WSDL Robust-In-Only operation).
      */
     public static final QName ANON_ROBUST_OUT_ONLY_OP = new QName(
             Constants.AXIS2_NAMESPACE_URI, "anonRobustOp", Constants.AXIS2_NAMESPACE_PREFIX);
 
     /**
-     * Operation name used for an anonymous in-out operation (meaning we sent a
-     * message and receive a response, equivalent to a WSDL In-Out operation).
+     * Operation name used for an anonymous in-out operation (meaning we sent a message and
receive
+     * a response, equivalent to a WSDL In-Out operation).
      */
-    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI, "anonOutInOp",
Constants.AXIS2_NAMESPACE_PREFIX);
+    public static final QName ANON_OUT_IN_OP = new QName(Constants.AXIS2_NAMESPACE_URI,
+                                                         "anonOutInOp",
+                                                         Constants.AXIS2_NAMESPACE_PREFIX);
 
     // the meta-data of the service that this client access
     private AxisService axisService;
@@ -123,23 +118,21 @@
 
     //whether we create configctx or not
     private boolean createConfigCtx;
-    
+
     private int hashCode;
 
     private boolean removeAxisService;
 
     /**
-     * Create a service client configured to work with a specific AxisService.
-     * If this service is already in the world that's handed in (in the form of
-     * a ConfigurationContext) then I will happily work in it. If not I will
-     * create a small little virtual world and live there.
-     *
-     * @param configContext The configuration context under which this service lives (may
-     *                      be null, in which case a new local one will be created)
-     * @param axisService   The service for which this is the client (may be
-     *                      <code>null</code>, in which case an anonymous service
will be created)
-     * @throws AxisFault if something goes wrong while creating a config context (if
-     *                   needed)
+     * Create a service client configured to work with a specific AxisService. If this service
is
+     * already in the world that's handed in (in the form of a ConfigurationContext) then
I will
+     * happily work in it. If not I will create a small little virtual world and live there.
+     *
+     * @param configContext The configuration context under which this service lives (may
be null,
+     *                      in which case a new local one will be created)
+     * @param axisService   The service for which this is the client (may be <code>null</code>,
in
+     *                      which case an anonymous service will be created)
+     * @throws AxisFault if something goes wrong while creating a config context (if needed)
      */
     public ServiceClient(ConfigurationContext configContext,
                          AxisService axisService) throws AxisFault {
@@ -159,7 +152,7 @@
             }
         }
         this.configContext = configContext;
-        hashCode = (int) anonServiceCounter.incrementAndGet();
+        hashCode = (int)anonServiceCounter.incrementAndGet();
 
         // Initialize transports
         ListenerManager transportManager = configContext.getListenerManager();
@@ -192,13 +185,13 @@
 
 
     /**
-     * This is WSDL4J based constructor to configure the Service Client/
-     * TODO: make this policy aware
+     * This is WSDL4J based constructor to configure the Service Client/ TODO: make this
policy
+     * aware
      *
-     * @param configContext active ConfigurationContext
+     * @param configContext    active ConfigurationContext
      * @param wsdl4jDefinition the WSDL we're going to be using to configure ourselves
-     * @param wsdlServiceName QName of the WSDL service we'd like to access
-     * @param portName name of the WSDL port we'd like to access
+     * @param wsdlServiceName  QName of the WSDL service we'd like to access
+     * @param portName         name of the WSDL port we'd like to access
      * @throws AxisFault in case of error
      */
 
@@ -209,18 +202,17 @@
     }
 
     /**
-     * Create a service client for WSDL service identified by the QName of the
-     * wsdl:service element in a WSDL document.
+     * Create a service client for WSDL service identified by the QName of the wsdl:service
element
+     * in a WSDL document.
      *
-     * @param configContext   The configuration context under which this service lives (may
-     *                        be <code>null</code>, in which case a new local
one will be created) *
+     * @param configContext   The configuration context under which this service lives (may
be
+     *                        <code>null</code>, in which case a new local one
will be created) *
      * @param wsdlURL         The URL of the WSDL document to read
-     * @param wsdlServiceName The QName of the WSDL service in the WSDL document to create
a
-     *                        client for
-     * @param portName        The name of the WSDL 1.1 port to create a client for. May be
-     *                        null (if WSDL 2.0 is used or if only one port is there). .
-     * @throws AxisFault if something goes wrong while creating a config context (if
-     *                   needed)
+     * @param wsdlServiceName The QName of the WSDL service in the WSDL document to create
a client
+     *                        for
+     * @param portName        The name of the WSDL 1.1 port to create a client for. May be
null (if
+     *                        WSDL 2.0 is used or if only one port is there). .
+     * @throws AxisFault if something goes wrong while creating a config context (if needed)
      */
     public ServiceClient(ConfigurationContext configContext, URL wsdlURL,
                          QName wsdlServiceName, String portName) throws AxisFault {
@@ -229,11 +221,13 @@
                                                                                       portName,
                                                                                       options));
         Parameter transportName = axisService.getParameter("TRANSPORT_NAME");
-        if(transportName != null ) {
-            TransportOutDescription transportOut = configContext.getAxisConfiguration().getTransportOut(
-                    transportName.getValue().toString());
+        if (transportName != null) {
+            TransportOutDescription transportOut =
+                    configContext.getAxisConfiguration().getTransportOut(
+                            transportName.getValue().toString());
             if (transportOut == null) {
-                throw new AxisFault("Cannot load transport from binding, either defin in
Axis2.config " +
+                throw new AxisFault(
+                        "Cannot load transport from binding, either defin in Axis2.config
" +
                         "or set it explicitely in ServiceClinet.Options");
             } else {
                 options.setTransportOut(transportOut);
@@ -242,8 +236,8 @@
     }
 
     /**
-     * Create a service client by assuming an anonymous service and any other
-     * necessary information.
+     * Create a service client by assuming an anonymous service and any other necessary
+     * information.
      *
      * @throws AxisFault in case of error
      */
@@ -252,8 +246,8 @@
     }
 
     /**
-     * Create an anonymous axisService with one (anonymous) operation for each
-     * MEP that we support dealing with anonymously using the convenience APIs.
+     * Create an anonymous axisService with one (anonymous) operation for each MEP that we
support
+     * dealing with anonymously using the convenience APIs.
      *
      * @return the minted anonymous service
      */
@@ -279,18 +273,19 @@
     }
 
     /**
-     * Returns the AxisConfiguration associated with the client.    
+     * Get the AxisConfiguration
+     *
+     * @return the AxisConfiguration associated with the client.
      */
     public AxisConfiguration getAxisConfiguration() {
-        synchronized(this.axisConfig) {
+        synchronized (this.axisConfig) {
             return axisConfig;
         }
     }
 
     /**
-     * Return the AxisService this is a client for. This is primarily useful
-     * when the AxisService is created anonymously or from WSDL as otherwise the
-     * user had the AxisService to start with.
+     * Return the AxisService this is a client for. This is primarily useful when the AxisService
is
+     * created anonymously or from WSDL as otherwise the user had the AxisService to start
with.
      *
      * @return the axisService
      */
@@ -317,10 +312,9 @@
     }
 
     /**
-     * Set a client configuration to override the normal options used by an
-     * operation client. Any values set in this configuration will be used for
-     * each client, with the standard values for the client still used for any
-     * values not set in the override configuration.
+     * Set a client configuration to override the normal options used by an operation client.
Any
+     * values set in this configuration will be used for each client, with the standard values
for
+     * the client still used for any values not set in the override configuration.
      *
      * @param overrideOptions the Options to use
      */
@@ -329,8 +323,7 @@
     }
 
     /**
-     * Get the client configuration used to override the normal options set by
-     * an operation client.
+     * Get the client configuration used to override the normal options set by an operation
client.
      *
      * @return override options
      */
@@ -341,9 +334,9 @@
     /**
      * Engage a module for this service client.
      *
-     * @deprecated Please use String version instead
      * @param moduleName name of the module to engage
      * @throws AxisFault if something goes wrong
+     * @deprecated Please use String version instead
      */
     public void engageModule(QName moduleName) throws AxisFault {
         engageModule(moduleName.getLocalPart());
@@ -369,8 +362,8 @@
     /**
      * Disengage a module for this service client
      *
-     * @deprecated Please use String version instead
      * @param moduleName name of Module to disengage
+     * @deprecated Please use String version instead
      */
     public void disengageModule(QName moduleName) {
         disengageModule(moduleName.getLocalPart());
@@ -395,8 +388,7 @@
     }
 
     /**
-     * Add an arbitrary XML element as a header to be sent with outgoing
-     * messages.
+     * Add an arbitrary XML element as a header to be sent with outgoing messages.
      *
      * @param header header to be sent (non-<code>null</code>)
      */
@@ -419,9 +411,7 @@
         headers.add(header);
     }
 
-    /**
-     * Remove all headers for outgoing message.
-     */
+    /** Remove all headers for outgoing message. */
     public void removeHeaders() {
         if (headers != null) {
             headers.clear();
@@ -447,14 +437,13 @@
     }
 
     /**
-     * Directly invoke an anonymous operation with a Robust In-Only MEP. This
-     * method just sends your supplied XML and possibly receives a fault. For
-     * more control, you can instead create a client for the operation and use
-     * that client to execute the send.
+     * Directly invoke an anonymous operation with a Robust In-Only MEP. This method just
sends your
+     * supplied XML and possibly receives a fault. For more control, you can instead create
a client
+     * for the operation and use that client to execute the send.
      *
      * @param elem XML to send
-     * @throws AxisFault if something goes wrong while sending, or if a fault is
-     *                   received in response (per the Robust In-Only MEP).
+     * @throws AxisFault if something goes wrong while sending, or if a fault is received
in
+     *                   response (per the Robust In-Only MEP).
      * @see #createClient(QName)
      */
     public void sendRobust(OMElement elem) throws AxisFault {
@@ -462,15 +451,14 @@
     }
 
     /**
-     * Directly invoke a named operation with a Robust In-Only MEP. This method
-     * just sends your supplied XML and possibly receives a fault. For more
-     * control, you can instead create a client for the operation and use that
-     * client to execute the send.
+     * Directly invoke a named operation with a Robust In-Only MEP. This method just sends
your
+     * supplied XML and possibly receives a fault. For more control, you can instead create
a client
+     * for the operation and use that client to execute the send.
      *
      * @param operation name of operation to be invoked (non-<code>null</code>)
      * @param elem      XML to send
-     * @throws AxisFault if something goes wrong while sending it or if a fault is
-     *                   received in response (per the Robust In-Only MEP).
+     * @throws AxisFault if something goes wrong while sending it or if a fault is received
in
+     *                   response (per the Robust In-Only MEP).
      * @see #createClient(QName)
      */
     public void sendRobust(QName operation, OMElement elem) throws AxisFault {
@@ -482,11 +470,10 @@
     }
 
     /**
-     * Directly invoke an anonymous operation with an In-Only MEP. This method
-     * just sends your supplied XML without the possibility of any response from
-     * the service (even an error - though you can still get client-side errors
-     * such as "Host not found"). For more control, you can instead create a
-     * client for the operation and use that client to execute the send.
+     * Directly invoke an anonymous operation with an In-Only MEP. This method just sends
your
+     * supplied XML without the possibility of any response from the service (even an error
- though
+     * you can still get client-side errors such as "Host not found"). For more control,
you can
+     * instead create a client for the operation and use that client to execute the send.
      *
      * @param elem XML to send
      * @throws AxisFault ff something goes wrong trying to send the XML
@@ -497,11 +484,10 @@
     }
 
     /**
-     * Directly invoke a named operation with an In-Only MEP. This method just
-     * sends your supplied XML without the possibility of any response from the
-     * service (even an error - though you can still get client-side errors such
-     * as "Host not found"). For more control, you can instead create a client
-     * for the operation and use that client to execute the send.
+     * Directly invoke a named operation with an In-Only MEP. This method just sends your
supplied
+     * XML without the possibility of any response from the service (even an error - though
you can
+     * still get client-side errors such as "Host not found"). For more control, you can
instead
+     * create a client for the operation and use that client to execute the send.
      *
      * @param operation name of operation to be invoked (non-<code>null</code>)
      * @param elem      XML to send
@@ -521,10 +507,9 @@
     }
 
     /**
-     * Directly invoke an anonymous operation with an In-Out MEP. This method
-     * sends your supplied XML and receives a response. For more control, you
-     * can instead create a client for the operation and use that client to
-     * execute the exchange.
+     * Directly invoke an anonymous operation with an In-Out MEP. This method sends your
supplied
+     * XML and receives a response. For more control, you can instead create a client for
the
+     * operation and use that client to execute the exchange.
      *
      * @param elem the data to send (becomes the content of SOAP body)
      * @return response
@@ -536,13 +521,12 @@
     }
 
     /**
-     * Directly invoke a named operationQName with an In-Out MEP. This method sends
-     * your supplied XML and receives a response. For more control, you can
-     * instead create a client for the operationQName and use that client to execute
-     * the exchange.
+     * Directly invoke a named operationQName with an In-Out MEP. This method sends your
supplied
+     * XML and receives a response. For more control, you can instead create a client for
the
+     * operationQName and use that client to execute the exchange.
      *
      * @param operationQName name of operationQName to be invoked (non-<code>null</code>)
-     * @param xmlPayload the data to send (becomes the content of SOAP body)
+     * @param xmlPayload     the data to send (becomes the content of SOAP body)
      * @return response OMElement
      * @throws AxisFault in case of error
      */
@@ -555,7 +539,7 @@
         operationClient.execute(true);
         MessageContext response = operationClient
                 .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-        if(options.isCallTransportCleanup()){
+        if (options.isCallTransportCleanup()) {
             response.getEnvelope().build();
             cleanupTransport();
         }
@@ -563,17 +547,17 @@
     }
 
     /**
-     * Directly invoke an anonymous operation with an In-Out MEP without waiting
-     * for a response. This method sends your supplied XML with response
-     * notification to your callback handler. For more control, you can instead
-     * create a client for the operation and use that client to execute the
-     * exchange.
+     * Directly invoke an anonymous operation with an In-Out MEP without waiting for a response.
+     * This method sends your supplied XML with response notification to your callback handler.
For
+     * more control, you can instead create a client for the operation and use that client
to
+     * execute the exchange.
      *
-     * @param elem the data to send (becomes the content of SOAP body)
+     * @param elem     the data to send (becomes the content of SOAP body)
      * @param callback a Callback which will be notified upon completion
      * @throws AxisFault in case of error
      * @see #createClient(QName)
-     * @deprecated Please use the AxisCallback interface rather than Callback, which has
been deprecated
+     * @deprecated Please use the AxisCallback interface rather than Callback, which has
been
+     *             deprecated
      */
     public void sendReceiveNonBlocking(OMElement elem, Callback callback)
             throws AxisFault {
@@ -581,13 +565,12 @@
     }
 
     /**
-     * Directly invoke an anonymous operation with an In-Out MEP without waiting
-     * for a response. This method sends your supplied XML with response
-     * notification to your callback handler. For more control, you can instead
-     * create a client for the operation and use that client to execute the
-     * exchange.
+     * Directly invoke an anonymous operation with an In-Out MEP without waiting for a response.
+     * This method sends your supplied XML with response notification to your callback handler.
For
+     * more control, you can instead create a client for the operation and use that client
to
+     * execute the exchange.
      *
-     * @param elem the data to send (becomes the content of SOAP body)
+     * @param elem     the data to send (becomes the content of SOAP body)
      * @param callback a Callback which will be notified upon completion
      * @throws AxisFault in case of error
      * @see #createClient(QName)
@@ -598,18 +581,18 @@
     }
 
     /**
-     * Directly invoke a named operation with an In-Out MEP without waiting for
-     * a response. This method sends your supplied XML with response
-     * notification to your callback handler. For more control, you can instead
-     * create a client for the operation and use that client to execute the
+     * Directly invoke a named operation with an In-Out MEP without waiting for a response.
This
+     * method sends your supplied XML with response notification to your callback handler.
For more
+     * control, you can instead create a client for the operation and use that client to
execute the
      * exchange.
      *
      * @param operation name of operation to be invoked (non-<code>null</code>)
-     * @param elem the data to send (becomes the content of SOAP body)
-     * @param callback a Callback which will be notified upon completion
+     * @param elem      the data to send (becomes the content of SOAP body)
+     * @param callback  a Callback which will be notified upon completion
      * @throws AxisFault in case of error
      * @see #createClient(QName)
-     * @deprecated Please use the AxisCallback interface rather than Callback, which has
been deprecated
+     * @deprecated Please use the AxisCallback interface rather than Callback, which has
been
+     *             deprecated
      */
     public void sendReceiveNonBlocking(QName operation, OMElement elem, Callback callback)
             throws AxisFault {
@@ -624,15 +607,14 @@
     }
 
     /**
-     * Directly invoke a named operation with an In-Out MEP without waiting for
-     * a response. This method sends your supplied XML with response
-     * notification to your callback handler. For more control, you can instead
-     * create a client for the operation and use that client to execute the
+     * Directly invoke a named operation with an In-Out MEP without waiting for a response.
This
+     * method sends your supplied XML with response notification to your callback handler.
For more
+     * control, you can instead create a client for the operation and use that client to
execute the
      * exchange.
      *
      * @param operation name of operation to be invoked (non-<code>null</code>)
-     * @param elem the data to send (becomes the content of SOAP body)
-     * @param callback a Callback which will be notified upon completion
+     * @param elem      the data to send (becomes the content of SOAP body)
+     * @param callback  a Callback which will be notified upon completion
      * @throws AxisFault in case of error
      * @see #createClient(QName)
      */
@@ -649,15 +631,13 @@
     }
 
     /**
-     * Create an operation client with the appropriate message exchange pattern
-     * (MEP). This method creates a full-function MEP client which can be used
-     * to exchange messages for a specific operation. It configures the
-     * constructed operation client to use the current normal and override
-     * options. This method is used internally, and also by generated client
-     * stub code.
+     * Create an operation client with the appropriate message exchange pattern (MEP). This
method
+     * creates a full-function MEP client which can be used to exchange messages for a specific
+     * operation. It configures the constructed operation client to use the current normal
and
+     * override options. This method is used internally, and also by generated client stub
code.
      *
-     * @param operationQName qualified name of operation (local name is operation
-     *                       name, namespace URI is just the empty string)
+     * @param operationQName qualified name of operation (local name is operation name, namespace
+     *                       URI is just the empty string)
      * @return client configured to talk to the given operation
      * @throws AxisFault if the operation is not found
      */
@@ -670,8 +650,8 @@
 
         // add the option properties to the service context
         String key;
-        for (Iterator iter = options.getProperties().keySet().iterator();iter.hasNext();){
-            key = (String) iter.next();
+        for (Object o : options.getProperties().keySet()) {
+            key = (String)o;
             serviceContext.setProperty(key, options.getProperties().get(key));
         }
         OperationClient operationClient = axisOperation.createClient(serviceContext, options);
@@ -687,9 +667,8 @@
     }
 
     /**
-     * Return the SOAP factory to use depending on what options have been set.
-     * If the SOAP version can not be seen in the options, version 1.1 is the
-     * default.
+     * Return the SOAP factory to use depending on what options have been set. If the SOAP
version
+     * can not be seen in the options, version 1.1 is the default.
      *
      * @return the SOAP factory
      * @see Options#setSoapVersionURI(String)
@@ -732,8 +711,8 @@
     public void addHeadersToEnvelope(SOAPEnvelope envelope) {
         if (headers != null) {
             SOAPHeader soapHeader = envelope.getHeader();
-            for (int i = 0; i < headers.size(); i++) {
-                soapHeader.addChild((OMElement) headers.get(i));
+            for (Object header : headers) {
+                soapHeader.addChild((OMElement)header);
             }
         }
     }
@@ -780,8 +759,9 @@
 
     /**
      * Sets whether or not to cache the last OperationContext
-     * @deprecated
+     *
      * @param cachingOpContext true if we should hold onto the last active OperationContext
+     * @deprecated
      */
     public void setCachingOperationContext(boolean cachingOpContext) {
         serviceContext.setCachingOperationContext(cachingOpContext);
@@ -803,9 +783,8 @@
     }
 
     /**
-     * Clean up configuration created with this client. Call this method when
-     * you're done using the client, in order to discard any associated
-     * resources.
+     * Clean up configuration created with this client. Call this method when you're done
using the
+     * client, in order to discard any associated resources.
      *
      * @throws AxisFault in case of error
      */
@@ -824,19 +803,20 @@
         }
     }
 
-    public void cleanupTransport() throws AxisFault{
-        if(getLastOperationContext()!=null){
+    public void cleanupTransport() throws AxisFault {
+        if (getLastOperationContext() != null) {
             MessageContext outMessageContext =
-                    getLastOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
-            if (outMessageContext!=null) {
+                    getLastOperationContext()
+                            .getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+            if (outMessageContext != null) {
                 outMessageContext.getTransportOut().getSender().cleanup(outMessageContext);
             }
         }
     }
 
     /**
-     * Configure the ServiceClient to interact with the Web service described by
-     * the specified AxisService object.
+     * Configure the ServiceClient to interact with the Web service described by the specified
+     * AxisService object.
      *
      * @param axisService the AxisService that represents the new Web service.
      * @throws AxisFault if an error occurs while configuring the ServiceClient.
@@ -848,7 +828,7 @@
             throw new IllegalArgumentException("AxisService is null");
         }
 
-        synchronized(this.axisConfig) {
+        synchronized (this.axisConfig) {
             axisConfig.removeService(this.axisService.getName());
             this.axisService = axisService;
 
@@ -861,27 +841,21 @@
         this.serviceContext = serviceGroupContext.getServiceContext(axisService);
     }
 
-	/**
-	 * @see java.lang.Object#hashCode()
-	 */
-	public int hashCode() {
-		return this.hashCode;
-	}
-
-	/**
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	public boolean equals(Object obj) {
-		if (this == obj)
-			return true;
-		if (obj == null)
-			return false;
-		if (!(obj instanceof ServiceClient))
-			return false;
-		final ServiceClient other = (ServiceClient) obj;
-		if (hashCode != other.hashCode)
-			return false;
-		return true;
-	}
-    
+    /** @see java.lang.Object#hashCode() */
+    public int hashCode() {
+        return this.hashCode;
+    }
+
+    /** @see java.lang.Object#equals(java.lang.Object) */
+    public boolean equals(Object obj) {
+        if (this == obj)
+            return true;
+        if (obj == null)
+            return false;
+        if (!(obj instanceof ServiceClient))
+            return false;
+        final ServiceClient other = (ServiceClient)obj;
+        return hashCode == other.hashCode;
+    }
+
 }



Mime
View raw message