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 Phil Wilson <p....@zoo-tech.com> on 2004/05/14 17:44:19 UTC

String[] in complex type was returned as null

Hi all,

I've tried looking for this in the archive, but haven't had any luck, so my
appologies if this has already been answered.

I have a soap call which returns an object which contains an integer and a
string array. 

When I call it the response *looks* fine[3] (via TCPMon), and the integer
value in the returned object is correct but the string array is null. There
aren't any exceptions thrown (I'm using Axis 1.1 and originally thought this
could be http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15384 "Error
deserializing array in custom datatype" but that seems to always throw a
SAXException, which I'm not getting).

Anybody have any ideas what might help solve this? I've included the
WSDD[1], the client code[2] and the server response[3] below.

Thanks for your time,

Phil

[1] The server-config.wsdd:

<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
	<globalConfiguration>
		<parameter name="sendMultiRefs" value="true"/>
		<parameter name="sendXsiTypes" value="true"/>
		<parameter name="sendXMLDeclaration" value="true"/>
		<parameter name="axis.sendMinimizedElements" value="true"/>
	</globalConfiguration>

	<handler name="LocalResponder"
type="java:org.apache.axis.transport.local.LocalResponder"/>

	<handler name="URLMapper"
type="java:org.apache.axis.handlers.http.URLMapper"/>

	<handler name="Authenticate"
type="java:org.apache.axis.handlers.SimpleAuthenticationHandler"/>

	<service name="SomeService" provider="java:RPC">
		<parameter name="allowedMethods" value="*"/>
		<parameter name="className" 
        <beanMapping qname="zooNS:MyObject" xmlns:zooNS="urn:SomeService"
languageSpecificType="java:MyObject"/>
	</service>

	<transport name="http">
		<requestFlow>
			<handler type="URLMapper"/>
			<handler
type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
		</requestFlow>
	</transport>

	<transport name="local">
		<responseFlow>
			<handler type="LocalResponder"/>
		</responseFlow>
	</transport>

</deployment>

[2] The client code:

MyObject ret = new MyObject();

Service service = new Service();
Call call = (Call) service.createCall();
QName qn = new QName("urn:SomeService", "MyObject");
call.registerTypeMapping(MyObject.class, qn,
                         new
org.apache.axis.encoding.ser.BeanSerializerFactory(MyObject.class, qn),
                         new
org.apache.axis.encoding.ser.BeanDeserializerFactory(MyObject.class, qn));

call.setTargetEndpointAddress(new java.net.URL(m_endPoint));
call.setOperationName(new QName("SomeService", "getMyObject"));

call.setReturnClass(MyObject.class);

Object[] params = new Object[3];

params[0] = new Integer(intVal1);
params[1] = new Integer(intVal2);
params[2] = someString;

ret = (MyObject) call.invoke(params);

if (ret.getStringArray()==null) 
{
  // always gets into here
  log.info("Array returned null"); 
}

[3] The response from the server:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <ns1:getMyObjectResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="SomeService">
   <ns1:getMyObject href="#id0"/>
  </ns1:getMyObjectResponse>
  <multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:M" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="urn:SomeService">
   <stringArray xsi:type="soapenc:Array" soapenc:arrayType="xsd:string[3]">
    <item>Quiz</item>
    <item>Badger</item>
    <item>AnotherName</item>
   </stringArray>
   <returnCode xsi:type="xsd:int">32</returnCode>
  </multiRef>
 </soapenv:Body>
</soapenv:Envelope>