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 La...@fr.thalesgroup.com on 2004/08/25 15:22:19 UTC

Axis/gSOAP: BeanDeserializer problems

Hi all,

I have a big problem with Axis: I need to make an Axis client communicate
with a gSOAP C server hosting my web service. Both of them are generated
from the same WSDL document, and they are both rpc/litteral (I didn't choose
it, the gSOAP server is already implemented and I can't modify it).

My problem is the following: my axis client launches the request, my gSOAP
server processes it without difficulty, but when it receives the response my
client raises the following exception:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: org.xml.sax.SAXException: Invalid element in
com.project.ListOfAURO - AffiliateUserRequestOutput
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:
Invalid element in com.project.ListOfAURO - AffiliateUserRequestOutput
        at
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.
java:223)
        at
org.apache.axis.encoding.DeserializationContext.startElement(Deserialization
Context.java:1025)
        at
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:159)
        at
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:
845)
        at
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:198)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:323)
        at org.apache.axis.client.Call.invoke(Call.java:2418)
        at org.apache.axis.client.Call.invoke(Call.java:2317)
        at org.apache.axis.client.Call.invoke(Call.java:1774)
        at
com.project.ProjectInterfaceBindingStub.affiliateUser(ProjectInterfaceBindin
gStub.java:499)
        at userCheckServlet.doGet(userCheckServlet.java:168)


Here come the interesting parts of the WSDL I use:

These are the 2 OUT parameters of my method AffiliateUser:

<xsd:simpleType name="GECReport">
 <xsd:restriction base="xsd:string">
	<xsd:enumeration value="GEC_OK"/>
	<xsd:enumeration value="GEC_GenericErrorCode"/>
	<xsd:enumeration value="GEC_DataBaseError"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="ListOfAURO">
  <xsd:sequence>
	<xsd:element name="AffiliateUserRequestOutput"
type="lns:AffiliateUserRequestOutput"
	  maxOccurs ="unbounded"
	  minOccurs="0"/>
  </xsd:sequence>
</xsd:complexType>


<xsd:simpleType name="AUReport">
 <xsd:restriction base="xsd:string">
	<xsd:enumeration value="AU_OK"/>
	<xsd:enumeration value="AU_AffiliationFailed"/>
</xsd:restriction>
</xsd:simpleType>

<xsd:complexType name="AffiliateUserRequestOutput">
  <xsd:sequence>
	<xsd:element name="UserSymbolicAddress" type="xsd:string"/>
	<xsd:element name="AffiliationReport" type="lns:AUReport"/>
  </xsd:sequence>
</xsd:complexType>


The Request and Response messages:

<wsdl:message name="AffiliateUser">
  <wsdl:part 
	name="ServiceType"
	type="rns:Service"/>
  <wsdl:part 
	name="ListOfInputParameters"
	type="lns:ListOfAUIP"/>
</wsdl:message>
<wsdl:message name="AffiliateUserResponse">
  <wsdl:part 
	name="ListOfOutputParameters"
	type="lns:ListOfAURO"/>
  <wsdl:part 
	name="return"
	type="lns:GECReport"/>
</wsdl:message>

<wsdl:portType name="Project-Interface">
<wsdl:operation name="AffiliateUser">
	<wsdl:input message="lns:AffiliateUser"/>
	<wsdl:output message="lns:AffiliateUserResponse"/>
</wsdl:operation>
</wsdl:portType>


The messages (both request and response) seem to be well-formed.

After some researches in the mailing-list archives I tried to change the
WSDL and use low case strings like this: 

<xsd:complexType name="AffiliateUserRequestOutput">
  <xsd:sequence>
	<xsd:element name="userSymbolicAddress" type="xsd:string"/>
	<xsd:element name="affiliationReport" type="lns:AUReport"/>
  </xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ListOfAURO">
  <xsd:sequence>
	<xsd:element name="affiliateUserRequestOutput"
type="lns:AffiliateUserRequestOutput"
	  maxOccurs ="unbounded"
	  minOccurs="0"/>
  </xsd:sequence>
</xsd:complexType>

<wsdl:message name="AffiliateUser">
  <wsdl:part 
	name="ServiceType"
	type="ips:Service"/>
  <wsdl:part 
	name="ListOfInputParameters"
	type="lns:ListOfAUIP"/>
</wsdl:message>
<wsdl:message name="AffiliateUserResponse">
  <wsdl:part 
	name="listOfOutputParameters"
	type="lns:ListOfAURO"/>
  <wsdl:part 
	name="return"
	type="lns:GECReport"/>
</wsdl:message>


With this configuration on both sides, I don't have the exception but when I
try to access the holders' attributes, it raises a
java.lang.NullPointerException...

Here is a part of my client code with the way I deal with the holders:

// ListOfAUROHolder
// just one user
AffiliateUserRequestOutput affiliateUserRequestOutput = new
AffiliateUserRequestOutput();
AffiliateUserRequestOutput[] affiliateUserRequestOutputArray = new
AffiliateUserRequestOutput[1];
affiliateUserRequestOutputArray[0] = affiliateUserRequestOutput;

ListOfAUROHolder listOfOutputParameters = new ListOfAUROHolder(new
ListOfAURO(affiliateUserRequestOutputArray));
				
// GECReportHolder
GECReportHolder _return = new GECReportHolder();

// Make the actual call
locPort.affiliateUser(Service.fromValue(serviceType), listOfInputParameters,
listOfOutputParameters, _return);

ListOfAURO listOfAURO = listOfOutputParameters.value;
AffiliateUserRequestOutput[] auro =
listOfAURO.getAffiliateUserRequestOutput();

This line raises the exception.

Here is the signature of ListOfAURO class:

public class ListOfAURO  implements java.io.Serializable {
private com.thalesgroup.IPS.LOC_xSV.AffiliateUserRequestOutput[]
affiliateUserRequestOutput;


Can anyone help me ? Do I have missed something with holders ? When I use my
client with a fake Axis server, there is no problem...


Thanks.
Laurent