You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Waleed Zedan <wz...@gmail.com> on 2012/01/16 10:40:43 UTC

XSD validation on server side

Hi,

I have added the end point with schema validation:
<jaxws:endpoint id="slmCallbackInterface"
implementor="#slmCallbackWebService"
 implementorClass="com.ws.impl.SLMCallbackImpl"
address="/SLMCallbackInterface">
 <jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
 </jaxws:properties>
</jaxws:endpoint>

The endpoint is referencing a bean implementation as mentioned above, but
the XSD input is not validated although the JAXB objects contain all
required = true and nillable = false

Any advice why CXF is not validating the input against the XSD definition
in the JAXB objects?

Thank you.

Best regards,

-- 
wz

Re: XSD validation on server side

Posted by Daniel Kulp <dk...@apache.org>.
On Monday, January 16, 2012 12:40:43 PM Waleed Zedan wrote:
> Hi,
> 
> I have added the end point with schema validation:
> <jaxws:endpoint id="slmCallbackInterface"
> implementor="#slmCallbackWebService"
>  implementorClass="com.ws.impl.SLMCallbackImpl"
> address="/SLMCallbackInterface">
>  <jaxws:properties>
> <entry key="schema-validation-enabled" value="true" />
>  </jaxws:properties>
> </jaxws:endpoint>
> 
> The endpoint is referencing a bean implementation as mentioned above, but
> the XSD input is not validated although the JAXB objects contain all
> required = true and nillable = false
> 
> Any advice why CXF is not validating the input against the XSD definition
> in the JAXB objects?

Did you actually turn on schema validation?   By default, it's not turned on as it introduces a lot more processing complexity.

http://cxf.apache.org/faq.html#FAQ-HowcanIturnonschemavalidationforjaxwsendpoint%3F

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: XSD validation on server side

Posted by Waleed Zedan <wz...@gmail.com>.
Hi,

Actually only the required and nillable attributes are required, but it
doesn't validate the input parameters , although it validates the return
types of the web method.

We have managed to validate the input parameters using JAXB only

Thank you.

On Mon, Jan 16, 2012 at 2:15 PM, Freeman Fang <fr...@gmail.com>wrote:

> Hi,
>
> Not all restrictions from xsd can map to the class, even with annotations,
> like the string length, string content, etc, could you elaborate what kind
> of validation you want to perform?
>
> Freeman
>
> On 2012-1-16, at 下午6:25, Waleed Zedan wrote:
>
>  Hi,
>>
>> Yes it is created from class , but the method parameters are annotated
>> properly, should I validate the JAXB objects manually in this case or is
>> there an option in CXF to perform this validation automatically?
>>
>> Thank you.
>>
>> On Mon, Jan 16, 2012 at 1:07 PM, Freeman Fang <freeman.fang@gmail.com
>> >wrote:
>>
>>  Hi,
>>>
>>> One possible reason is that your server side servicemodel is built from
>>> class, but not from the wsdl file, so no chance to load the schema xsds
>>> to
>>> do the schema validation.
>>> Could you add wsdlLocation attribute for your jaxws:endpoint also to see
>>> if it helps?
>>>
>>> Freeman
>>>
>>> On 2012-1-16, at 下午5:40, Waleed Zedan wrote:
>>>
>>> Hi,
>>>
>>>>
>>>> I have added the end point with schema validation:
>>>> <jaxws:endpoint id="slmCallbackInterface"
>>>> implementor="#****slmCallbackWebService"
>>>> implementorClass="com.ws.impl.****SLMCallbackImpl"
>>>> address="/****SLMCallbackInterface">
>>>> <jaxws:properties>
>>>> <entry key="schema-validation-****enabled" value="true" />
>>>>
>>>> </jaxws:properties>
>>>> </jaxws:endpoint>
>>>>
>>>> The endpoint is referencing a bean implementation as mentioned above,
>>>> but
>>>> the XSD input is not validated although the JAXB objects contain all
>>>> required = true and nillable = false
>>>>
>>>> Any advice why CXF is not validating the input against the XSD
>>>> definition
>>>> in the JAXB objects?
>>>>
>>>> Thank you.
>>>>
>>>> Best regards,
>>>>
>>>> --
>>>> wz
>>>>
>>>>
>>> ------------------------------****---------------
>>>
>>> Freeman Fang
>>>
>>> FuseSource
>>> Email:ffang@fusesource.com
>>> Web: fusesource.com
>>> Twitter: freemanfang
>>> Blog: http://freemanfang.blogspot.****com <http://freemanfang.blogspot.*
>>> *com <http://freemanfang.blogspot.com>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> --
>> wz
>>
>
> ------------------------------**---------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.**com <http://freemanfang.blogspot.com>
>
>
>
>
>
>
>
>
>
>


-- 
wz

Re: XSD validation on server side

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

Not all restrictions from xsd can map to the class, even with  
annotations, like the string length, string content, etc, could you  
elaborate what kind of validation you want to perform?

Freeman
On 2012-1-16, at 下午6:25, Waleed Zedan wrote:

> Hi,
>
> Yes it is created from class , but the method parameters are annotated
> properly, should I validate the JAXB objects manually in this case  
> or is
> there an option in CXF to perform this validation automatically?
>
> Thank you.
>
> On Mon, Jan 16, 2012 at 1:07 PM, Freeman Fang  
> <fr...@gmail.com>wrote:
>
>> Hi,
>>
>> One possible reason is that your server side servicemodel is built  
>> from
>> class, but not from the wsdl file, so no chance to load the schema  
>> xsds to
>> do the schema validation.
>> Could you add wsdlLocation attribute for your jaxws:endpoint also  
>> to see
>> if it helps?
>>
>> Freeman
>>
>> On 2012-1-16, at 下午5:40, Waleed Zedan wrote:
>>
>> Hi,
>>>
>>> I have added the end point with schema validation:
>>> <jaxws:endpoint id="slmCallbackInterface"
>>> implementor="#**slmCallbackWebService"
>>> implementorClass="com.ws.impl.**SLMCallbackImpl"
>>> address="/**SLMCallbackInterface">
>>> <jaxws:properties>
>>> <entry key="schema-validation-**enabled" value="true" />
>>> </jaxws:properties>
>>> </jaxws:endpoint>
>>>
>>> The endpoint is referencing a bean implementation as mentioned  
>>> above, but
>>> the XSD input is not validated although the JAXB objects contain all
>>> required = true and nillable = false
>>>
>>> Any advice why CXF is not validating the input against the XSD  
>>> definition
>>> in the JAXB objects?
>>>
>>> Thank you.
>>>
>>> Best regards,
>>>
>>> --
>>> wz
>>>
>>
>> ------------------------------**---------------
>> Freeman Fang
>>
>> FuseSource
>> Email:ffang@fusesource.com
>> Web: fusesource.com
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.**com <http://freemanfang.blogspot.com 
>> >
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
> -- 
> wz

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com










Re: XSD validation on server side

Posted by Waleed Zedan <wz...@gmail.com>.
Hi,

Yes it is created from class , but the method parameters are annotated
properly, should I validate the JAXB objects manually in this case or is
there an option in CXF to perform this validation automatically?

Thank you.

On Mon, Jan 16, 2012 at 1:07 PM, Freeman Fang <fr...@gmail.com>wrote:

> Hi,
>
> One possible reason is that your server side servicemodel is built from
> class, but not from the wsdl file, so no chance to load the schema xsds to
> do the schema validation.
> Could you add wsdlLocation attribute for your jaxws:endpoint also to see
> if it helps?
>
> Freeman
>
> On 2012-1-16, at 下午5:40, Waleed Zedan wrote:
>
>  Hi,
>>
>> I have added the end point with schema validation:
>> <jaxws:endpoint id="slmCallbackInterface"
>> implementor="#**slmCallbackWebService"
>> implementorClass="com.ws.impl.**SLMCallbackImpl"
>> address="/**SLMCallbackInterface">
>> <jaxws:properties>
>> <entry key="schema-validation-**enabled" value="true" />
>> </jaxws:properties>
>> </jaxws:endpoint>
>>
>> The endpoint is referencing a bean implementation as mentioned above, but
>> the XSD input is not validated although the JAXB objects contain all
>> required = true and nillable = false
>>
>> Any advice why CXF is not validating the input against the XSD definition
>> in the JAXB objects?
>>
>> Thank you.
>>
>> Best regards,
>>
>> --
>> wz
>>
>
> ------------------------------**---------------
> Freeman Fang
>
> FuseSource
> Email:ffang@fusesource.com
> Web: fusesource.com
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.**com <http://freemanfang.blogspot.com>
>
>
>
>
>
>
>
>
>
>


-- 
wz

Re: XSD validation on server side

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

One possible reason is that your server side servicemodel is built  
from class, but not from the wsdl file, so no chance to load the  
schema xsds to do the schema validation.
Could you add wsdlLocation attribute for your jaxws:endpoint also to  
see if it helps?

Freeman
On 2012-1-16, at 下午5:40, Waleed Zedan wrote:

> Hi,
>
> I have added the end point with schema validation:
> <jaxws:endpoint id="slmCallbackInterface"
> implementor="#slmCallbackWebService"
> implementorClass="com.ws.impl.SLMCallbackImpl"
> address="/SLMCallbackInterface">
> <jaxws:properties>
> <entry key="schema-validation-enabled" value="true" />
> </jaxws:properties>
> </jaxws:endpoint>
>
> The endpoint is referencing a bean implementation as mentioned  
> above, but
> the XSD input is not validated although the JAXB objects contain all
> required = true and nillable = false
>
> Any advice why CXF is not validating the input against the XSD  
> definition
> in the JAXB objects?
>
> Thank you.
>
> Best regards,
>
> -- 
> wz

---------------------------------------------
Freeman Fang

FuseSource
Email:ffang@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com