You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by don t <do...@verizonwireless.com> on 2008/08/13 18:53:47 UTC

AxisServlet parameter order mismatch

Hi, I am calling an Axis 1.4 service through the browser with 4 URL
parameters like this:

http://localhost:8012/axis/services/LocationService?method=getLocationsByCoordinates&region=Hawaii&delta=2&latitude=20&longitude=-160


The operation and parameters are defined in Document/Literal Wrapped style
WSDL like this:

<xsd:element name="getLocationsByCoordinates">
	<xsd:complexType>
		<xsd:sequence>
			<xsd:element name="region" type="xsd:string" />
			<xsd:element name="latitude" type="xsd:double" />
			<xsd:element name="longitude" type="xsd:double" />
			<xsd:element name="delta" type="xsd:double" />
		</xsd:sequence>
	</xsd:complexType>
</xsd:element>

<wsdl:message name="getLocationsByCoordinatesRequest">
	<wsdl:part element="tns:getLocationsByCoordinates" name="parameters" />
</wsdl:message>


>From above HTTP request Axis generates a request SOAP envelope like this:

<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<getLocationsByCoordinates>
<region>Hawaii</region>
<longitude>-156</longitude>
<delta>1</delta>
<latitude>20</latitude>
</getLocationsByCoordinates>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


However looking at the logs seems the parameter ordering was changed when
invoking service:

region = Hawaii
latitude = -156.0
longitude = 20.0
delta = 1.0


After some debugging it seems the problem is in Axis RPCHandler.java

http://svn.apache.org/viewvc/webservices/axis/trunk/java/src/org/apache/axis/message/RPCHandler.java?view=markup

The parameter descriptor lookup by QName returns null:

// Try by name first
            if (isResponse) {
                paramDesc = operation.getOutputParamByQName(qname);
            } else {
                paramDesc = operation.getInputParamByQName(qname);
            }

so Axis then tries to lookup parameter descriptor by position: 

// If that didn't work, try position
            // FIXME : Do we need to be in EITHER named OR positional
            //         mode?  I.e. will it screw us up to find something
            //         by position if we've already looked something up
            //         by name?  I think so...
            if (paramDesc == null) {
                if (isResponse) {
                    paramDesc = operation.getReturnParamDesc();
                }
                else {
                    paramDesc =
operation.getParameter(rpcElem.getParams().size() - 1);
                }
            }

The problem is lookup by position results in botched parameter ordering when
invoking the service. My question is how can I specify operation parameters
in WSDL or WSDD such that the parameter QName lookup will not return null,
or parameter position ordering is preserved when inovked through
AxisServlet?
-- 
View this message in context: http://www.nabble.com/AxisServlet-parameter-order-mismatch-tp18967041p18967041.html
Sent from the Axis - User mailing list archive at Nabble.com.


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