You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "sari.reach" <sa...@gmail.com> on 2016/09/19 17:31:35 UTC
cxf-core 3.1.7 Validation issue with camel
cxf-core 3.1.7 is not validating the xml with xsd at appropriate location
Exception says: <faultstring>Could not generate the XML stream caused by:
org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
element 'ATT_CheckRS'..</faultstring>
Sample code is as below
import org.apache.camel.Exchange;
import org.apache.camel.Message;
import org.apache.camel.Processor;
public class TestProcess implements Processor {
public void process(Exchange exchange) throws Exception {
Message message = exchange.getOut();
message.setBody( bindMessage());
exchange.setOut(message);
//java.lang.System.out.println("MIP of Http Endpoint is " +
message);
java.lang.System.out.println("NEW MIP of Http Endpoint is " +
exchange.getPattern());
}
private String bindMessage(){
return "<ATT_CheckRS
TimeStamp=\"2016-03-08T07:01:30.175Z\" Version=\"1.003\"
TransactionIdentifier=\"\" PrimaryLangID=\"ENG\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns=\"http://www.travel.org/ABC/2003/05\">"
+"<POS>"
+"<Source PseudoCityCode=\"\" ISOCurrency=\"\">"
+"<RequestorID Type=\"05\"/>"
+"</Source>"
+"</POS>"
+"<Errors xmlns=\"\">"
+"<Error Code=\"320\" Language=\"en_US\" ShortText=\"Invalid value\"
Status=\"\" Type=\"4\"/>"
+"</Errors>"
+"</ATT_CheckRS>";
}
}
--
View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: cxf-core 3.1.7 Validation issue with camel
Posted by "sari.reach" <sa...@gmail.com>.
Please accept this request
On Mon, Sep 19, 2016 at 11:01 PM, sari.reach [via Camel] <
ml-node+s465427n5787728h73@n5.nabble.com> wrote:
> cxf-core 3.1.7 is not validating the xml with xsd at appropriate location
>
> Exception says: <faultstring>Could not generate the XML stream caused by:
> org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
> element 'ATT_CheckRS'..</faultstring>
>
> Sample code is as below
>
> import org.apache.camel.Exchange;
> import org.apache.camel.Message;
> import org.apache.camel.Processor;
>
> public class TestProcess implements Processor {
>
> public void process(Exchange exchange) throws Exception {
> Message message = exchange.getOut();
>
> message.setBody( bindMessage());
> exchange.setOut(message);
> //java.lang.System.out.println("MIP of Http Endpoint is " +
> message);
> java.lang.System.out.println("NEW MIP of Http Endpoint is "
> + exchange.getPattern());
>
> }
>
>
> private String bindMessage(){
> return "<ATT_CheckRS TimeStamp=\"2016-03-08T07:01:30.175Z\"
> Version=\"1.003\" TransactionIdentifier=\"\" PrimaryLangID=\"ENG\"
> xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"
> http://www.travel.org/ABC/2003/05\">"
> +"<POS>"
> +"<Source PseudoCityCode=\"\" ISOCurrency=\"\">"
> +"<RequestorID Type=\"05\"/>"
> +"</Source>"
> +"</POS>"
> +"<Errors xmlns=\"\">"
> +"<Error Code=\"320\" Language=\"en_US\" ShortText=\"Invalid value\"
> Status=\"\" Type=\"4\"/>"
> +"</Errors>"
> +"</ATT_CheckRS>";
>
>
>
> }
> }
>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
> http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-
> issue-with-camel-tp5787728.html
> To start a new topic under Camel - Users, email
> ml-node+s465427n465428h73@n5.nabble.com
> To unsubscribe from Camel - Users, click here
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=465428&code=c2FyaS5yZWFjaEBnbWFpbC5jb218NDY1NDI4fDE2ODE4MDY5NDU=>
> .
> NAML
> <http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787729.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: cxf-core 3.1.7 Validation issue with camel
Posted by Willem Jiang <wi...@gmail.com>.
You need to use the <cxf:cxfEndpoint>[1] instead of the generic camel endpoint to setup the schemaLocations for validation.
<cxf:cxfEndpoint id=“endpoint1” address=“/HotelBookPort” wsdlURL="hotel/hotelbook.wsdl”>
<cxf:schemaLocations>
<cxf:schemaLocation>xxxx</cxf:schemaLocation>
</cxf:schemaLocations>
<cxf:cxfEndpoint>
…
<camelContext>
<route>
<from uri=“cxf:bean:endpoint1?dataFormat=PAYLOAD&properties.schema-validation-enabled=true”>
…
</route>
</camelContext>
[1]http://camel.apache.org/cxf.html#CXF-ConfiguretheCXFendpointswithSpring
--
Willem Jiang
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On September 23, 2016 at 12:16:21 PM, sari.reach (sari.reach@gmail.com) wrote:
> Any update on this Willem?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787946.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: cxf-core 3.1.7 Validation issue with camel
Posted by "sari.reach" <sa...@gmail.com>.
Any update on this Willem?
--
View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787946.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: cxf-core 3.1.7 Validation issue with camel
Posted by "sari.reach" <sa...@gmail.com>.
Hi,
Please find the entire camel-config.xml.
Schema information is inside the resource folder(in classpath). For this
scenario, request validation is working fine and only response validation is
creating an issue
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<endpoint id="OTAHotelBook_OTA_2012B_EndPoint"
uri="cxf:/HotelBookPort?wsdlURL=hotel/hotelbook.wsdl&dataFormat=PAYLOAD&properties.schema-validation-enabled=true"
/>
<route>
<from uri="ref:OTAHotelBook_OTA_2012B_EndPoint" />
<log logName="OTAHotelAvailability-ENTRY" message="Message"
loggingLevel="INFO"/>
<camel:process ref="testProcess"></camel:process>
</route>
</camelContext>
<bean id="testProcess"
class="com.ibsplc.icomm.test.cxf.TestProcess"></bean>
</beans>
--
View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787798.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: cxf-core 3.1.7 Validation issue with camel
Posted by Willem Jiang <wi...@gmail.com>.
I think you you need to specify the schemaLocation from the spring configuration file to let the CXF Endpoint knows about.
Please check the example here[1]
[1]http://camel.apache.org/cxf.html#CXF-ConfiguretheCXFendpointswithSpring
--
Willem Jiang
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On September 20, 2016 at 2:49:38 PM, sari.reach (sari.reach@gmail.com) wrote:
> Please find the camel route below. Please let me know if you need additional
> information. I am pasting the exception trace as well.
>
>
>
> >
> uri="cxf:/HotelBookPort?wsdlURL=hotel/hotelbook.wsdl&dataFormat=PAYLOAD&properties.schema-validation-enabled=true"
> />
>
>
> > loggingLevel="INFO"/>
>
>
>
>
> Exception Trace:
>
> org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused
> by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
> element 'ATT_CheckRS'..
> at
> org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:99)
> at
> org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:54)
> at
> org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:100)
> at
> org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:81)
> at
> org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:137)
> at
> org.apache.cxf.wsdl.interceptors.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> at
> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:83)
> at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
> at
> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
> at
> org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)
> at
> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
> at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
> at
> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
> at
> org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
> at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293)
> at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
> at
> org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268)
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787746.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: cxf-core 3.1.7 Validation issue with camel
Posted by "sari.reach" <sa...@gmail.com>.
Please find the camel route below. Please let me know if you need additional
information. I am pasting the exception trace as well.
<camelContext xmlns="http://camel.apache.org/schema/spring">
<endpoint id="OTAHotelBook_OTA_2012B_EndPoint"
uri="cxf:/HotelBookPort?wsdlURL=hotel/hotelbook.wsdl&dataFormat=PAYLOAD&properties.schema-validation-enabled=true"
/>
<route>
<from uri="ref:OTAHotelBook_OTA_2012B_EndPoint" />
<log logName="OTAHotelAvailability-ENTRY" message="Message"
loggingLevel="INFO"/>
<camel:process ref="testProcess"></camel:process>
</route>
</camelContext>
Exception Trace:
org.apache.cxf.interceptor.Fault: Could not generate the XML stream caused
by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
element 'ATT_CheckRS'..
at
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:99)
at
org.apache.cxf.databinding.source.XMLStreamDataWriter.write(XMLStreamDataWriter.java:54)
at
org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:100)
at
org.apache.camel.component.cxf.HybridSourceDataBinding$1.write(HybridSourceDataBinding.java:81)
at
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:137)
at
org.apache.cxf.wsdl.interceptors.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:83)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:251)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
at
org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:293)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:212)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at
org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268)
--
View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728p5787746.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: cxf-core 3.1.7 Validation issue with camel
Posted by Willem Jiang <wi...@gmail.com>.
Can you show us the camel route?
It looks like you are trying to send a XML message to the CXF server.
We need to find out where the exception is thrown.
--
Willem Jiang
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On September 20, 2016 at 3:26:38 AM, sari.reach (sari.reach@gmail.com) wrote:
> cxf-core 3.1.7 is not validating the xml with xsd at appropriate location
>
> Exception says: Could not generate the XML stream caused by:
> org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of
> element 'ATT_CheckRS'..
>
> Sample code is as below
>
> import org.apache.camel.Exchange;
> import org.apache.camel.Message;
> import org.apache.camel.Processor;
>
> public class TestProcess implements Processor {
>
> public void process(Exchange exchange) throws Exception {
> Message message = exchange.getOut();
>
> message.setBody( bindMessage());
> exchange.setOut(message);
> //java.lang.System.out.println("MIP of Http Endpoint is " +
> message);
> java.lang.System.out.println("NEW MIP of Http Endpoint is " +
> exchange.getPattern());
>
> }
>
>
> private String bindMessage(){
> return "> TimeStamp=\"2016-03-08T07:01:30.175Z\" Version=\"1.003\"
> TransactionIdentifier=\"\" PrimaryLangID=\"ENG\"
> xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
> xmlns=\"http://www.travel.org/ABC/2003/05\">"
> +""
> +""
> +""
> +""
> +""
> +""
> +"> Status=\"\" Type=\"4\"/>"
> +""
> +"";
>
>
>
> }
> }
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/cxf-core-3-1-7-Validation-issue-with-camel-tp5787728.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>