axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Norman Kubicek (JIRA)" <j...@apache.org>
Subject [jira] Created: (AXIS2-3977) Incorrect method parameter names in WSDL document if service method signature is defined in an interface instead of a class
Date Tue, 19 Aug 2008 17:31:44 GMT
Incorrect method parameter names in WSDL document if service method signature is defined in
an interface instead of a class
---------------------------------------------------------------------------------------------------------------------------

                 Key: AXIS2-3977
                 URL: https://issues.apache.org/jira/browse/AXIS2-3977
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: kernel
    Affects Versions: 1.4
            Reporter: Norman Kubicek


The signature of the service method is defined in a Java interface instead of a class:

  public interface CustomerService
  {
      public Customer getCustomer(String ID);
  }

Web service requests for all methods are processed from a dynamically created class (java.lang.reflect.Proxy)
that implements the interface defining the service method (CustomerService). The intention
behind is to obtain a central entry point for different Web services requests.

  public class ServiceInvocationHandler implements InvocationHandler
  {
    public Object invoke(Object proxy, Method method, Object[] args)
              throws Throwable 
     {
          ...
          // process Web service requests for all methods
         ...
      }
  }

The proxy is created by a ServiceObjectSupplier instance:

  public class MyServiceObjectSupplier implements ServiceObjectSupplier
  {
      /**
       * The service interface, specified in the service.xml file
       */
      public static final String SERVICE_CLASS = "ServiceClass";

      public Object getServiceObject(AxisService axisService) throws AxisFault 
      {
          // create service invocation handler
          ServiceInvocationHandler handler = null;
          handler = new ServiceInvocationHandler();

          // get the name of the interface from the service.xml file
          Parameter proxyName = axisService.getParameter(SERVICE_CLASS);
        
          // create the dynamic proxy
          try
          {
              Class proxyClass = Class.forName(((String)proxyName.getValue()).trim());
              Object proxy = Proxy.newProxyInstance(proxyClass.getClassLoader(),  new Class[]
{ proxyClass }, handler);
              return proxy;
          }
          catch (ClassNotFoundException ex)  {
              ex.printStackTrace();
          }
          return null;
      }
  }

The ServiceObjectSupplier and the interface that is implemented by the proxy are specified
in the service.xml file

<service name="CustomerService">
    <parameter name="ServiceClass" locked="false">CustomerService</parameter>
    <parameter name="ServiceObjectSupplier" locked="false">MyServiceObjectSupplier</parameter>
    <operation name="getCustomer">
        <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
    </operation>
</service>

(For reasons of clarity the source code above is simplified.)

The RPCMessageReceiver and the ServiceObjectSupplier mechanism are used to be able to generate
WSDL automatically. All works fine. The WSDL document is generated w/o any errors and service
calls finish successfully.
There is only one issue in the WSDL document generated by Axis2. The names of the parameters
specified in the signature of the service method are ignored and replaced by names like "param0",
"param1" and so on. So the generated WSDL document looks like:

  <xs:element name="getCustomer">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

instead of:

  <xs:element name="getCustomer">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" name="ID" nillable="true" type="xs:string"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

if the signature of the service method is specified in a class.

I'm not sure if this is really an issue or common behaviour. Is it allowed to specify the
signature of a service method in a Java interface? During the deployment and the WSDL generation
there is no warning or error.
Is it correct that this interface is only implemented by a dynamic proxy instead of delivering
an implementation class?


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Mime
View raw message