camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mvsunil <mvsu...@gmail.com>
Subject Re: CXF endpoint with schema validation true
Date Thu, 20 Nov 2008 06:48:13 GMT

Hi Willem,
Below is my spring based camel xml where the from route is CXF webservice. 

<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
	xmlns:cxf="http://activemq.apache.org/camel/schema/cxfEndpoint"
	xsi:schemaLocation="
            http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://activemq.apache.org/camel/schema/cxfEndpoint
			http://activemq.apache.org/camel/schema/cxf/cxfEndpoint.xsd
http://activemq.apache.org/camel/schema/spring 
			http://activemq.apache.org/camel/schema/spring/camel-spring.xsd">

        <import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<cxf:cxfEndpoint id="accountManagementEndpoint"
		address="/AccountManagement"
		wsdlURL="/WEB-INF/wsdl/extn_parlayx_account_management_service_2_2.wsdl"
		serviceClass="com.hp.rmm.ce.accmgmt.AccountManagement" 
endpointName="s:AccountManagement"
		serviceName="s:AccountManagementService"
	
xmlns:s="http://www.csapi.org/wsdl/parlayx/account_management/v2_2/service">
		<cxf:properties>
			<entry key="schema-validation-enabled" value="true" />
		</cxf:properties>
		</cxf:cxfEndpoint>
<route>
			<from uri="cxf:bean:accountManagementEndpoint" />
			<choice>
				<when>
					<jxpath>/in/headers/@operationName =
						'createAccount'</jxpath>
					<bean ref="processBean" method="processCreateAccount" />

					<try>
						<to uri="jdbc:dataSource?readSize=100" />
						<catch>
							<exception>java.lang.Exception</exception>
							<bean ref="processBean" method="setException" />
						</catch>
					</try>
					<bean ref="processBean" method="processCreateResult" />
				</when>
</choice>
		</route>
	</camelContext>
</beans>

Thanks,
Sunil.

willem.jiang wrote:
> 
> Hi ,
> 
> Can you show me the rule DSL ?
> Maybe we can just enable the schema validation at a certain endpoint.
> 
> Willem
> 
> mvsunil wrote:
>> Hi Ashwin,
>> 
>> Yes I agree schema validation happens both for request and response, But
>> i
>> am sending a response with all objects set. The error i get is something
>> to
>> do with target namespace i guess but not sure. Is there a way to disable
>> schema validation in response alone.
>> 
>> Thanks,
>> Sunil.
>> 
>> 
>> Ashwin Karpe wrote:
>>> Hi Sunil,
>>>
>>> Schema validation happen on both the incoming and outgoing payloads to
>>> validate conformace against WSDL. If the response is empty since it was
>>> not set by your Impl code, the JAXBMarshaller will throw such an
>>> exception.
>>>
>>> Note that JAXB is the standard the converts your java object into XML
>>> that
>>> is place in the SOAP envelope before dispactching it to the client.
>>>
>>> Hope this helps.
>>>
>>> Cheers,
>>>
>>> Ashwin...
>>>
>>>
>>> mvsunil wrote:
>>>> Hi willem,
>>>>
>>>> Thanks for the reply.
>>>>
>>>> I get this error only in response. I am able to get the input values
>>>> from
>>>> the request to my bean and i am able to process it. The exception
>>>> occurs
>>>> in the response. The whole thing works fine when the schema validation
>>>> is
>>>> set to false.
>>>>
>>>> Thanks,
>>>> Sunil. 
>>>>
>>>>
>>>> willem.jiang wrote:
>>>>> Hi ,
>>>>>
>>>>> Does your request's uri element's value be empty string?
>>>>> If the WSDL has such of restriction, you will get the error when you
>>>>> enable the schema check.
>>>>>
>>>>> Willem
>>>>> mvsunil wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I am using CXF webservice as camel from uri and to uri is to a bean
>>>>>> which
>>>>>> does a jdbc operation and return the result of the jdbc operation.
>>>>>> generated
>>>>>> java code using wsdl2Java of cxf.  The whole thing works fine when
>>>>>> the
>>>>>> schema validation of cxf is set to false. When i enable the schema
>>>>>> validation the request comes to the bean but when it tried to send
>>>>>> the
>>>>>> response i get "Marshalling Error: The uri may not be theempty
>>>>>> string".
>>>>>> I am
>>>>>> using apache-cxf-2.1.2 and camel apache-camel-1.4.0
>>>>>>
>>>>>> The exception i get is 
>>>>>>
>>>>>> org.apache.cxf.interceptor.Fault: Marshalling Error: The uri may
not
>>>>>> be
>>>>>> theempty string.
>>>>>> 	at
>>>>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:176)
>>>>>> 	at
>>>>>> org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:131)
>>>>>> 	at
>>>>>> org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:113)
>>>>>> 	at
>>>>>> org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
>>>>>> 	at
>>>>>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
>>>>>> 	at
>>>>>> org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:74)
>>>>>> 	at
>>>>>> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
>>>>>> 	at
>>>>>> org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
>>>>>> 	at
>>>>>> org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
>>>>>> 	at
>>>>>> org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:283)
>>>>>> 	at
>>>>>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:166)
>>>>>> 	at
>>>>>> org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:174)
>>>>>> 	at
>>>>>> org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:152)
>>>>>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
>>>>>> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>>>>>> 	at
>>>>>> weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
>>>>>> 	at
>>>>>> weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
>>>>>> 	at
>>>>>> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
>>>>>> 	at
>>>>>> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
>>>>>> 	at
>>>>>> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3231)
>>>>>> 	at
>>>>>> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
>>>>>> 	at
>>>>>> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
>>>>>> 	at
>>>>>> weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2002)
>>>>>> 	at
>>>>>> weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1908)
>>>>>> 	at
>>>>>> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1362)
>>>>>> 	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
>>>>>> 	at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
>>>>>> Caused by: java.lang.IllegalArgumentException: The uri may not be
>>>>>> theempty
>>>>>> string.
>>>>>> 	at
>>>>>> weblogic.xml.stax.util.NamespaceContextImpl.getPrefix(NamespaceContextImpl.java:76)
>>>>>> 	at
>>>>>> org.apache.cxf.staxutils.CachingXmlEventWriter$NSContext.getPrefix(CachingXmlEventWriter.java:266)
>>>>>> 	at
>>>>>> com.sun.xml.bind.v2.runtime.StAXPostInitAction.run(StAXPostInitAction.java:95)
>>>>>> 	at
>>>>>> com.sun.xml.bind.v2.runtime.MarshallerImpl.prewrite(MarshallerImpl.java:365)
>>>>>> 	at
>>>>>> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:327)
>>>>>> 	at
>>>>>> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:175)
>>>>>> 	at
>>>>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:377)
>>>>>> 	at
>>>>>> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:155)
>>>>>> 	... 26 more
>>>>>
>>>>>
>>>>
>>>
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/CXF-endpoint-with-schema-validation-true-tp20578529s22882p20595928.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message