File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes org.xml.sax.SAXException: Bad types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "org.xml.sax.SAXException: Bad types" Watch "org.xml.sax.SAXException: Bad types" New topic
Author

org.xml.sax.SAXException: Bad types

Elilory Delpunti
Greenhorn

Joined: Nov 04, 2003
Posts: 1
I have a problem in running my Client.
It gives me
org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> class myex.example)
at org.apache.axis.message.RPCHandler.onStartChild(RPCHandler.java:311)
at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:963)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:722)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
at org.apache.axis.client.Call.invoke(Call.java:2272)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at myex.Client.callGetWS(Client.java:187)
at myex.Client.main(Client.java:301)
Problem in main: ; nested exception is:
org.xml.sax.SAXException: Bad types (class [Ljava.lang.Object; -> class myex.example)
My webservice returns an array of bean (example[]).
Thanks
Bustcrak
[ November 04, 2003: Message edited by: Bustcrack ]
[ November 04, 2003: Message edited by: Bustcrak ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
"Bustcrak",
First of all, please read the naming policy and change your display name accordingly.
Second, point a browser to the Axis User's Guide and look for "Encoding Your Beans".


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
divya madala
Ranch Hand

Joined: Jan 10, 2001
Posts: 61
Hi All/Elilory Delpunti,

I know it's been a while since this message was posted, but just wondering if you came up with any solution for the problem you had with the SAXExcepiton
I get the exception as something similar
org.xml.sax.SAXException: Invalid element
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:260)
at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:963)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:725)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:233)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:347)
at org.apache.axis.client.Call.invoke(Call.java:2234)
at org.apache.axis.client.Call.invoke(Call.java:2133)
at org.apache.axis.client.Call.invoke(Call.java:1656)
at SoapBindingStub.retrieveCase(SoapBindingStub.java:1292)
I would appreciate any reply to this post.
Thanks.
Divya
[ March 29, 2004: Message edited by: divya madala ]
Raj Chila
Ranch Hand

Joined: Mar 18, 2004
Posts: 128

hi
I came accross the same problem, it was quite some time back, but I think this could happen when the bean you are trying to serialize, has a setter method but not a getter method or vice versa.
this could also happen if you are trying to use the classes generated by WSDL2Java. because the bean classes that are generated also contain the typemappings in it.
This is actually not necessary.
other wise it would be good if you could also put some source code to analyse the issue.
hope this helps
Vedhas Pitkar
Ranch Hand

Joined: Jan 27, 2001
Posts: 445
Hi,
When I was getting this exception, the mapping between my Java Beans to XML wasnt there.I edited the server-config.wsdd file (in Axis) for the proper mappings & then it started working fine.
Khushi Panesar
Greenhorn

Joined: May 26, 2004
Posts: 10
Hi Vedhas

How do I edit server-config.wsdd file. Because I am having the same exception and was just wondering, if this could help me.

Thank You !!
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by Khushi Panesar:
Hi Vedhas
How do I edit server-config.wsdd file. Because I am having the same exception and was just wondering, if this could help me.
Thank You !!


Well there is two option,
Either use the axis adminclient + specific wsdd for a given service.
Or edit the servlet-config.wsdd directly, to edit it directly you should know some basics about wsdd tags.
For examples to deploy a service called OrderProcessor which uses a bean called Order in its SOAPrequest, you will add the tags like


As you can see the code above, try to run all the samples that comes with Axis package, then you can master around ;)
[ May 27, 2005: Message edited by: Balaji Loganathan ]

Spritle Software Blogs
V.V.Nagesh Akula
Greenhorn

Joined: Jul 02, 2005
Posts: 1
Hi Loganathan,
Its really a great help that you had done to Khushi Panesar, I guess. I am also on the same page of Khushi. As in our project we have to access the third party Web Service, and they are using Axis. We were given set of classes that are implemented using WSDL2Java. Now the problem is I have developed a simulator which works as my Client Web Service in local environment. Everything working fine but while receiving response, Client code throws the following error.
----------------------------------------------------------------------

- Exception:
org.xml.sax.SAXException: Invalid element in com.echostar.www.api.create.version.two._ScrubAddressResponse - Address
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:255)
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:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2448)
at org.apache.axis.client.Call.invoke(Call.java:2347)
at org.apache.axis.client.Call.invoke(Call.java:1804)
at org.openuri.www.Wscreateapiv2SoapStub.scrubAddress(Wscreateapiv2SoapStub.java:950)
at com.echostar.apiv2.Client.scrubAddress(Client.java:449)
at com.echostar.apiv2.Client.main(Client.java:152)
---------------------------------------------------------------------
Response Schema:

|-- LineOne
|-- LineTwo
|-- Address--- |-- City
| |-- State
ScrubAddressResponse--| |-- Zip
|
|
|-- AddressValidFlag
---------------------------------------------------------------------
Where Address is a User definedd class and AddressValidFlag is boolean type. while accessing primative type its not showing any errors.

Could you please help me.
Thanks and Regards,

V.V.Nagesh Akula.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.xml.sax.SAXException: Bad types