camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bocamel <johnz...@gmail.com>
Subject RE: Validate Xml
Date Thu, 01 Aug 2013 19:13:46 GMT
Claus and Willem,  

 

Thanks!

 

I tried both options without success.  But I successfully added my
OutFaultInterceptor to the cxfendpoint.  When my interceptor got control,
the SOAP message had all the right information, so the mystery (why it was
not sent back to the client) still remained.  Nevertheless, my interceptor
allowed me to observe that another exception (shown below) was thrown after
my interceptor returned.  This exception was what Willem asked about.  I
think Willem hit the problem on the head that this subsequent exception
prevented the XML validation error from being returned to the Web Services
client.  Now I need to determine if there are two servlets with the same
name in my classpath..

 

[              qtp1226683340-18] AbstractHttpConnection         WARN
/myService/

java.lang.NoSuchMethodError:
javax.servlet.http.HttpServletRequest.getLocalAddr()Ljava/lang/String;

      at
org.apache.cxf.transport.http.HttpServletRequestSnapshot.<init>(HttpServletR
equestSnapshot.java:80)

      at
org.apache.cxf.transport.http.AbstractHTTPDestination$1.cacheInput(AbstractH
TTPDestination.java:276)

      at
org.apache.cxf.transport.http.AbstractHTTPDestination.cacheInput(AbstractHTT
PDestination.java:527)

      at
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractH
TTPDestination.java:539)

      at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.flushHeaders(JettyH
TTPDestination.java:380)

      at
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractH
TTPDestination.java:532)

      at
org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream.on
FirstWrite(AbstractHTTPDestination.java:709)

      at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStr
eam.java:47)

      at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:100)

      at
com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:225)

      at
com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:198)

      at
com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1404)

      at
com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:536)

      at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInte
rceptor.handleMessage(SoapOutInterceptor.java:283)

      at
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInte
rceptor.handleMessage(SoapOutInterceptor.java:271)

      at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain
.java:271)

      at
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(Abs
tractFaultChainInitiatorObserver.java:114)

      at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain
.java:331)

      at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationOb
server.java:121)

      at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(Jett
yHTTPDestination.java:355)

      at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTP
Destination.java:319)

      at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler
.java:72)

      at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java
:1074)

      at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:
1010)

      at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135
)

      at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHand
lerCollection.java:255)

      at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:1
16)

      at org.eclipse.jetty.server.Server.handle(Server.java:365)

      at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpCo
nnection.java:485)

      at
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnecti
on.java:937)

      at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(Abstr
actHttpConnection.java:998)

      at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)

      at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)

      at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java
:82)

      at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.
java:627)

      at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.j
ava:51)

      at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:
608)

      at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:5
43)

      at java.lang.Thread.run(Thread.java:722)

 

 

 

From: Claus Ibsen-2 [via Camel]
[mailto:ml-node+s465427n5736622h60@n5.nabble.com] 
Sent: Thursday, August 1, 2013 2:29 AM
To: bocamel
Subject: Re: Validate Xml

 

Hi 

I think there is 2 other CXF options you can use to turn of exception 
message and/or stacktraces in the response message. They are turned 
off by default to not shown internal error messages etc by default to 
clients. 

There is this link that points you to the docs 
http://camel.apache.org/how-can-webservice-clients-see-remote-faults-with-st
acktraces-when-using-camel-cxf.html

On Wed, Jul 31, 2013 at 5:56 PM, bocamel <[hidden email]> wrote: 


> Thanks Claus! 
> 
> Using what you suggested, CXF threw an error with much better information 
> about the actual error with the input XML PAYLOAD message.  But there is a

> little problem - the response sent back to the client is a simple HTTP 500

> message without any explanation.  In fact, in this case HTTP 500 is rather

> misleading - leading the client to think that the issue is a server issue 
> when it is actually a client issue.  A HTTP 400 would be more appropriate
in 
> my opinion. 
> 
> So I tried to catch the exception before it is sent back to the client.
But 
> none of the onException in Camel route would be able to catch it - I guess

> the exception was caught by CXF already.  Any suggestion on how to catch
the 
> error in Camel route so that I can control what is sent back to the
client? 
> 
> Here is what I saw on the console: 
> 
> [              qtp1563200034-16] PhaseInterceptorChain          WARN 
> Interceptor for 
> {http://myService}myService#{http://cxf.component.camel.apache.org/}invoke

> has thrown exception, unwinding now 
> org.apache.cxf.interceptor.Fault: Could not parse the XML stream caused
by: 
> com.ctc.wstx.exc.WstxParsingException: Unexpected close tag
</soapenv:Body>; 
> expected </com:test>. 
>  at [row,col {unknown-source}]: [8,17]. 
>         at 
>
org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataRead
er.java:253) 
>         at 
>
org.apache.cxf.databinding.source.XMLStreamDataReader.validate(XMLStreamData
Reader.java:211) 
>         at 
>
org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataRead
er.java:107) 
>         at 
>
org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataRead
er.java:75) 
>         at 
>
org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataRead
er.java:60) 
>         at 
>
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralI
nInterceptor.java:189) 
>         at 
>
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain
.java:271) 
>         at 
>
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationOb
server.java:121) 
>         at 
>
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(Jett
yHTTPDestination.java:355) 
>         at 
>
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTP
Destination.java:319) 
>         at 
>
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler
.java:72) 
>         at 
>
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java
:1074) 
>         at 
>
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:
1010) 
>         at 
>
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135
) 
>         at 
>
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHand
lerCollection.java:255) 
>         at 
>
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:1
16) 
>         at org.eclipse.jetty.server.Server.handle(Server.java:365) 
>         at 
>
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpCo
nnection.java:485) 
>         at 
>
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnecti
on.java:937) 
>         at 
>
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(Abstr
actHttpConnection.java:998) 
>         at
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856) 
>         at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) 
>         at 
>
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java
:82) 
>         at 
>
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.
java:627) 
>         at 
>
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.j
ava:51) 
>         at 
>
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:
608) 
>         at 
>
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:5
43) 
>         at java.lang.Thread.run(Thread.java:722) 
> Caused by: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag 
> </soapenv:Body>; expected </com:test>. 
>  at [row,col {unknown-source}]: [8,17] 
>         at 
>
com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:606) 
>         at
com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:479) 
>         at
com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:464) 
>         at 
>
com.ctc.wstx.sr.BasicStreamReader.reportWrongEndPrefix(BasicStreamReader.jav
a:3266) 
>         at 
> com.ctc.wstx.sr.BasicStreamReader.readEndElem(BasicStreamReader.java:3183)

>         at 
>
com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2829) 
>         at
com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1072) 
>         at 
>
org.apache.cxf.staxutils.DepthXMLStreamReader.next(DepthXMLStreamReader.java
:220) 
>         at
org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1248) 
>         at
org.apache.cxf.staxutils.StaxUtils.readDocElements(StaxUtils.java:1142) 
>         at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1069) 
>         at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1058) 
>         at 
>
org.apache.cxf.databinding.source.XMLStreamDataReader.read(XMLStreamDataRead
er.java:245) 
>         ... 27 more 
> [              qtp1563200034-16] AbstractHttpConnection         WARN 
> /myService/ 
> java.lang.NoSuchMethodError: 
> javax.servlet.http.HttpServletRequest.getLocalAddr()Ljava/lang/String; 
>         at 
>
org.apache.cxf.transport.http.HttpServletRequestSnapshot.<init>(HttpServletR
equestSnapshot.java:80) 
>         at 
>
org.apache.cxf.transport.http.AbstractHTTPDestination$1.cacheInput(AbstractH
TTPDestination.java:276) 
>         at 
>
org.apache.cxf.transport.http.AbstractHTTPDestination.cacheInput(AbstractHTT
PDestination.java:527) 
>         at 
>
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractH
TTPDestination.java:539) 
>         at 
>
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.flushHeaders(JettyH
TTPDestination.java:380) 
>         at 
>
org.apache.cxf.transport.http.AbstractHTTPDestination.flushHeaders(AbstractH
TTPDestination.java:532) 
>         at 
>
org.apache.cxf.transport.http.AbstractHTTPDestination$WrappedOutputStream.on
FirstWrite(AbstractHTTPDestination.java:709) 
>         at 
>
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStr
eam.java:47) 
>         at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:100) 
>         at
com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:225) 
>         at
com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:198) 
>         at 
>
com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1404)

>         at 
>
com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java:536)

>         at 
>
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInte
rceptor.handleMessage(SoapOutInterceptor.java:283) 
>         at 
>
org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor$SoapOutEndingInte
rceptor.handleMessage(SoapOutInterceptor.java:271) 
>         at 
>
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain
.java:271) 
>         at 
>
org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(Abs
tractFaultChainInitiatorObserver.java:114) 
>         at 
>
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain
.java:331) 
>         at 
>
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationOb
server.java:121) 
>         at 
>
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(Jett
yHTTPDestination.java:355) 
>         at 
>
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTP
Destination.java:319) 
>         at 
>
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler
.java:72) 
>         at 
>
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java
:1074) 
>         at 
>
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:
1010) 
>         at 
>
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135
) 
>         at 
>
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHand
lerCollection.java:255) 
>         at 
>
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:1
16) 
>         at org.eclipse.jetty.server.Server.handle(Server.java:365) 
>         at 
>
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpCo
nnection.java:485) 
>         at 
>
org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnecti
on.java:937) 
>         at 
>
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(Abstr
actHttpConnection.java:998) 
>         at
org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856) 
>         at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) 
>         at 
>
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java
:82) 
>         at 
>
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.
java:627) 
>         at 
>
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.j
ava:51) 
>         at 
>
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:
608) 
>         at 
>
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:5
43) 
>         at java.lang.Thread.run(Thread.java:722) 
> 
> 
> 
> 
> -- 
> View this message in context:
http://camel.465427.n5.nabble.com/Validate-Xml-tp472122p5736587.html
> Sent from the Camel - Users mailing list archive at Nabble.com. 




-- 
Claus Ibsen 
----------------- 
Red Hat, Inc. 
Email: [hidden email] 
Twitter: davsclaus 
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen



  _____  

If you reply to this email, your message will be added to the discussion
below:

http://camel.465427.n5.nabble.com/Validate-Xml-tp472122p5736622.html 

To unsubscribe from Validate Xml, click here
<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscrib
e_by_code&node=472122&code=am9obnp5aW5AZ21haWwuY29tfDQ3MjEyMnwyOTcyNzcxNDg=>
.
 
<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_view
er&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNa
mespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.No
deNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_ema
ils%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML 





--
View this message in context: http://camel.465427.n5.nabble.com/Validate-Xml-tp472122p5736655.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message