• Post Reply Bookmark Topic Watch Topic
  • New Topic

XML Parser Error  RSS feed

 
Rithanya Laxmi
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,

I am getting the below error while parsing the SOAP XML response object, I am using xmlparserv2.jar. Please let me know what is the issue here?

oracle.xml.parser.v2.XMLDOMException: invalid character   in name
at oracle.xml.util.XMLUtil.validateQualifiedName(XMLUtil.java:1048)
oracle.xml.parser.v2.XMLElement.setAttributeNS(XMLElement.java:1249)
oracle.j2ee.ws.saaj.soap.ElementImpl.addNamespaceDeclaration(ElementImpl.java:277)
oracle.j2ee.ws.saaj.soap.soap11.Fault11.setFaultCode(Fault11.java:312)
oracle.j2ee.ws.saaj.soap.soap11.Fault11.setFaultCode(Fault11.java:345)
oracle.j2ee.ws.saaj.soap.soap11.SOAPFactory11.createFault(SOAPFactory11.java:51)
oracle.j2ee.ws.saaj.soap.SOAPFactoryImpl.createFault(SOAPFactoryImpl.java:118)
com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:184)

Thanks
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37395
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's unhappy about something in the XML. Can you post your XML? Or try removing XML snippets to see when the error goes away (to narrow it down).
 
Rithanya Laxmi
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The real challenge I have here is this response is coming from 3rd party system and the error is thrown in the response object, hence we are not able to log it , hence at this point not sure what is the XML response that is sent by the 3rd party. When contacted them there are not sure about the response which they sent to us ? as there are not logging it anywhere. This is the roadblock we are into? whether this is something to do with some poisonous data that is passed as a response in the XML? which the parser is unable to parse? if so what might be those invalid data? any idea on this will surely help. Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37395
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone needs to log the data. Is this third party system running on a remote server or via a jar in your app? If the later, you could setup an aspect (using AOP) and log it yourself.
 
Rithanya Laxmi
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 3rd party system is running in a remote server. Based on the error it seems that they are sending some invalid data which the parser is unable to parse?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37395
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's two possibilities here. One you should be able to troubleshoot by looking at the raw XML you are receiving back without trying to parse it. What code do you use to read the XML that is returned.

This will let you see the XML returned. However, it is likely that will reveal the need for the third party system to do something since they are sending back invalid HTML.
 
Rithanya Laxmi
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem here is I am unable to know which response XML they are sending back to our application, since the response is POJO based generated from the WSDL provided by the 3rd party we know what are the elements and objects the response XML will have, apart from that we dont know what are the values they are sending back to us for those elements? that is the challenge , hence without knowing the values for those response elements it is pretty difficult to know which element value is having the issue here? please let me know your opinion on this?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37395
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all, you know what data you are sending to third party. They should be able to determine the response from that. If not (and if you are paying for this third party service), I strongly recommend you ask your manager to complain to the third party provider.

My earlier suggestion is to change the code at your end if possible to return the String rather than start parsing. Maybe you could show the code you use to call the third party? That way we can advise more specifically rather than speculate about the code.
 
Rithanya Laxmi
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is the request we are passing from our app to the 3rd party system:-

<S:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/><S:Body>
<ns0:CUSTOMERAVAILABILITY xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
<CUSTOMER>
<CUST_ID>567890</ CUST_ID>
<NAME>Crawford Scientific Ltd</NAME><NAME_2></NAME_2><NAME_3></NAME_3>
<STREET>Holm Street</STREET><COUNTRY>GB</COUNTRY><POSTL_CODE>ML10 6NB</POSTL_CODE>
<CITY>STRATHAVEN</CITY><REGION></REGION><LANGU>EN</LANGU><TRANSPZONE>CRAWFD</TRANSPZONE>
</CUSTOMER>
</ns0: CUSTOMERAVAILABILITY ></S:Body></S:Envelope>

We are getting the Invalid Character in name error in the below line where we are getting the response back from 3rd party system:-

CustomerAvailabilityResponse response = port.CustomerAvailabilityResponse (request);

Since we are getting the exception in the response object sent by 3rd party , we are not sure what is the response they have sent? how to get the response by converting to string? whether that will work? if not in this case the only way is to get the response from the 3rd party system?

Thanks.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37395
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rithanya Laxmi wrote:we are not sure what is the response they have sent? how to get the response by converting to string? whether that will work?

You need to show the code you are using to call the third party system to get an answer to this...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!