This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud and have Kyle Brown, Bobby Woolf and Joseph Yodor on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

WebSphere 6.1 encoding exception

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I recently moved to 6.1 from 5.1 and a previously working soap request is now failing

<?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>
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.io.UTFDataFormatException: Invalid UTF8 encoding.</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>


I changed the encoding on my request to ISO-8859-1 and it now works in WAS 6.1.

So my question is does anyone why that is? Obviously its become more strict but I havent been able to locate any documentation on it. I am not even sure if I selected a good encoding method now. If anyone has any better suggestions then let me know. The request Im sending is basically a html page in CDATA tags.

Thanks a lot
 
Marshal
Posts: 28425
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The encoding you should put on the XML document is the encoding you're actually using to produce the document. Or, if you don't put any encoding on the document then you should use UTF-8 to produce the document.

But that's nothing to do with Websphere and everything to do with the code you're using to produce the document.

If you don't know how to control the encoding you use for writing data, then post the code you're using to output it. In the meantime I will move this to a more suitable forum.
 
Sharon Cleary
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I understand that the encoding is XML related. However what i am not clear on is why my new environment (WwebSphere 6.1 & JDK1.5) decided to raise this as an error when previously the exact same request passed. The request itself contains HTML so this is obviously the reaqson why it is now failing. I would just like to understand what has caused things to become more strict if that makes sense?
In the meantime I changed the encoding on the XML request to ISO 8859-1. Im not sure if this was the coorect thing to do from an XML point of view. Should I perhaps just written code to remove the non UTF-8 chars?

Thanks
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think it's a case of that you've specified UTF-8 Encoding in your document but what ever code/process that's producing the XML isn't actually producing valid UTF-8. I'm no Websphere expert but I suspect that they've simply improved their detection of this.

Changing your encoding is the 'correct' thing to do if that is the encoding you want/need to use, e.g. It appears that the code/process you are using to create the XML is ISO 8859-1 encoding compatible.

If you have no requirement for UTF-8 then I wouldn't overly worry about it, but do be careful about this, i18n can creep into a project before you know it!

Hope that helps!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic