Hi,
I have some issues with serialization/deserialization of concrete
implementation of abstract schema types.
I have a schema with a concrete and an abstract element, aproxemately like
this;
<xs:complexType name="AbstractGetAttributeType" abstract="true"/>
<xs:element name="GetDefinition" type="AbstractGetAttributeType"
abstract="true"/>
<xs:complexType name="GetResponseAttributesType">
<xs:sequence>
<xs:element ref="GetDefinition"/>
</xs:sequence>
</xs:complexType>
<xs:element name="GetResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="primaryKey" type="xs:strig">
<xs:element name="Values "type="GetResponseAttributesType"/>
</xs:sequence>
</xs:complexType>
</xs:element>
My Concreate implementation looks something like this ;
<xs:element name="GetEmployee" substitutionGroup="GetDefinition">
<xs:complextype>
<xs:complexContent>
<xs:extension base="AbstractGetAttributeType"/>
<xs:sequence name="firstname />
<xs:sequence name="lastname />
</xs:complexcontent>
<xs:complextype>
</xs:element>
After compiling and building everythig, and writing a test client, a typical
response from the service looks something like this ;
<?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>
<GetResponse
xmlns="http://schemas.ericsson.com/cai3g1.0/2004/01/22/">
<primarykey/>
<values >
<GetDefinition xsi:type="ns1:AbstractGetAttributeType"
xmlns:ns1="http://schemas.ericsson.com/cai3g1.0/2004/01/22/">
<firstname> me </firstname>
<lastname> me </lastname>
</GetDefinition>
</ values >
</GetResponse>
</soapenv:Body>
</soapenv:Envelope>
As you can see, the tag enclosed in the <values> tag, is <GetDefinition> and
not my concrete type <getEmployee> This causes problems in deserialization.
Axis (BeanDeserializer) tries to populete the abstract generated class with
values firstname and lastname....
All XML and schemas were modified and cut out of context to make a better
example of it, and might be inaccurate... But, should prove my point.
Any Ideas on this ?
G
-----Original Message-----
From: karusala kiranbabu [mailto:[EMAIL PROTECTED]
Sent: 30. september 2005 15:34
To: [email protected]
Subject: class-cast exception while writing the client for the webservice
which takes datahandler as input parameters.
Hi,
I have created one webservice and deployed that
webservice jar file in AXIS/WEB-INF/lib/ directory.
I have accessed the wdsl of the webservice by giving
the url for the webservice.here there is no problem.
After that, we have written the client and passing the
datahandlers to the webservice .
1.It is not invoking the method of the webservice and
it is giving the exception as mentioned below.
HOW CAN WE RESOLVE THIS ISSUE? plz help me in this
regard, it's very urgent for me.
THE EXCEPTION COMING IS:
C:\Documents and
Settings\Administrator\Desktop\Downloads\webservice\newwebservice_client\cli
ent>javac
-d . XSLTClient.java
C:\Documents and
Settings\Administrator\Desktop\Downloads\webservice\newwebservice_client\cli
ent>java
xsltransform/XSLTClient
sample.xml sample.xsl
the inFileDataHandler
[EMAIL PROTECTED]
the xslFileDataHandler
[EMAIL PROTECTED]
AxisFault
faultCode:
{http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.ClassCastException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:SGSC1
java.lang.ClassCastException
at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:2
21)
at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:12
8)
at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationCo
ntext.java:1087)
at
org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
her.dispatch(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at
org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at
org.apache.xerces.parsers.XMLParser.parse(Unknown
Source)
at
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at javax.xml.parsers.SAXParser.parse(Unknown
Source)
at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext
.java:227)
at
org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at
org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at
org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChe
cker.java:62)
at
org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at
org.apache.axis.client.Call.invokeEngine(Call.java:2765)
at
org.apache.axis.client.Call.invoke(Call.java:2748)
at
org.apache.axis.client.Call.invoke(Call.java:2424)
at
org.apache.axis.client.Call.invoke(Call.java:2347)
at
org.apache.axis.client.Call.invoke(Call.java:1804)
at
xsltransform.XSLTClient.main(XSLTClient.java:72)
C:\Documents and
Settings\Administrator\Desktop\Downloads\webservice\newwebservice_client\cli
ent>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
BEGIN:VCARD
VERSION:2.1
N:Bech;Glenn;Richard
FN:[EMAIL PROTECTED]
ORG:Webstep Consulting AS
TITLE:Seniorkonsulent
TEL;WORK;VOICE:99356459
TEL;CELL;VOICE:99356459
ADR;WORK:;;P.O. Box 66;;Lysaker;1324;Norway
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:P.O. Box 66=0D=0ALysaker 1324=0D=0ANorway
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20050923T071750Z
END:VCARD