axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zekl, Andreas (Student Assistant)" <Andreas.Z...@softwareag.com>
Subject Null Reference Problem
Date Thu, 01 Aug 2002 15:31:29 GMT
Hi,
I am running xml-axis-beta3 and xml-axis-beta2 on a Jakarta Tomcat Version
4.0.

My Web Service should simply reply the objects i send to it.

So i defined a Class which i send:

public class SOAPStruct {		
	private String varString;
	private int varInt;
	private int[] varIntArray;
	private float varFloat;
	private float[][] varFloatDoubleArray;
	private SOAPStruct varSoapStruct;// = null;

	public SOAPStruct() {}
	
	public SOAPStruct(String sVar, int iVar, int[] iVarArray, float
fVar, float[][] fVarDoubleArray, SOAPStruct sStructVar) {
		this.varString = sVar;
		this.varInt = iVar;
		this.varIntArray = iVarArray;
		this.varFloat = fVar;
		this.varFloatDoubleArray = fVarDoubleArray;
		this.varSoapStruct = sStructVar;
	}

	.
	.
	.
}

The WSDl looks like this:
<schema targetNamespace="http://www.soapinterop.org/Interop"
xmlns="http://www.w3.org/2001/XMLSchema">
  	<import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> 
	- <complexType name="SOAPStruct">
		- <sequence>
  			<element name="varString" nillable="true"
type="xsd:string" /> 
  			<element name="varInt" type="xsd:int" /> 
  			<element name="varIntArray" nillable="true"
type="intf:ArrayOf_xsd_int" /> 
  			<element name="varFloat" type="xsd:float" /> 
  			<element name="varFloatDoubleArray" nillable="true"
type="intf:ArrayOfArrayOf_xsd_float" /> 
  			<element name="varSOAPStruct" nillable="true"
type="tns1:SOAPStruct" /> 
  		</sequence>
  	</complexType>
  	<element name="SOAPStruct" nillable="true" type="tns1:SOAPStruct" />

</schema>

I create the class and set sStructVar to null (when i call the constructor).
	SOAPStruct inSoapStruct = new SOAPStruct("SoapStruct", 5, new int[]
{5,6}, 6.2f, new float[][] { new float[] {6.2f, 6.3f}, new float[] {7.2f,
7.3f}}, null);
            		
	SOAPStruct outSoapStruct = (SOAPStruct) call.invoke(new Object[]
{inSoapStruct});


The Soap Message looks like this:

<?xml version="1.0" encoding="UTF-8" ?> 
- <soapenv:Envelope
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
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"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
- <soapenv:Body>
	- <ns1:echoSOAPStruct xmlns:ns1="Round1">
  		<arg0 href="#id0" /> 
  	  </ns1:echoSOAPStruct>
	- <multiRef id="id0" SOAP-ENC:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:SOAPStruct" 		xmlns:ns2="Round1">
  		<varString xsi:type="xsd:string">SoapStruct</varString> 
  		<varInt xsi:type="xsd:int">5</varInt> 
	    - <varIntArray xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:int[2]">
  			<item>5</item> 
  			<item>6</item> 
  		</varIntArray>
  	      <varFloat xsi:type="xsd:float">6.2</varFloat> 
		- <varFloatDoubleArray xsi:type="SOAP-ENC:Array"
SOAP-ENC:arrayType="xsd:float[2,2]">
  			<item xsi:type="xsd:float">6.2</item> 
  			<item xsi:type="xsd:float">6.3</item> 
  			<item xsi:type="xsd:float">7.2</item> 
  			<item xsi:type="xsd:float">7.3</item> 
  		</varFloatDoubleArray>
  		<varSOAPStruct xsi:nil="true" /> 
  	</multiRef>
  </soapenv:Body>
</soapenv:Envelope>

Everything looks fine but the server cannot handle the null type. I got the
following error:
 
<?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>

- <soapenv:Fault>
  <faultcode
xmlns:ns1="http://xml.apache.org/axis/">ns1:Server.userException</faultcode>

  <faultstring>org.xml.sax.SAXException: Bad types (null -> class
Servers.Round1.SOAPStruct)</faultstring> 

- <detail>
  <ns2:stackTrace
xmlns:ns2="http://xml.apache.org/axis/">org.xml.sax.SAXException: Bad types
(null -> class Servers.Round1.SOAPStruct) at
org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:207) at
org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializa
tionContextImpl.java:857) at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:199)
at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
644) at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:201)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:259) at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:1
61) at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:289) at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:
71) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150) at
org.apache.axis.SimpleChain.invoke(SimpleChain.java:120) at
org.apache.axis.server.AxisServer.invoke(AxisServer.java:312) at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:577) at 
	.
	.
	.
  </ns2:stackTrace> 
  </detail>
  </soapenv:Fault>
  </soapenv:Body>
  </soapenv:Envelope>

Maybe someone can give me a hint where the problem is.

Sincerely yours
	Andreas Zekl

Mime
View raw message