Dear CXF-Users, I posted following questions at the camel users forum but got no reply. Could anyone here help me with configuring the schemalocations for a cxf proxy used via camel route (see below).
Thanks and Best Regards, Michael ---------- Forwarded message ---------- From: Michael Täschner <m.taesch...@gmail.com> Date: 2014-06-27 14:35 GMT+02:00 Subject: Re: camel-cxf proxy failed wsdl reading with local schemaLocations To: us...@camel.apache.org Hi, could anybody give me a hint with this issue (using schemalocations with cxf:Endpoint) ? Thanks and Regards, Michael 2014-06-23 16:20 GMT+02:00 Michael Täschner <m.taesch...@gmail.com>: > Hi Camel-Riders, > > we are (still) using SMX4.5 (Camel 2.10.7) and are trying to proxy a > SOAP call to external URL (plus reading statistics from input > message). For offline testing we have created a SoapUI mock target and > we declare schemaLocations inside the cxfEndpoint. Unfortunately the > schemata are not read at time of cxfEndpoint consumer creation: > > 15:36:40,366 WARN [ReflectionServiceFactoryBean] Failed to parse WSDL > javax.wsdl.WSDLException: WSDLException (at > /wsdl:definitions/wsdl:types/xsd:schema): faultCode=PARSER_ERROR: > Problem parsing > 'https://newskies-test.someairline.com/SessionManager.svc?xsd=xsd1'.: > java.net.UnknownHostException: newskies-test.someairline.com > at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2198) > at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:830) > at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(WSDLReaderImpl.java:654) > at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(WSDLReaderImpl.java:610) > at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(WSDLReaderImpl.java:320) > at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2352) > at com.ibm.wsdl.xml.WSDLReaderImpl.readWSDL(WSDLReaderImpl.java:2338) > at > org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:245) > at > org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:190) > at > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.isEmptywsdl(ReflectionServiceFactoryBean.java:2598) > at > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.isFromWsdl(ReflectionServiceFactoryBean.java:543) > at > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:547) > at > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265) > at > org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:101) > at > org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:159) > at org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:240) > at > org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:204) > > We have dowloaded all corresponding schemata (e.g. > "https://newskies-test.someairline.com/SessionManager.svc?xsd=xsd1") > and referenced them via the schemaLocation config. > > Following the endpoint and camelContext: > > Endpoint definition: > <!-- this is the CXF web service we use as the front end --> > <cxf:cxfEndpoint id="frontendSessionManager" > address="http://0.0.0.0:8090/SessionManager.svc" > wsdlURL="etc/SessionManager/SessionManager.wsdl" > > > > <!-- WSDL: wsdlURL="etc/SessionManager/SessionManager.wsdl" > wsdlURL="http://localhost:8088/SessionManager.svc?wsdl --> > <cxf:inInterceptors> > <ref bean="loggingInInterceptor" /> > </cxf:inInterceptors> > <cxf:outInterceptors> > <ref bean="loggingOutInterceptor" /> > <ref bean="sAAJOutInterceptor" /> > <!-- ref bean="isb4uStatisticCalculatorInterceptor"/ --> > </cxf:outInterceptors> > <cxf:inFaultInterceptors> > <ref bean="loggingInInterceptor" /> > </cxf:inFaultInterceptors> > <cxf:outFaultInterceptors> > <ref bean="loggingOutInterceptor" /> > </cxf:outFaultInterceptors> > > <cxf:schemaLocations> > <!-- > > <cxf:schemaLocation>http://localhost:8088/SessionManager.svc?WSDL&interface=BasicHttpBinding_ISessionManager&part=SessionManager.xsd</cxf:schemaLocation> > --> > > <cxf:schemaLocation>classpath:etc/SessionManager/xsd0-serviceContracts-sessionService.xsd</cxf:schemaLocation> > > <cxf:schemaLocation>classpath:etc/SessionManager/xsd1-serialization.xsd</cxf:schemaLocation> > > <cxf:schemaLocation>classpath:etc/SessionManager/xsd2-dataContracts-sessionService.xsd</cxf:schemaLocation> > > <cxf:schemaLocation>classpath:etc/SessionManager/xsd3-webservices.xsd</cxf:schemaLocation> > > <cxf:schemaLocation>classpath:etc/SessionManager/xsd4-webservices-dataContracts-common-enumerations.xsd</cxf:schemaLocation> > </cxf:schemaLocations> > > <cxf:properties> > <!-- Set the publishedEndpointUrl which could override the service > address from generated WSDL as you want --> > <!-- > <entry key="publishedEndpointUrl" value="http://localhost:8090" /> > --> > <entry key="synchronous" value="true" /> > <!-- enable logging in cxf message mode --> > <entry key="dataFormat" value="MESSAGE" /> > <entry key="schema-validation-enabled" value="false" /> > </cxf:properties> > </cxf:cxfEndpoint> > > CamelContext: > <!-- this is the Camel route which proxies the real web service and > forwards SOAP requests to it --> > <camel:camelContext id="context" streamCache="true" > > <!-- disable stream caching spool to disk --> > <camel:properties> > <camel:property key="CamelCachedOutputStreamThreshold" value="-1" /> > </camel:properties> > <camel:endpoint id="backendSessionManager" > uri="http://localhost:8088/SessionManager.svc?httpClient.soTimeout=5000&throwExceptionOnFailure=false" > /> > > <camel:route id="SessionManager" > > <!-- CXF consumer using MESSAGE format --> > <camel:from uri="cxf:bean:frontendSessionManager?dataFormat=MESSAGE" /> > <camel:doTry> > <!-- send proxied request to real web service --> > <camel:to ref="backendSessionManager" /> > </camel:doTry> > </camel:route> > </camel:camelContext> > > There may be more errors in the definition but the failure to create > the cxfEndpoint consumer due to trying to look-up the schemata from > remote host instead of using the local copies is blocking our > progress. > > The Root cause we tracked so far seems to be in > org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL[1]. > whereby the serviceFactory is created up front but schemaLocations are > only read at the end via "initializeDataBindings". > > Any idea how to resolve this (i.e. get the cxfEndpoint consumer > started with local schemata) would be welcome! > Regards, > Michael > > [1] > http://grepcode.com/file/repo1.maven.org/maven2/org.apache.cxf/cxf-bundle/2.7.7/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java#407