From: Cid, Jose
Sent: Monday, May 02, 2005 5:24 PM
To: 'axis-user@ws.apache.org'
Subject: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
Can anyone shed some light as to what may be
going on here. I am use axis 1.2RC3. Multiref is
false (server-config.wsdd).
A snippet of my client code is shown
below:
...
Service svc = (Service) serviceMap.get( SERVICE_INSTANCE );
String szServiceAddress = (String) serviceMap.get( SERVICE_ADDRESS );
String szNameSpace = (String) serviceMap.get( SERVICE_NAME_SPACE );
String szPortName = (String) serviceMap.get( SERVICE_PORT_NAME );
Call call = (Call)
svc.createCall( );
call.setProperty( Call.SESSION_MAINTAIN_PROPERTY, new Boolean( true ) );
call.setProperty( Call.SESSION_MAINTAIN_PROPERTY, new Boolean( true ) );
call.setTargetEndpointAddress( szServiceAddress
);
call.setOperationName( new QName( szNameSpace, "getUnitDetail" ) );
call.setPortTypeName( new QName( szNameSpace, szPortName ) );
call.setOperationName( new QName( szNameSpace, "getUnitDetail" ) );
call.setPortTypeName( new QName( szNameSpace, szPortName ) );
Properties
sessionProperties = getSession( );
if (
sessionProperties != null )
{ // Using previous session
{ // Using previous session
String szCookie = sessionProperties.getProperty( SESSION_COOKIE );
if
( szCookie != null )
{
call.setProperty( HTTPConstants.HEADER_COOKIE, szCookie );
}
}
{
call.setProperty( HTTPConstants.HEADER_COOKIE, szCookie );
}
}
Object[] aObj = null;
Object someObj =
call.invoke( aObj );
// =====> Also
tried to invoke it this way...
//GetUnitDetailResponse gudResponse = (GetUnitDetailResponse) call.invoke( aObj );
...
//GetUnitDetailResponse gudResponse = (GetUnitDetailResponse) call.invoke( aObj );
...
===> to server:
GET //axis/services/UnitServiceApi?wsdl
HTTP/1.1
User-Agent: Java/1.4.2_06
Host: localhost:8090
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
User-Agent: Java/1.4.2_06
Host: localhost:8090
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
Connection: keep-alive
===> from server:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Mon, 02 May 2005 20:59:26 GMT
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Mon, 02 May 2005 20:59:26 GMT
1803
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://dsview.avocent.com/server/webservices/units"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://dsview.avocent.com/server/webservices/units"
xmlns:intf="http://dsview.avocent.com/server/webservices/units"
xmlns:tns1="urn:units:webservices:server:dsview:avocent:com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://dsview.avocent.com/server/webservices/units"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://dsview.avocent.com/server/webservices/units"
xmlns:intf="http://dsview.avocent.com/server/webservices/units"
xmlns:tns1="urn:units:webservices:server:dsview:avocent:com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version:
1.2RC3
Built on Feb 28, 2005 (10:15:14
EST)-->
<wsdl:types>
<schema elementFormDefault="qualified"
targetNamespace="urn:units:webservices:server:dsview:avocent:com"
xmlns="http://www.w3.org/2001/XMLSchema">
<schema elementFormDefault="qualified"
targetNamespace="urn:units:webservices:server:dsview:avocent:com"
xmlns="http://www.w3.org/2001/XMLSchema">
<element
name="getUnitDetail">
<complexType>
<sequence>
<element name="unitId" type="xsd:unsignedInt"/>
<element name="unitType" type="xsd:unsignedInt"/>
</sequence>
</complexType>
</element>
<complexType name="UnitDetail">
<sequence>
<element name="UnitId" nillable="true" type="xsd:string"/>
<element name="Name" nillable="true" type="xsd:string"/>
<element name="Address" nillable="true" type="xsd:string"/>
<element name="Type" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="getUnitDetailResponse">
<complexType>
<sequence>
<element name="return" nillable="true" type="tns1:UnitDetail"/>
</sequence>
</complexType>
</element>
<element name="getUnitList">
<complexType>
<sequence>
<element name="unitType" type="xsd:unsignedInt"/>
</sequence>
</complexType>
</element>
<complexType name="ArrayOfUnitDetail">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="tns1:UnitDetail"/>
</sequence>
</complexType>
<element name="getUnitListResponse">
<complexType>
<sequence>
<element name="return" nillable="true" type="tns1:ArrayOfUnitDetail"/>
</sequence>
</complexType>
</element>
<element name="doAction">
<complexType>
<sequence>
<element name="unitId" type="xsd:unsignedInt"/>
<element name="unitType" type="xsd:unsignedInt"/>
<element name="actionReq" type="xsd:unsignedInt"/>
</sequence>
</complexType>
</element>
<complexType name="UnitStatusInfo">
<sequence>
<element name="UnitId" nillable="true" type="xsd:string"/>
<element name="Status" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="doActionResponse">
<complexType>
<sequence>
<element name="return" nillable="true" type="tns1:UnitStatusInfo"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<complexType>
<sequence>
<element name="unitId" type="xsd:unsignedInt"/>
<element name="unitType" type="xsd:unsignedInt"/>
</sequence>
</complexType>
</element>
<complexType name="UnitDetail">
<sequence>
<element name="UnitId" nillable="true" type="xsd:string"/>
<element name="Name" nillable="true" type="xsd:string"/>
<element name="Address" nillable="true" type="xsd:string"/>
<element name="Type" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="getUnitDetailResponse">
<complexType>
<sequence>
<element name="return" nillable="true" type="tns1:UnitDetail"/>
</sequence>
</complexType>
</element>
<element name="getUnitList">
<complexType>
<sequence>
<element name="unitType" type="xsd:unsignedInt"/>
</sequence>
</complexType>
</element>
<complexType name="ArrayOfUnitDetail">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="tns1:UnitDetail"/>
</sequence>
</complexType>
<element name="getUnitListResponse">
<complexType>
<sequence>
<element name="return" nillable="true" type="tns1:ArrayOfUnitDetail"/>
</sequence>
</complexType>
</element>
<element name="doAction">
<complexType>
<sequence>
<element name="unitId" type="xsd:unsignedInt"/>
<element name="unitType" type="xsd:unsignedInt"/>
<element name="actionReq" type="xsd:unsignedInt"/>
</sequence>
</complexType>
</element>
<complexType name="UnitStatusInfo">
<sequence>
<element name="UnitId" nillable="true" type="xsd:string"/>
<element name="Status" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<element name="doActionResponse">
<complexType>
<sequence>
<element name="return" nillable="true" type="tns1:UnitStatusInfo"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message
name="getUnitListRequest">
<wsdl:part
element="tns1:getUnitList" name="getUnitList"/>
</wsdl:message>
<wsdl:message
name="getUnitDetailRequest">
<wsdl:part
element="tns1:getUnitDetail" name="getUnitDetail"/>
</wsdl:message>
<wsdl:message
name="doActionRequest">
<wsdl:part
element="tns1:doAction" name="doAction"/>
</wsdl:message>
<wsdl:message
name="getUnitDetailResponse">
<wsdl:part
element="tns1:getUnitDetailResponse"
name="getUnitDetailResponse"/>
</wsdl:message>
<wsdl:message
name="doActionResponse">
<wsdl:part
element="tns1:doActionResponse" name="doActionResponse"/>
</wsdl:message>
<wsdl:message
name="getUnitListResponse">
<wsdl:part
element="tns1:getUnitListResponse" name="getUnitListResponse"/>
</wsdl:message>
<wsdl:portType
name="UnitPortTypes">
<wsdl:operation
name="getUnitDetail" parameterOrder="getUnitDetail">
<wsdl:input message="impl:getUnitDetailRequest"
name="getUnitDetailRequest"/>
<wsdl:output message="impl:getUnitDetailResponse"
name="getUnitDetailResponse"/>
</wsdl:operation>
<wsdl:operation
name="getUnitList" parameterOrder="getUnitList">
<wsdl:input message="impl:getUnitListRequest"
name="getUnitListRequest"/>
<wsdl:output message="impl:getUnitListResponse"
name="getUnitListResponse"/>
</wsdl:operation>
<wsdl:operation
name="doAction" parameterOrder="doAction">
<wsdl:input message="impl:doActionRequest"
name="doActionRequest"/>
<wsdl:output message="impl:doActionResponse"
name="doActionResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding
name="UnitServiceApiSoapBinding" type="impl:UnitPortTypes">
<wsdlsoap:binding
style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation
name="getUnitDetail">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getUnitDetailRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getUnitDetailResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation
name="getUnitList">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getUnitListRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getUnitListResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation
name="doAction">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="doActionRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="doActionResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service
name="UnitServiceInterface">
<wsdl:port
binding="impl:UnitServiceApiSoapBinding" name="UnitServiceApi">
<wsdlsoap:address location="http://localhost:8090//axis/services/UnitServiceApi"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
===> The method invocation:
------sent:
POST //axis/services/UnitServiceApi
HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2RC3
Host: localhost:8090
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 410
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2RC3
Host: localhost:8090
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 410
<?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:getUnitDetail soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://dsview.avocent.com/server/webservices/units"/>
</soapenv:Body>
</soapenv:Envelope>
<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:getUnitDetail soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://dsview.avocent.com/server/webservices/units"/>
</soapenv:Body>
</soapenv:Envelope>
------Returned:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Mon, 02 May 2005 20:59:39 GMT
Connection: close
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Date: Mon, 02 May 2005 20:59:39 GMT
Connection: close
<?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>
<getUnitDetailResponse xmlns="urn:units:webservices:server:dsview:avocent:com">
<return>
<UnitId>anID</UnitId>
<Name>aName</Name>
<Address>1.2.3.4</Address>
<Type>someType</Type>
</return>
</getUnitDetailResponse>
</soapenv:Body>
</soapenv:Envelope>
<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>
<getUnitDetailResponse xmlns="urn:units:webservices:server:dsview:avocent:com">
<return>
<UnitId>anID</UnitId>
<Name>aName</Name>
<Address>1.2.3.4</Address>
<Type>someType</Type>
</return>
</getUnitDetailResponse>
</soapenv:Body>
</soapenv:Envelope>
Problem is in my client code I get exception:
No Sessions. Create using
Authentication.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at org.apache.axis.client.Call.invoke(Call.java:2437)
at org.apache.axis.client.Call.invoke(Call.java:2336)
at org.apache.axis.client.Call.invoke(Call.java:1793)
at JClient2.JClient2.getUnitDetail(JClient2.java:561)
at JClient2.JClient2.mainMenu(JClient2.java:270)
at JClient2.JClient2.main(JClient2.java:695)
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at org.apache.axis.client.Call.invoke(Call.java:2437)
at org.apache.axis.client.Call.invoke(Call.java:2336)
at org.apache.axis.client.Call.invoke(Call.java:1793)
at JClient2.JClient2.getUnitDetail(JClient2.java:561)
at JClient2.JClient2.mainMenu(JClient2.java:270)
at JClient2.JClient2.main(JClient2.java:695)
{http://xml.apache.org/axis/}hostname:SUN-JOSECID
org.xml.sax.SAXException: SimpleDeserializer
encountered a child element, which is NOT expected, in something it was trying
to deserialize.
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.client.Call.invoke(Call.java:2440)
at org.apache.axis.client.Call.invoke(Call.java:2336)
at org.apache.axis.client.Call.invoke(Call.java:1793)
at JClient2.JClient2.getUnitDetail(JClient2.java:561)
at JClient2.JClient2.mainMenu(JClient2.java:270)
at JClient2.JClient2.main(JClient2.java:695)
Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at org.apache.axis.client.Call.invoke(Call.java:2437)
... 5 more
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.client.Call.invoke(Call.java:2440)
at org.apache.axis.client.Call.invoke(Call.java:2336)
at org.apache.axis.client.Call.invoke(Call.java:1793)
at JClient2.JClient2.getUnitDetail(JClient2.java:561)
at JClient2.JClient2.mainMenu(JClient2.java:270)
at JClient2.JClient2.main(JClient2.java:695)
Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:347)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:386)
at org.apache.axis.client.Call.invoke(Call.java:2437)
... 5 more
When I use the
following code snippet everything is OK:
UnitPortTypes binding;
String epAddr = "http://sun-josecid:8090/axis/services/UnitServiceApi";
String wsdlAddr = epAddr + "?wsdl";
String wsdlAddr = epAddr + "?wsdl";
GetUnitDetailResponse
gudResponse;
URL wsdlUrl = new URL( wsdlAddr
);
binding = new
UnitServiceInterfaceLocator( ).getUnitServiceApi( wsdlUrl
);
gudResponse = binding.getUnitDetail( gud );
gudResponse = binding.getUnitDetail( gud );
By the way, with the
following code above, when I make a call to a method that returns an array,
example,
gulResponse =
binding.getUnitList( gul );
The "gulResponse"
returned always contains exactly 1 row of a possible 5 that should be returned.
Also, the
returned row
is always the last row of the table.
any help is
much appreciated.
Jose
Cid