The Artima Developer Community
Sponsored Link

Web Services Forum
How to solve org.xml.sax.SAXException: Invalid element in problem

12 replies on 1 page. Most recent reply: Dec 8, 2011 5:56 AM by jelli sons

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 12 replies on 1 page
atul jawale

Posts: 1
Nickname: atulj
Registered: Jul, 2006

How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Jul 23, 2006 10:00 PM
Reply to this message Reply
Advertisement
Hello friends
I m working on a web service .I used wsdl file to generate java package by using axis with command

java org.apache.axis.wsdl.WSDL2Java esws.wsdl

command executes and i get the generated package of java but when i run it in my program following axis exception occures indicating

in valid field in one of generated class from wsdl file

Please help me out of this problem

Following is the exception

org.xml.sax.SAXException: Invalid element in org.tempuri.esws.Event - event_date
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.jav a:260)
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Invalid element in org.tempuri.esws.Event - event_date
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: org.xml.sax.SAXException: Invalid element in org.tempuri.esws.Event - event_date
at org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.jav a:260)
at org.apache.axis.encoding.DeserializationContextImpl.startElement(Deserializatio nContextImpl.java:949)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:198)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:718 )
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:232)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:346)
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 org.tempuri.esws.ServiceSoapStub.fetchEvents(ServiceSoapStub.java:588)


And Event class has fields as

public class Event implements java.io.Serializable {
private java.lang.String ID;
private java.lang.String name;
private java.lang.String photographer;
private java.lang.String dateCreated;
private java.lang.String eventDate;
private java.lang.String dateExpire;
private java.lang.String password;
private java.lang.String description;
private java.lang.String pricelist;
private java.lang.String clientInfo;
private java.lang.String coverImageURL;
private int numImages;

Please help me to solve this error .......


Umakanth Perepa

Posts: 1
Nickname: umakanth
Registered: Aug, 2006

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Aug 21, 2006 4:16 AM
Reply to this message Reply
Dear Atul,

This is Umakanth. I am getting the similar exception while trying to access a webservice. Have you sorted this issue? if so can you please help me out?


Hi all,
In case any one has got a solution for this issue, I request you all to help me out.

I am available at umakanth.perepa@valuelabs.net

Sincerely,
Umakanth



> Hello friends
> I m working on a web service .I used wsdl file to generate
> java package by using axis with command
>
> java org.apache.axis.wsdl.WSDL2Java esws.wsdl
>
> command executes and i get the generated package of java
> but when i run it in my program following axis exception
> occures indicating
>
> in valid field in one of generated class from wsdl file
>
> Please help me out of this problem
>
> Following is the exception
>
> org.xml.sax.SAXException: Invalid element in
> org.tempuri.esws.Event - event_date
> at
> org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(
> BeanDeserializer.java:260)
> AxisFault
> faultCode:
> {http://schemas.xmlsoap.org/soap/envelope/}Server.userExcep
> tion
> faultSubcode:
> faultString: org.xml.sax.SAXException: Invalid element in
> org.tempuri.esws.Event - event_date
> faultActor:
> faultNode:
> faultDetail:
> {http://xml.apache.org/axis/}stackTrace:
> org.xml.sax.SAXException: Invalid element in
> org.tempuri.esws.Event - event_date
> at
> org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(
> BeanDeserializer.java:260)
> at
> org.apache.axis.encoding.DeserializationContextImpl.startEl
> ement(DeserializationContextImpl.java:949)
> at
> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventR
> ecorder.java:198)
> at
> org.apache.axis.message.MessageElement.publishToHandler(Mes
> sageElement.java:718)
> at
> org.apache.axis.message.RPCElement.deserialize(RPCElement.j
> ava:232)
> at
> org.apache.axis.message.RPCElement.getParams(RPCElement.jav
> a:346)
> 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
> org.tempuri.esws.ServiceSoapStub.fetchEvents(ServiceSoapStu
> b.java:588)
>
>
> And Event class has fields as
>
> public class Event implements java.io.Serializable {
> private java.lang.String ID;
> private java.lang.String name;
> private java.lang.String photographer;
> private java.lang.String dateCreated;
> private java.lang.String eventDate;
> private java.lang.String dateExpire;
> private java.lang.String password;
> private java.lang.String description;
> private java.lang.String pricelist;
> private java.lang.String clientInfo;
> private java.lang.String coverImageURL;
> private int numImages;
>
> Please help me to solve this error .......

Srinivas Prasad

Posts: 1
Nickname: srinipusa
Registered: Feb, 2007

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Feb 12, 2007 6:10 PM
Reply to this message Reply
I am encountering the similar exception. Has anyone solved this?

Many thanks.

Srinivas

Jeroen Wenting

Posts: 88
Nickname: jwenting
Registered: Mar, 2004

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Feb 14, 2007 6:15 AM
Reply to this message Reply
The problem is caused by the result returned from the webservice not matching with the classes generated from the wsdl.

That might help you. If you can change the generated classes (or regenerate them with a current wsdl) you're set.

But if you can't you're suckered (AFAIK).
For example, we're currently working to create a client library for our SOAP services to be deployed to clients who can't for some reason access them directly (some SOAP stacks can't parse our WSDL which has some ancient non-standard things in them we can't remove for historical reasons that cause problems for some generators).
We'd like to be able to change our WSDL (to add new fields to datastructures mainly, adding entirely new services is no problem AFAIK) without having to redeploy the client library to customers.
But that requires finding a way to map the new result messages to old generated classes (discarding the newly added fields).
So far I've not been able to resolve that.

Jeroen Wenting

Posts: 88
Nickname: jwenting
Registered: Mar, 2004

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Feb 14, 2007 6:31 AM
Reply to this message Reply
Comment: this is a known limitation of Axis. There's an open issue in the Axis Jira from November 2005 asking for this to be resolved.

packiaraj n

Posts: 1
Nickname: packiaraj
Registered: Mar, 2008

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Mar 26, 2008 8:38 AM
Reply to this message Reply
SOAP 2.2 does not define a default mapping between Java char and XSD.

ibbu s

Posts: 1
Nickname: ibbu
Registered: Mar, 2009

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Mar 19, 2009 1:29 PM
Reply to this message Reply
Is this resolved? Do we have a solution? Please help.

Mandla Ncube

Posts: 1
Nickname: n002213f
Registered: May, 2009

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: May 15, 2009 5:23 AM
Reply to this message Reply
I had exactly this same error and fixed it as follows;

In the generated file for the web service request object, e.g Event, there an attribute typeDesc and a static body follows initialising typeDesc.

For each element added to the typeDesc, there are lines;
elemField.setFieldName("eventID");
elemField.setXmlName(new javax.xml.namespace.QName("", "EventID"));


make sure the string literals are of the same case, i.e both should be "EventID"

hope it helps someone

shajid basha

Posts: 2
Nickname: shajid4u
Registered: Jun, 2009

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Jun 9, 2009 1:01 AM
Reply to this message Reply
Hi Mandla Ncube,

Please can you specify little bit clear.

By taking field name as "contactID".

Thanks,
Shajid

shajid basha

Posts: 2
Nickname: shajid4u
Registered: Jun, 2009

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Jun 9, 2009 3:32 AM
Reply to this message Reply
Hi,

org.xml.sax.SAXException: Invalid element in BeanService.OutletStatus - allItems
Available

Using Axis1.4

I have 2 webservices already in my tomcat server. Both are working fine. When i deploy 3rd service then i am facing this error. But if i place this 3 rd service Only its working fine. Can any one guide me what the problem is and where?

Thanks in Advance.
Shajid

yd yd

Posts: 2
Nickname: yd
Registered: Oct, 2009

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Oct 19, 2009 5:35 AM
Reply to this message Reply
> I had exactly this same error and fixed it as follows;
>
> In the generated file for the web service request object,
> e.g Event, there an attribute typeDesc and a static
> body follows initialising typeDesc.
>
> For each element added to the typeDesc, there are lines;
> elemField.setFieldName("eventID");
> elemField.setXmlName(new
> Name(new javax.xml.namespace.QName("", "EventID"));

>
> make sure the string literals are of the same case, i.e
> both should be "EventID"
>
> hope it helps someone

Thanks !!!
That helped ...
So the issue is because of :-

This part is either not mentioned or screwed up :

elemField.setFieldName("eventID");
elemField.setXmlName(new javax.xml.namespace.QName("", "EventID"));

Normally this should not pose a problem if you are using Axis's wsdl2java tool. Be completely sure that the xsd files that the wsdl references has the properties correctly set(eventID in the above line)..

This solved my problem

yd yd

Posts: 2
Nickname: yd
Registered: Oct, 2009

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Nov 3, 2009 3:08 AM
Reply to this message Reply
Guess what, I found more reasons why this occurs :

This is what we have in the POJO:

elemField = new org.apache.axis.description.ElementDesc();
elemField.setFieldName("bMSL_KOL");
elemField.setXmlName(new javax.xml.namespace.QName("urn:/crmondemand/xml/contact", "bMSL_KOL"));
elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
elemField.setMinOccurs(0);
elemField.setNillable(false);
typeDesc.addFieldDesc(elemField);

And this is the response coming in:-

<Event object="Contact" name="whatever" operation="update">
<SiebelMessage>
<ListOfContact xmlns="urn:/crmondemand/xml/contact">
<Contact>
<ContactFirstName&g t;whatever</ContactFirstName>
<ContactId>whatever</ContactId>
<ContactLastName>whatever</ContactLastName>
<AlternateAddressId&g t;whatever</AlternateAddressId>
<ExternalSystemId/>
<IntegrationI d>whatever</IntegrationId>
<bMSL_KOL>Y</bMSL_KOL>
<ModId >whatever</ModId>
<CreatedDate>whatever</CreatedDate>
<M odifiedById>whatever</ModifiedById>
<ModifiedDate>whatever</Mo difiedDate>
<CreatedById>whatever</CreatedById>
</Contact>
</ListOfContact>
</SiebelMessage>
</Event>


What really happens in that page is:-
The field name coming in is bMSL_KOL and NOT BMSL_KOL.
Note the case of the first-letter. And what happens next is the word "set" is appended to this and the corresponding setter called ! So when we create setters for bMSL_KOL, this is what we have in the pojo:

public String getBMSL_KOL() {
return bMSL_KOL;
}

public void setBMSL_KOL(String bmsl_kol) {
bMSL_KOL = bmsl_kol;
}

Change this to :-

public String getbMSL_KOL() {
return bMSL_KOL;
}

public void setbMSL_KOL(String bmsl_kol) {
bMSL_KOL = bmsl_kol;
}

This is a really frustrating solution, found it after 3 days ! :X

jelli sons

Posts: 1
Nickname: aa123
Registered: Dec, 2011

Re: How to solve org.xml.sax.SAXException: Invalid element in problem Posted: Dec 8, 2011 5:56 AM
Reply to this message Reply
pls help me...
I am developing Webservices in java for my application and
I am getting error as:


<faultcode>soapenv:Server.userException</faultcode>
<faultstring>org.xml.sax.SAXException: Invalid element in temp.staticp.purchaseorder.PurchaseProduct - item </faultstring>

my method is as :
public Order
getpurchaseOrder(String user_id,String date,int total_amount,PurchaseProductSelected product){}
and i am sending PurchaseProductSelected class object ....

pls help me.I am struggling lot for solution but not able to resolve it...

I am using complex class for webservices..

Flat View: This topic has 12 replies on 1 page
Topic: Problem to communicat with a web service using gSOAP Previous Topic   Next Topic Topic: faultString: SOAP-ERROR: Encoding: object hasn't 'code' property

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use