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 mesaullion <me...@web.de> on 2004/04/25 17:46:15 UTC

serializing wrong number of elements: ArrayIndexOutOfBoundsException (java:rpc , wsdl, flash)

Situation:
I want to calculate Parts of a Fractal on a Client (don't think about the
usability; it's just an example!).
When deploying my Class, which I want to serialize, Axis creates the correct
Datatype in the WSDL by usingthe get- and set-Methods.

Problem:
Everything works fine, but the Problem is, that I don't want to send all the
Information in both directions (to and from server). So I don't want to send
an empty results-Tag via SOAP and either I don't want to receive the
coordinates I gave the client to calculate the Fractal from.

Facts:
What Axis does, is that it only generates 1 Datatype in the WSDL using the
beanMapping. Although there are three elements in my Datatype, Axis only
sends two of them (sessionId and coords). This is what I want.
But I only want to sent two elements back to the server (sessionId and
results), but my client (mm flash, not java/axis) (which auto-generates the
stub from the WSDL) always sends three elements, because the wsdl (and
therefore axis) says so, resulting in an wrong number of parameters sent
back :

<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.lang.ArrayIndexOutOfBoundsException: -125</faultstring>




What could I do...am I missing something? 
Any help appreciated

Thanks a lot.
:::mesaullion.



Development-Parts:

deploy.wsdd;

	<service name="FraktalService" provider="java:RPC">
		<parameter name="className" value="FraktalService" />
		<parameter name="allowedMethods" value="*" />
		<parameter name="scope" value="application" />

 		<beanMapping qname="myNS:Fraktal"
xmlns:myNS="urn:FraktalService" languageSpecificType="java:Fraktal" />
	</service>




Fraktal.java:

	// Methods (which I want to serialize)

	// send and receive the session
	public String getSessionId()
	public void setSessionId(String s)
	
	// only send the coordinates and receive the results
	public void getCoords(int[] c)
	public void setResults(int[] r)
	
	
	// Methods (which I don't want to serialize: so I renamed them)
	public void coordsSet(int[] c) {
	public int[] resultsGet()




FraktalService.wsdl:

// Datatype:
<complexType name="Fraktal">
   <sequence>
      <element name="coords" nillable="true" type="impl:ArrayOf_xsd_int" /> 
      <element name="results" nillable="true" type="impl:ArrayOf_xsd_int" />
      <element name="sessionId" nillable="true" type="xsd:string" /> 
   </sequence>
</complexType>

//public Fraktal getServiceFraktal():
<wsdl:message name="getServiceFraktalRequest" />
<wsdl:message name="getServiceFraktalResponse">
	<wsdl:part name="getServiceFraktalReturn" type="tns1:Fraktal" />
</wsdl:message>

//public String setServiceFraktal(Fraktal f):
<wsdl:message name="setServiceFraktalRequest">
   <wsdl:part name="in0" type="tns1:Fraktal" />
</wsdl:message>
<wsdl:message name="setServiceFraktalResponse">
	<wsdl:part name="setServiceFraktalReturn" type="xsd:string" />
</wsdl:message>


RE: serializing wrong number of elements: ArrayIndexOutOfBoundsException (java:rpc , wsdl, flash)

Posted by mesaullion <me...@web.de>.
 Pardon, I missed one thing:

It should read :
public int[] getCoords()

Instead of :
public void getCoords(int[] c)


My Fault, sorry. Anyways, waiting for help...




-----Ursprüngliche Nachricht-----
Von: axis-user-return-23515-mesaullion=web.de@ws.apache.org
[mailto:axis-user-return-23515-mesaullion=web.de@ws.apache.org] Im Auftrag
von mesaullion
Gesendet: Sonntag, 25. April 2004 17:46
An: axis-user@ws.apache.org
Betreff: serializing wrong number of elements:
ArrayIndexOutOfBoundsException (java:rpc , wsdl, flash)

Situation:
I want to calculate Parts of a Fractal on a Client (don't think about the
usability; it's just an example!).
When deploying my Class, which I want to serialize, Axis creates the correct
Datatype in the WSDL by usingthe get- and set-Methods.

Problem:
Everything works fine, but the Problem is, that I don't want to send all the
Information in both directions (to and from server). So I don't want to send
an empty results-Tag via SOAP and either I don't want to receive the
coordinates I gave the client to calculate the Fractal from.

Facts:
What Axis does, is that it only generates 1 Datatype in the WSDL using the
beanMapping. Although there are three elements in my Datatype, Axis only
sends two of them (sessionId and coords). This is what I want.
But I only want to sent two elements back to the server (sessionId and
results), but my client (mm flash, not java/axis) (which auto-generates the
stub from the WSDL) always sends three elements, because the wsdl (and
therefore axis) says so, resulting in an wrong number of parameters sent
back :

>From TCP-Monitor:
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.lang.ArrayIndexOutOfBoundsException: -125</faultstring>




What could I do...am I missing something? 
Any help appreciated

Thanks a lot.
:::mesaullion.



Development-Parts:

deploy.wsdd;

	<service name="FraktalService" provider="java:RPC">
		<parameter name="className" value="FraktalService" />
		<parameter name="allowedMethods" value="*" />
		<parameter name="scope" value="application" />

 		<beanMapping qname="myNS:Fraktal"
xmlns:myNS="urn:FraktalService" languageSpecificType="java:Fraktal" />
	</service>




Fraktal.java:

	// Methods (which I want to serialize)

	// send and receive the session
	public String getSessionId()
	public void setSessionId(String s)
	
	// only send the coordinates and receive the results
	public void getCoords(int[] c)
	public void setResults(int[] r)
	
	
	// Methods (which I don't want to serialize: so I renamed them)
	public void coordsSet(int[] c) {
	public int[] resultsGet()




FraktalService.wsdl:

// Datatype:
<complexType name="Fraktal">
   <sequence>
      <element name="coords" nillable="true" type="impl:ArrayOf_xsd_int" /> 
      <element name="results" nillable="true" type="impl:ArrayOf_xsd_int" />
      <element name="sessionId" nillable="true" type="xsd:string" /> 
   </sequence>
</complexType>

//public Fraktal getServiceFraktal():
<wsdl:message name="getServiceFraktalRequest" /> <wsdl:message
name="getServiceFraktalResponse">
	<wsdl:part name="getServiceFraktalReturn" type="tns1:Fraktal" />
</wsdl:message>

//public String setServiceFraktal(Fraktal f):
<wsdl:message name="setServiceFraktalRequest">
   <wsdl:part name="in0" type="tns1:Fraktal" /> </wsdl:message>
<wsdl:message name="setServiceFraktalResponse">
	<wsdl:part name="setServiceFraktalReturn" type="xsd:string" />
</wsdl:message>