[ http://issues.apache.org/jira/browse/AXIS-2002?page=all ]
Davanum Srinivas reassigned AXIS-2002: -------------------------------------- Assign To: Venkat Reddy > Problem using OUT-parameters > ---------------------------- > > Key: AXIS-2002 > URL: http://issues.apache.org/jira/browse/AXIS-2002 > Project: Axis > Type: Bug > Versions: 1.2 > Environment: AXIS 1.2 final, running under IBM AIX 5.2, IBM Java 1.4.2, > TomCat 4.1.30 > Reporter: Søren Jæger Hansen > Assignee: Venkat Reddy > > I've encountered a problem developing AXIS-based webservices. The webservice > is implemented in AXIS 1.2 final, running under IBM AIX, Java 1.4.2. > The webservice call is defined to AXIS using a WSDD-file containing: > ... > <operation name="GetEntry" returnQType="xsd:void"> > <parameter name="ObjectID" type="xsd:string" mode="in" /> > <parameter name="EntryID" type="xsd:int" mode="inout" /> > <parameter name="Account" type="xsd:string" mode="inout" /> > <parameter name="VoucherDate" type="xsd:string" mode="inout" /> > <parameter name="VoucherNumber" type="xsd:string" mode="inout" /> > <parameter name="VoucherText" type="xsd:string" mode="inout" /> > <parameter name="Amount" type="xsd:double" mode="inout" /> > <parameter name="VATCode" type="xsd:string" mode="inout" /> > <parameter name="CurrencyCode" type="xsd:string" mode="inout" /> > <parameter name="CurrencyAmount" type="xsd:double" mode="inout" /> > <parameter name="Dimension1" type="xsd:string" mode="inout" /> > <parameter name="Dimension2" type="xsd:string" mode="inout" /> > <parameter name="Dimension3" type="xsd:string" mode="inout" /> > <parameter name="Dimension4" type="xsd:string" mode="inout" /> > <parameter name="Dimension5" type="xsd:string" mode="inout" /> > <parameter name="Dimension6" type="xsd:string" mode="inout" /> > <parameter name="Success" type="xsd:int" mode="out" /> > </operation> > ... > The problem arises when the webservice is called from VB.NET. It seems that > VB.NET may exclude empty parameters in the call (ie. if Dimension1-parameter > above is an empty string, it is not sent in the XML-request, even if the > parameter is explicitly given in the according WSDL). > The problem is that OUT-only parameters are kind of "floating" in AXIS. When > I set up debug logging in log4j.properties, part of the debug output reads as > follows: > 20196 [http8081-Processor4] DEBUG org.apache.axis.description.OperationDesc > - @17c0abbf added parameter >name: Dimension5 > typeEntry: null > mode: INOUT > position: 14 > isReturn: false > typeQName: null > javaType: null > inHeader: false > outHeader: false > @19e32bbf<total parameters:15 > 20196 [http8081-Processor4] DEBUG org.apache.axis.description.OperationDesc > - @17c0abbf added parameter >name: Dimension6 > typeEntry: null > mode: INOUT > position: 15 > isReturn: false > typeQName: null > javaType: null > inHeader: false > outHeader: false > @2e5f6bbf<total parameters:16 > 20196 [http8081-Processor4] DEBUG org.apache.axis.description.OperationDesc > - @17c0abbf added parameter >name: Success > typeEntry: null > mode: OUT > position: -1 > isReturn: false > typeQName: null > javaType: null > inHeader: false > outHeader: false > @213babbf<total parameters:17 > The problem here is "position: -1" in the last ("Success") parameter. It has > the implication that AXIS does not correctly set up the call to the java stub > when some of the parameters are missing in the serialized XML request. This > may cause various errors ranging from parameter mismatch (which are reported > to the client) to AXIS/TomCat crashes. > Looking into the org/apache/axis/description/OperationDesc.java code (rev > 1.43), the following lines are revealed in method addParameter, line 255: > --------------------------------- OperationDesc.java, line 255: > parameters.add(param); > if ((param.getMode() == ParameterDesc.IN) || > (param.getMode() == ParameterDesc.INOUT)) { > param.setOrder(numInParams++); > } > if ((param.getMode() == ParameterDesc.OUT) || > (param.getMode() == ParameterDesc.INOUT)) { > numOutParams++; > } > --------------------------------- > Ie. param.setOrder is only called for IN and INOUT parameters. For OUT > parameters, the order is -1, causing the problems described above. > I suggest the following code that assigns an ordering to all fields, even if > they're output-only-parameters. This fix seems to make things work for me: > --------------------------------- OperationDesc.java, line 255: > param.setOrder(getNumParams()); > parameters.add(param); > if ((param.getMode() == ParameterDesc.IN) || > (param.getMode() == ParameterDesc.INOUT)) { > numInParams++; > } > if ((param.getMode() == ParameterDesc.OUT) || > (param.getMode() == ParameterDesc.INOUT)) { > numOutParams++; > } > --------------------------------- -- 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