Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Jax ws client failing because of UTF-8 BOM - woodstox-core-asl-4.1.2.jar:4.1.2

Posted on 2015-02-14
11
419 Views
Last Modified: 2015-05-16
I have web service client written in JAX-WS.
I'm receiving a response with a UTF-8 BOM.

[0xef][0xbb][0xbf]<?xml ....

So When the same jax-ws client code is deployed to Tomcat server we did have any problem. May be because of tomcat using a different parser.

But we have to deploy our code only in JBoss server - where the application parser is being picked up - woodstox-core-asl-4.1.2.jar:4.1.2. (I will have to use a specific parser only for this jax-ws client if changing the parser is a solution).

Stack trace:

12:27:24,867 FINE  [org.apache.cxf.phase.PhaseInterceptorChain] (http--0_0_0_0_0_0_0_0-8080-2) Invoking handleFault on interceptor org.apache.cxf.ws.policy.PolicyInInterceptor@389dd05c
12:27:24,868 WARNING [org.apache.cxf.phase.PhaseInterceptorChain] (http--0_0_0_0_0_0_0_0-8080-2) Interceptor for {urn:cache-claim:2003-09-30}WebService#{urn:cache-claim:2003-09-30}MOClaimFastEnqLimits has thrown exception, unwinding now: java.lang.RuntimeException: Couldn't parse stream.
                at org.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:1178)
                at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:104)
                at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
                at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:795)


Caused by: com.ctc.wstx.exc.WstxIOException: Unexpected first character (char code 0xEF), not valid in xml document: could be mangled UTF-8 BOM marker. Make sure that the Reader uses correct encoding or pass an InputStream instead
                at com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:174) [woodstox-core-asl-4.1.2.jar:4.1.2]

Please kindly help me with a solution, I'm desparete to get this working ?
0
Comment
Question by:Faiz03
  • 5
  • 5
11 Comments
 
LVL 62

Expert Comment

by:gheist
ID: 40610711
probably you have 2 conflicting versions of com.ctc.wstx arount your application/server/jdk.
0
 

Author Comment

by:Faiz03
ID: 40610730
No I Have only woodstox-core-asl-4.1.2.jar. And this stax is part of the application in class path.I don't want to use this stax as it is failing(i.e. It cannot handle UTF-8 BOM) - ReaderBootstrapper.class If you look at the source of this class you find this

if (c == 0xEF) {
 throw new WstxIOException("Unexpected first character (char code 0xEF), not valid in xml document: could be mangled UTF-8 BOM marker. Make sure that the Reader uses correct encoding or pass an InputStream instead");  }

Open in new window


So i would like to use different stax implementation for my Jax ws client or any other solution.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40610745
Well you have some other UTF problem - you have first part of UTF only. There is some problem with UTF generator chopping strings by bytes not by characters.
0
Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

 

Author Comment

by:Faiz03
ID: 40610761
I have verified the response from the third party - Web Service provider (.net) and they are valid response, but they also send the BOM - Byte order mark. Which i have already mentioned,

i have written a Web Serivce client in JAX-WS Which use the stax implementaion in class path - woodstox. And the wood stox parser dosent handle BOM. While the response is still correctly parsed by different stax implemetation etc. I'm sure if i change the stax implemtation this will work but i would like to change this only for Jax -ws client and not for the whole application or any solution that will help solve this problem.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40610769
why dont you fill a bug report with them?
0
 

Accepted Solution

by:
Faiz03 earned 0 total points
ID: 40610779
I have raised this with third party asking for not sending the byte order mark - BOM but i'm if they are going to resolve this by not sending the BOM. If they do so Happy days. I don't have to change anything.

If i have to file a bug report with woodstox i don't think it is going to get me anything.

I just have time for  a week. And I'm pretty sure that there are alternate ways around this Stax implementation issue but i dont know what they are.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40610884
You can open bug report. BOM is legal beginning of XML.
I'd say most XML toolkits will fail with BOM in network stream.
0
 

Author Comment

by:Faiz03
ID: 40610922
Yes i did fingers crossed. I'm still working/searching for a workaround for this.
0
 
LVL 62

Expert Comment

by:gheist
ID: 40611042
Stop microsoft from adding useless BOM character?
0
 

Author Closing Comment

by:Faiz03
ID: 40780618
Because this is what i have ended up with.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to start Neon 20 120
servlet example 11 49
jsp login check 12 43
jsp error 6 26
Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
For some reason Google Apps has decided to reserve 'www' for your new domain which results in an error when trying to map the web address 'www' to a certain site in your Google Sites. The error is 'this address is already being used' and after some …
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
The viewer will learn how to implement Singleton Design Pattern in Java.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question