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 karusala kiranbabu <ki...@yahoo.com> on 2005/09/30 15:33:59 UTC

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\client>javac
-d . XSLTClient.java

C:\Documents and
Settings\Administrator\Desktop\Downloads\webservice\newwebservice_client\client>java
xsltransform/XSLTClient
 sample.xml sample.xsl
the inFileDataHandler
isjavax.activation.DataHandler@ca0b6
the xslFileDataHandler
isjavax.activation.DataHandler@10b30a7
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:221)
        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
        at
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.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$FragmentContentDispatcher.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(MustUnderstandChecker.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\client>




		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

Re: class-cast exception while writing the client for the webservice which takes datahandler as input parameters.

Posted by Krthekeyan Suriyanarayanan <s....@verchaska.com>.
It could be that you are setting the file in datasource from client . 
and might be trying to take it directly from datahandler.

Regards,
krthekeyan.s


karusala kiranbabu wrote:

>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\client>javac
>-d . XSLTClient.java
>
>C:\Documents and
>Settings\Administrator\Desktop\Downloads\webservice\newwebservice_client\client>java
>xsltransform/XSLTClient
> sample.xml sample.xsl
>the inFileDataHandler
>isjavax.activation.DataHandler@ca0b6
>the xslFileDataHandler
>isjavax.activation.DataHandler@10b30a7
>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:221)
>        at
>org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>        at
>org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.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$FragmentContentDispatcher.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(MustUnderstandChecker.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\client>
>
>
>
>
>		
>__________________________________ 
>Yahoo! Mail - PC Magazine Editors' Choice 2005 
>http://mail.yahoo.com
>
>  
>


complex datatypes in webservice

Posted by Ravi Krishnamurthy <ra...@savvion.com>.
Hello:
I'm working on a webservice invocation framework that could communicate 
to any webservice including complex webservices.

One way to invoke the complex webservice is to generate the java classes 
and define the serializer/deserialiizers (fortunately this can be 
abstracted using Axis).

SOmetimes, there are restrictions that no classes should be generated 
because of the architecture it means bringing the whole server down and 
restarting it again. Is tehre any other solution possible.

Thanks,
Ravi


Serialization of abstract classes

Posted by glenn bech <gl...@webstep.no>.
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:kiran_karusala2003@yahoo.com] 
Sent: 30. september 2005 15:34
To: axis-user@ws.apache.org
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
isjavax.activation.DataHandler@ca0b6
the xslFileDataHandler
isjavax.activation.DataHandler@10b30a7
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