You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jian wu <he...@gmail.com> on 2008/08/13 07:09:53 UTC

Validate SOAP Message with Aegis Binding?

Hi,

I'm migrating WS from XFire 1.2.6 to CXF 2.1.1 using JAX-WS Front-end with
Aegis data binding.

For XFire, we had a negative test case with the following invalid SOAP
Message returning "soap:Server" Fault, which is fine as long as it is
fault:

Request:====================================================
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:web="http://webservices.com">
<soapenv:Header/>
<soapenv:Body>
   <web:getCustomerByCustomerId>
       <web:in0>624972813</web:in0>
   <!-- WRONG, start a new elment instead of end element -->
   <web:getCustomerByCustomerId>
</soapenv:Body>
</soapenv:Envelope>

Response: ================================================
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
  <soap:Fault>
     <faultcode>soap:Server</faultcode>
     <faultstring>Index: 1, Size: 1</faultstring>
  </soap:Fault>
</soap:Body>
</soap:Envelope>

But this invalid request was passing through without problem with CXF.
Is there a way to turn on some simple validation with Aegis Binding?
Any build-in Interceptor we can leverage?

Or I have to switch to JAXB Binding with Schema Validation Enabled option,
which obviously has impact on performance?

Any tips or suggestions would be really appreciated!

Thanks a lot!

Jian

Re: Validate SOAP Message with Aegis Binding?

Posted by jian wu <he...@gmail.com>.
Hi Dan,

Thanks a lot!

Jian

On Wed, Aug 20, 2008 at 1:52 PM, Daniel Kulp <dk...@apache.org> wrote:
> On Tuesday 19 August 2008 7:28:50 pm jian wu wrote:
>> Hi Dan,
>>
>> Thanks a lot for your reply!
>>
>> > Basically, we keep parsing up until we get all the data we need, then
>> > pretty much ignore the rest.
>>
>> This actually is a good optimization for performance. Would you mind
>> confirming whether all the input parameters will be processed by the
>> WrapperClassInInterceptor at server side?
>
> Oh, definitely.   That runs much later.
>
>
>> I did develope a simple ValidXMLInInterceptor and plugged after
>> WrapperClassInInterceptor, which'll pull the XMLStreamReader if
>> exists and go through till the END_DOCUMENT to verify it's a
>> proper SOAP message.  Would this be a doable way or might
>> risk breaking other InInterceptors down the chain?
>
> That's perfect and should work great.
>
> Dan
>
>
>> This might be an acceptable light-weight xml validation for us
>> given that CXF Namespace Aware Stream Reader already
>> processed first part of SOAP Message including all the input
>> parameters.
>>
>> Any suggestions or tips are really appreciated.
>>
>> Jian
>>
>> On Thu, Aug 14, 2008 at 1:11 PM, Daniel Kulp <dk...@apache.org> wrote:
>> > I believe this is actually related to:
>> > https://issues.apache.org/jira/browse/CXF-1536
>> >
>> > Basically, we keep parsing up until we get all the data we need, then
>> > pretty much ignore the rest.
>> >
>> > Dan
>> >
>> > On Wednesday 13 August 2008 1:09:53 am jian wu wrote:
>> >> Hi,
>> >>
>> >> I'm migrating WS from XFire 1.2.6 to CXF 2.1.1 using JAX-WS Front-end
>> >> with Aegis data binding.
>> >>
>> >> For XFire, we had a negative test case with the following invalid SOAP
>> >> Message returning "soap:Server" Fault, which is fine as long as it is
>> >> fault:
>> >>
>> >> Request:====================================================
>> >> <soapenv:Envelope
>> >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>> >> xmlns:web="http://webservices.com">
>> >> <soapenv:Header/>
>> >> <soapenv:Body>
>> >>    <web:getCustomerByCustomerId>
>> >>        <web:in0>624972813</web:in0>
>> >>    <!-- WRONG, start a new elment instead of end element -->
>> >>    <web:getCustomerByCustomerId>
>> >> </soapenv:Body>
>> >> </soapenv:Envelope>
>> >>
>> >> Response: ================================================
>> >> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>> >>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>> >>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> >> <soap:Body>
>> >>   <soap:Fault>
>> >>      <faultcode>soap:Server</faultcode>
>> >>      <faultstring>Index: 1, Size: 1</faultstring>
>> >>   </soap:Fault>
>> >> </soap:Body>
>> >> </soap:Envelope>
>> >>
>> >> But this invalid request was passing through without problem with CXF.
>> >> Is there a way to turn on some simple validation with Aegis Binding?
>> >> Any build-in Interceptor we can leverage?
>> >>
>> >> Or I have to switch to JAXB Binding with Schema Validation Enabled
>> >> option, which obviously has impact on performance?
>> >>
>> >> Any tips or suggestions would be really appreciated!
>> >>
>> >> Thanks a lot!
>> >>
>> >> Jian
>> >
>> > --
>> > Daniel Kulp
>> > dkulp@apache.org
>> > http://www.dankulp.com/blog
>
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: Validate SOAP Message with Aegis Binding?

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 19 August 2008 7:28:50 pm jian wu wrote:
> Hi Dan,
>
> Thanks a lot for your reply!
>
> > Basically, we keep parsing up until we get all the data we need, then
> > pretty much ignore the rest.
>
> This actually is a good optimization for performance. Would you mind
> confirming whether all the input parameters will be processed by the
> WrapperClassInInterceptor at server side?

Oh, definitely.   That runs much later.


> I did develope a simple ValidXMLInInterceptor and plugged after
> WrapperClassInInterceptor, which'll pull the XMLStreamReader if
> exists and go through till the END_DOCUMENT to verify it's a
> proper SOAP message.  Would this be a doable way or might
> risk breaking other InInterceptors down the chain?

That's perfect and should work great.

Dan


> This might be an acceptable light-weight xml validation for us
> given that CXF Namespace Aware Stream Reader already
> processed first part of SOAP Message including all the input
> parameters.
>
> Any suggestions or tips are really appreciated.
>
> Jian
>
> On Thu, Aug 14, 2008 at 1:11 PM, Daniel Kulp <dk...@apache.org> wrote:
> > I believe this is actually related to:
> > https://issues.apache.org/jira/browse/CXF-1536
> >
> > Basically, we keep parsing up until we get all the data we need, then
> > pretty much ignore the rest.
> >
> > Dan
> >
> > On Wednesday 13 August 2008 1:09:53 am jian wu wrote:
> >> Hi,
> >>
> >> I'm migrating WS from XFire 1.2.6 to CXF 2.1.1 using JAX-WS Front-end
> >> with Aegis data binding.
> >>
> >> For XFire, we had a negative test case with the following invalid SOAP
> >> Message returning "soap:Server" Fault, which is fine as long as it is
> >> fault:
> >>
> >> Request:====================================================
> >> <soapenv:Envelope
> >> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> >> xmlns:web="http://webservices.com">
> >> <soapenv:Header/>
> >> <soapenv:Body>
> >>    <web:getCustomerByCustomerId>
> >>        <web:in0>624972813</web:in0>
> >>    <!-- WRONG, start a new elment instead of end element -->
> >>    <web:getCustomerByCustomerId>
> >> </soapenv:Body>
> >> </soapenv:Envelope>
> >>
> >> Response: ================================================
> >> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> >>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> >> <soap:Body>
> >>   <soap:Fault>
> >>      <faultcode>soap:Server</faultcode>
> >>      <faultstring>Index: 1, Size: 1</faultstring>
> >>   </soap:Fault>
> >> </soap:Body>
> >> </soap:Envelope>
> >>
> >> But this invalid request was passing through without problem with CXF.
> >> Is there a way to turn on some simple validation with Aegis Binding?
> >> Any build-in Interceptor we can leverage?
> >>
> >> Or I have to switch to JAXB Binding with Schema Validation Enabled
> >> option, which obviously has impact on performance?
> >>
> >> Any tips or suggestions would be really appreciated!
> >>
> >> Thanks a lot!
> >>
> >> Jian
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Validate SOAP Message with Aegis Binding?

Posted by jian wu <he...@gmail.com>.
Hi Dan,

Thanks a lot for your reply!

> Basically, we keep parsing up until we get all the data we need, then
> pretty much ignore the rest.

This actually is a good optimization for performance. Would you mind
confirming whether all the input parameters will be processed by the
WrapperClassInInterceptor at server side?

I did develope a simple ValidXMLInInterceptor and plugged after
WrapperClassInInterceptor, which'll pull the XMLStreamReader if
exists and go through till the END_DOCUMENT to verify it's a
proper SOAP message.  Would this be a doable way or might
risk breaking other InInterceptors down the chain?

This might be an acceptable light-weight xml validation for us
given that CXF Namespace Aware Stream Reader already
processed first part of SOAP Message including all the input
parameters.

Any suggestions or tips are really appreciated.

Jian

On Thu, Aug 14, 2008 at 1:11 PM, Daniel Kulp <dk...@apache.org> wrote:
>
> I believe this is actually related to:
> https://issues.apache.org/jira/browse/CXF-1536
>
> Basically, we keep parsing up until we get all the data we need, then pretty
> much ignore the rest.
>
> Dan
>
>
>
> On Wednesday 13 August 2008 1:09:53 am jian wu wrote:
>> Hi,
>>
>> I'm migrating WS from XFire 1.2.6 to CXF 2.1.1 using JAX-WS Front-end with
>> Aegis data binding.
>>
>> For XFire, we had a negative test case with the following invalid SOAP
>> Message returning "soap:Server" Fault, which is fine as long as it is
>> fault:
>>
>> Request:====================================================
>> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>>                xmlns:web="http://webservices.com">
>> <soapenv:Header/>
>> <soapenv:Body>
>>    <web:getCustomerByCustomerId>
>>        <web:in0>624972813</web:in0>
>>    <!-- WRONG, start a new elment instead of end element -->
>>    <web:getCustomerByCustomerId>
>> </soapenv:Body>
>> </soapenv:Envelope>
>>
>> Response: ================================================
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>> <soap:Body>
>>   <soap:Fault>
>>      <faultcode>soap:Server</faultcode>
>>      <faultstring>Index: 1, Size: 1</faultstring>
>>   </soap:Fault>
>> </soap:Body>
>> </soap:Envelope>
>>
>> But this invalid request was passing through without problem with CXF.
>> Is there a way to turn on some simple validation with Aegis Binding?
>> Any build-in Interceptor we can leverage?
>>
>> Or I have to switch to JAXB Binding with Schema Validation Enabled option,
>> which obviously has impact on performance?
>>
>> Any tips or suggestions would be really appreciated!
>>
>> Thanks a lot!
>>
>> Jian
>
>
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: Validate SOAP Message with Aegis Binding?

Posted by Daniel Kulp <dk...@apache.org>.
I believe this is actually related to:
https://issues.apache.org/jira/browse/CXF-1536

Basically, we keep parsing up until we get all the data we need, then pretty 
much ignore the rest.  

Dan



On Wednesday 13 August 2008 1:09:53 am jian wu wrote:
> Hi,
>
> I'm migrating WS from XFire 1.2.6 to CXF 2.1.1 using JAX-WS Front-end with
> Aegis data binding.
>
> For XFire, we had a negative test case with the following invalid SOAP
> Message returning "soap:Server" Fault, which is fine as long as it is
> fault:
>
> Request:====================================================
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>                xmlns:web="http://webservices.com">
> <soapenv:Header/>
> <soapenv:Body>
>    <web:getCustomerByCustomerId>
>        <web:in0>624972813</web:in0>
>    <!-- WRONG, start a new elment instead of end element -->
>    <web:getCustomerByCustomerId>
> </soapenv:Body>
> </soapenv:Envelope>
>
> Response: ================================================
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
>   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soap:Body>
>   <soap:Fault>
>      <faultcode>soap:Server</faultcode>
>      <faultstring>Index: 1, Size: 1</faultstring>
>   </soap:Fault>
> </soap:Body>
> </soap:Envelope>
>
> But this invalid request was passing through without problem with CXF.
> Is there a way to turn on some simple validation with Aegis Binding?
> Any build-in Interceptor we can leverage?
>
> Or I have to switch to JAXB Binding with Schema Validation Enabled option,
> which obviously has impact on performance?
>
> Any tips or suggestions would be really appreciated!
>
> Thanks a lot!
>
> Jian



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog