You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Gilberto Ribeiro Olimpio (JIRA)" <ax...@ws.apache.org> on 2006/03/06 20:40:30 UTC

[jira] Commented: (AXIS-2396) two operations with same input/output type not getting invoked correctly

    [ http://issues.apache.org/jira/browse/AXIS-2396?page=comments#action_12369043 ] 

Gilberto Ribeiro Olimpio commented on AXIS-2396:
------------------------------------------------

I had the same problem with a webservice that i migrate from wasp to axis. 
I couldn't change the wsdl because I needed to keep the compatibility.

I used a WSDD file with this service:

----- 

  <service name="Login" provider="java:RPC" style="document" use="literal">
    <parameter name="wsdlTargetNamespace" value="http://mdsla.com/wsdl" />
    <parameter name="wsdlServiceElement" value="Login" />
    <parameter name="schemaQualified"
      value="http://idoox.com/interface,http://systinet.com/xsd/SchemaTypes/" />
    <parameter name="wsdlServicePort" value="Login" />
    <parameter name="className" value="com.mdsb.cea.ws.Login" />
    <parameter name="wsdlPortType" value="Login" />
    <parameter name="typeMappingVersion" value="1.2" />
    <operation name="validar" qname="validar"
      returnQName="retNS:string_Response"
      xmlns:retNS="http://systinet.com/xsd/SchemaTypes/"
      returnType="rtns:string" xmlns:rtns="http://www.w3.org/2001/XMLSchema"
      soapAction="http://mdsla.com/wsdlLogin#validar#KExqYXZhL2xhbmcvU3RyaW5nOylMamF2YS9sYW5nL1N0cmluZzs=">
      <parameter qname="pns:p0" xmlns:pns="http://systinet.com/xsd/SchemaTypes/"
        type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema" />
    </operation>
    <operation name="encerrar" qname="encerrar"
      returnQName="retNS:string_Response"
      xmlns:retNS="http://systinet.com/xsd/SchemaTypes/"
      returnType="rtns:string" xmlns:rtns="http://www.w3.org/2001/XMLSchema"
      soapAction="http://mdsla.com/wsdlLogin#encerrar#KExqYXZhL2xhbmcvU3RyaW5nOylMamF2YS9sYW5nL1N0cmluZzs=">
      <parameter qname="pns:p0" xmlns:pns="http://systinet.com/xsd/SchemaTypes/"
        type="tns:string" xmlns:tns="http://www.w3.org/2001/XMLSchema" />
    </operation>
    <parameter name="allowedMethods" value="encerrar validar" />
  </service>

----

Note that I have the same input type (pns:p0) for the 2 operations (encerrar, validar).

The problem with Axis is that it doesn't check the soapAction and (in this case) it allways use the first operation.

To solve this problem I change the method: 
public OperationDesc [] getPossibleOperationsByQName(QName qname) throws AxisFault
(in the class: org.apache.axis.MessageContext)

The original code:

---

                } else { 
                    // DOCUMENT Style 
                    // Get all of the operations that have qname as 
                    // a possible parameter QName 
                    ArrayList allOperations = desc.getOperations(); 
                    ArrayList foundOperations = new ArrayList(); 
                    for (int i=0; i < allOperations.size(); i++ ) { 
                        OperationDesc tryOp = 
                            (OperationDesc) allOperations.get(i); 
                        if (tryOp.getParamByQName(qname) != null) { 
                            foundOperations.add(tryOp); 
                        } 
                    } 
                    if (foundOperations.size() > 0) { 
                        possibleOperations = (OperationDesc[]) 
                            JavaUtils.convert(foundOperations, 
                                              OperationDesc[].class); 
                    } 
                }

---

The changed code:

---

                } else { 
                    // DOCUMENT Style 
                    // Get all of the operations that have qname as 
                    // a possible parameter QName 
                    ArrayList allOperations = desc.getOperations(); 
                    ArrayList foundOperations = new ArrayList(); 
                    for (int i=0; i < allOperations.size(); i++ ) { 
                        OperationDesc tryOp = 
                            (OperationDesc) allOperations.get(i); 
                        if (tryOp.getParamByQName(qname) != null) { 
                           if (!useSOAPAction() ||  
                                 (useSOAPAction() && tryOp.getSoapAction().equals(getSOAPActionURI()))) 
                            foundOperations.add(tryOp); 
                        } 
                    } 
                    if (foundOperations.size() > 0) { 
                        possibleOperations = (OperationDesc[]) 
                            JavaUtils.convert(foundOperations, 
                                              OperationDesc[].class); 
                    } 
                }

---

In the changed code, I check for the soapAction, if there is one, I use it to know what operation was called.

Thanks,

Gilberto

> two operations with same input/output type not getting invoked correctly
> ------------------------------------------------------------------------
>
>          Key: AXIS-2396
>          URL: http://issues.apache.org/jira/browse/AXIS-2396
>      Project: Apache Axis
>         Type: Bug
>   Components: Basic Architecture
>     Versions: 1.3
>  Environment: OS-Windows XP
> Container-Weblogic(8.1 sp4)
> java:1.4.2
>     Reporter: Prabhat Jha
>     Priority: Critical

>
> I used WSDL2Java to generate web services stub and classes. It correctly generated three methods
> public MyResponse createReservation(Reservation body);
> public MyResponse adjustReservation(Reservation body);
> public AnotherRespose checkAvailability(Status body);
> When I invoked the adjustReservation web service using Axis Client, createReservation gets executed. I have debugged it in eclipse and for some reason, RPCProvider invokes createReservation eventhough MessageContext has correct SoapActionURI which is AdjustReservation.
> checkAvailability operation gets called correctly.
> It seems to be a bug for it can not handle methods with different names but same input/output type.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira