You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Martin Tilma <m....@func.nl> on 2008/07/02 14:28:24 UTC

MTOM schema validation

Hello,


I use CXF 2.1.1. And use a ValidationInterceptor (that extends 
AbstractSoapInterceptor) to validate the incomming soap message.


I use a xsd for the types including this one:

	<xs:complexType name="LargeBinaryData">
		<xs:complexContent>
			<xs:extension base="types:Data">
				<xs:sequence>
					<xs:element name="binaryMetaData" type="types:BinaryMetadata"/>
					<xs:element name="binaryData" type="xs:base64Binary" 
xmime:expectedContentTypes="application/octet-stream"/>
				</xs:sequence>
			</xs:extension>
		</xs:complexContent>
	</xs:complexType>

For the validation we use the same xsd.

Now the validation fails on the binaryData element. It complains about 
an child element that isn't allowed.

How can I solve this?


Regards,

Martin

-- 
Martin Tilma
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

Re: MTOM schema validation

Posted by Glen Mazza <gl...@verizon.net>.
JAXB bugs can be entered here:  https://jaxb.dev.java.net/issues/

Glen

2008-07-02 Daniel Kulp wrote:
> This is logged as:
> https://issues.apache.org/jira/browse/CXF-1194
> but I'm not sure what can be done about it.  The JAXB runtime handles  
> both the schema validation and mtom stuff at once.   Thus, it's  
> technically a bug/issue in the jaxb runtime.
> 
> Note: this doesn't just affect CXF.   It affects other jaxb/mtom users  
> such as springsource as well:
> http://forum.springframework.org/showthread.php?t=40389
> Their suggestion is to turn off validation when mtom is used which is  
> about all I can suggest at this point as well.
> 
> That said, it MIGHT be possible to register a  
> ValidatationEventListener with the (un)marshallers that will trap the  
> errors relating to mtom stuff, but I'm not sure how complex that would  
> be.   I've never looked into it.   Ideally, the jaxb ri would just  
> work for this case.
> 
> 
> Dan
> 
> 
> 
> On Jul 2, 2008, at 8:28 AM, Martin Tilma wrote:
> 
> > Hello,
> >
> >
> > I use CXF 2.1.1. And use a ValidationInterceptor (that extends  
> > AbstractSoapInterceptor) to validate the incomming soap message.
> >
> >
> > I use a xsd for the types including this one:
> >
> > 	<xs:complexType name="LargeBinaryData">
> > 		<xs:complexContent>
> > 			<xs:extension base="types:Data">
> > 				<xs:sequence>
> > 					<xs:element name="binaryMetaData" type="types:BinaryMetadata"/>
> > 					<xs:element name="binaryData" type="xs:base64Binary"  
> > xmime:expectedContentTypes="application/octet-stream"/>
> > 				</xs:sequence>
> > 			</xs:extension>
> > 		</xs:complexContent>
> > 	</xs:complexType>
> >
> > For the validation we use the same xsd.
> >
> > Now the validation fails on the binaryData element. It complains  
> > about an child element that isn't allowed.
> >
> > How can I solve this?
> >
> >
> > Regards,
> >
> > Martin
> >
> > -- 
> > Martin Tilma
> > Func. Internet Integration
> > W http://www.func.nl
> > T +31 20 4230000
> > F +31 20 4223500
> 
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 
> 
> 


Re: MTOM schema validation

Posted by Martin Tilma <m....@func.nl>.
Hello,

We use Jibx right now. We came form xfire and migrated or handles to 
Interceptors.

Our Interceptor uses: schema.newValidator().validate(......)

My quick fix: Before the validation I added a transformation that 
removes the "xop:Include" tag.

Is there an other way to turn on validation? (I'll try to read the 
documentation... )

Regards,

Martin

Adrian Corcoran wrote:
> yeah that was my point - that I was using Jibx!
> 
> However I am guessing that if it worked for Jibx then it worked for Jaxb,
> XMLBeans etc with XFire.
> 
> On Wed, Jul 2, 2008 at 3:33 PM, Dan Diephouse <da...@mulesource.com>
> wrote:
> 
>> JiBX != JAXB. I believe if you were using JiBX, it was probably XFire
>> itself
>> that handled the MTOM attachment processing, so its a completely different
>> pathway. I don't really remember enough about xfire schema validation to
>> comment further though. I suspect that you may not have had things set up
>> right in the xfire case, but thats just a hunch :-)
>>
>> Dan
>>
>> On Wed, Jul 2, 2008 at 3:51 PM, Adrian Corcoran <adrian.corcoran@gmail.com
>> wrote:
>>
>>> What I did in this case was put a interceptor in place to disable
>>> validation
>>> if there was attachments present but this does not fix the issue.
>>>
>>> I may be wrong on this but I think that this worked with XFire. However
>>> with
>>> XFire I used jibx bindings.
>>>
>>> On Wed, Jul 2, 2008 at 2:45 PM, Daniel Kulp <dk...@apache.org> wrote:
>>>
>>>> This is logged as:
>>>> https://issues.apache.org/jira/browse/CXF-1194
>>>> but I'm not sure what can be done about it.  The JAXB runtime handles
>>> both
>>>> the schema validation and mtom stuff at once.   Thus, it's technically
>> a
>>>> bug/issue in the jaxb runtime.
>>>>
>>>> Note: this doesn't just affect CXF.   It affects other jaxb/mtom users
>>> such
>>>> as springsource as well:
>>>> http://forum.springframework.org/showthread.php?t=40389
>>>> Their suggestion is to turn off validation when mtom is used which is
>>> about
>>>> all I can suggest at this point as well.
>>>>
>>>> That said, it MIGHT be possible to register a ValidatationEventListener
>>>> with the (un)marshallers that will trap the errors relating to mtom
>>> stuff,
>>>> but I'm not sure how complex that would be.   I've never looked into
>> it.
>>>> Ideally, the jaxb ri would just work for this case.
>>>>
>>>>
>>>> Dan
>>>>
>>>>
>>>>
>>>>
>>>> On Jul 2, 2008, at 8:28 AM, Martin Tilma wrote:
>>>>
>>>>  Hello,
>>>>>
>>>>> I use CXF 2.1.1. And use a ValidationInterceptor (that extends
>>>>> AbstractSoapInterceptor) to validate the incomming soap message.
>>>>>
>>>>>
>>>>> I use a xsd for the types including this one:
>>>>>
>>>>>        <xs:complexType name="LargeBinaryData">
>>>>>                <xs:complexContent>
>>>>>                        <xs:extension base="types:Data">
>>>>>                                <xs:sequence>
>>>>>                                        <xs:element
>> name="binaryMetaData"
>>>>> type="types:BinaryMetadata"/>
>>>>>                                        <xs:element name="binaryData"
>>>>> type="xs:base64Binary"
>>>>> xmime:expectedContentTypes="application/octet-stream"/>
>>>>>                                </xs:sequence>
>>>>>                        </xs:extension>
>>>>>                </xs:complexContent>
>>>>>        </xs:complexType>
>>>>>
>>>>> For the validation we use the same xsd.
>>>>>
>>>>> Now the validation fails on the binaryData element. It complains about
>>> an
>>>>> child element that isn't allowed.
>>>>>
>>>>> How can I solve this?
>>>>>
>>>>>
>>>>> Regards,
>>>>>
>>>>> Martin
>>>>>
>>>>> --
>>>>> Martin Tilma
>>>>> Func. Internet Integration
>>>>> W http://www.func.nl
>>>>> T +31 20 4230000
>>>>> F +31 20 4223500
>>>>>
>>>> ---
>>>> Daniel Kulp
>>>> dkulp@apache.org
>>>> http://www.dankulp.com/blog
>>>>
>>>>
>>>>
>>>>
>>>>
>>
>>
>> --
>> Dan Diephouse
>> http://mulesource.com | http://netzooid.com/blog
>>
> 


-- 
Martin Tilma
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

Re: MTOM schema validation

Posted by Adrian Corcoran <ad...@gmail.com>.
yeah that was my point - that I was using Jibx!

However I am guessing that if it worked for Jibx then it worked for Jaxb,
XMLBeans etc with XFire.

On Wed, Jul 2, 2008 at 3:33 PM, Dan Diephouse <da...@mulesource.com>
wrote:

> JiBX != JAXB. I believe if you were using JiBX, it was probably XFire
> itself
> that handled the MTOM attachment processing, so its a completely different
> pathway. I don't really remember enough about xfire schema validation to
> comment further though. I suspect that you may not have had things set up
> right in the xfire case, but thats just a hunch :-)
>
> Dan
>
> On Wed, Jul 2, 2008 at 3:51 PM, Adrian Corcoran <adrian.corcoran@gmail.com
> >
> wrote:
>
> > What I did in this case was put a interceptor in place to disable
> > validation
> > if there was attachments present but this does not fix the issue.
> >
> > I may be wrong on this but I think that this worked with XFire. However
> > with
> > XFire I used jibx bindings.
> >
> > On Wed, Jul 2, 2008 at 2:45 PM, Daniel Kulp <dk...@apache.org> wrote:
> >
> > >
> > > This is logged as:
> > > https://issues.apache.org/jira/browse/CXF-1194
> > > but I'm not sure what can be done about it.  The JAXB runtime handles
> > both
> > > the schema validation and mtom stuff at once.   Thus, it's technically
> a
> > > bug/issue in the jaxb runtime.
> > >
> > > Note: this doesn't just affect CXF.   It affects other jaxb/mtom users
> > such
> > > as springsource as well:
> > > http://forum.springframework.org/showthread.php?t=40389
> > > Their suggestion is to turn off validation when mtom is used which is
> > about
> > > all I can suggest at this point as well.
> > >
> > > That said, it MIGHT be possible to register a ValidatationEventListener
> > > with the (un)marshallers that will trap the errors relating to mtom
> > stuff,
> > > but I'm not sure how complex that would be.   I've never looked into
> it.
> > > Ideally, the jaxb ri would just work for this case.
> > >
> > >
> > > Dan
> > >
> > >
> > >
> > >
> > > On Jul 2, 2008, at 8:28 AM, Martin Tilma wrote:
> > >
> > >  Hello,
> > >>
> > >>
> > >> I use CXF 2.1.1. And use a ValidationInterceptor (that extends
> > >> AbstractSoapInterceptor) to validate the incomming soap message.
> > >>
> > >>
> > >> I use a xsd for the types including this one:
> > >>
> > >>        <xs:complexType name="LargeBinaryData">
> > >>                <xs:complexContent>
> > >>                        <xs:extension base="types:Data">
> > >>                                <xs:sequence>
> > >>                                        <xs:element
> name="binaryMetaData"
> > >> type="types:BinaryMetadata"/>
> > >>                                        <xs:element name="binaryData"
> > >> type="xs:base64Binary"
> > >> xmime:expectedContentTypes="application/octet-stream"/>
> > >>                                </xs:sequence>
> > >>                        </xs:extension>
> > >>                </xs:complexContent>
> > >>        </xs:complexType>
> > >>
> > >> For the validation we use the same xsd.
> > >>
> > >> Now the validation fails on the binaryData element. It complains about
> > an
> > >> child element that isn't allowed.
> > >>
> > >> How can I solve this?
> > >>
> > >>
> > >> Regards,
> > >>
> > >> Martin
> > >>
> > >> --
> > >> Martin Tilma
> > >> Func. Internet Integration
> > >> W http://www.func.nl
> > >> T +31 20 4230000
> > >> F +31 20 4223500
> > >>
> > >
> > > ---
> > > Daniel Kulp
> > > dkulp@apache.org
> > > http://www.dankulp.com/blog
> > >
> > >
> > >
> > >
> > >
> >
>
>
>
> --
> Dan Diephouse
> http://mulesource.com | http://netzooid.com/blog
>

Re: MTOM schema validation

Posted by Dan Diephouse <da...@mulesource.com>.
JiBX != JAXB. I believe if you were using JiBX, it was probably XFire itself
that handled the MTOM attachment processing, so its a completely different
pathway. I don't really remember enough about xfire schema validation to
comment further though. I suspect that you may not have had things set up
right in the xfire case, but thats just a hunch :-)

Dan

On Wed, Jul 2, 2008 at 3:51 PM, Adrian Corcoran <ad...@gmail.com>
wrote:

> What I did in this case was put a interceptor in place to disable
> validation
> if there was attachments present but this does not fix the issue.
>
> I may be wrong on this but I think that this worked with XFire. However
> with
> XFire I used jibx bindings.
>
> On Wed, Jul 2, 2008 at 2:45 PM, Daniel Kulp <dk...@apache.org> wrote:
>
> >
> > This is logged as:
> > https://issues.apache.org/jira/browse/CXF-1194
> > but I'm not sure what can be done about it.  The JAXB runtime handles
> both
> > the schema validation and mtom stuff at once.   Thus, it's technically a
> > bug/issue in the jaxb runtime.
> >
> > Note: this doesn't just affect CXF.   It affects other jaxb/mtom users
> such
> > as springsource as well:
> > http://forum.springframework.org/showthread.php?t=40389
> > Their suggestion is to turn off validation when mtom is used which is
> about
> > all I can suggest at this point as well.
> >
> > That said, it MIGHT be possible to register a ValidatationEventListener
> > with the (un)marshallers that will trap the errors relating to mtom
> stuff,
> > but I'm not sure how complex that would be.   I've never looked into it.
> > Ideally, the jaxb ri would just work for this case.
> >
> >
> > Dan
> >
> >
> >
> >
> > On Jul 2, 2008, at 8:28 AM, Martin Tilma wrote:
> >
> >  Hello,
> >>
> >>
> >> I use CXF 2.1.1. And use a ValidationInterceptor (that extends
> >> AbstractSoapInterceptor) to validate the incomming soap message.
> >>
> >>
> >> I use a xsd for the types including this one:
> >>
> >>        <xs:complexType name="LargeBinaryData">
> >>                <xs:complexContent>
> >>                        <xs:extension base="types:Data">
> >>                                <xs:sequence>
> >>                                        <xs:element name="binaryMetaData"
> >> type="types:BinaryMetadata"/>
> >>                                        <xs:element name="binaryData"
> >> type="xs:base64Binary"
> >> xmime:expectedContentTypes="application/octet-stream"/>
> >>                                </xs:sequence>
> >>                        </xs:extension>
> >>                </xs:complexContent>
> >>        </xs:complexType>
> >>
> >> For the validation we use the same xsd.
> >>
> >> Now the validation fails on the binaryData element. It complains about
> an
> >> child element that isn't allowed.
> >>
> >> How can I solve this?
> >>
> >>
> >> Regards,
> >>
> >> Martin
> >>
> >> --
> >> Martin Tilma
> >> Func. Internet Integration
> >> W http://www.func.nl
> >> T +31 20 4230000
> >> F +31 20 4223500
> >>
> >
> > ---
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog
> >
> >
> >
> >
> >
>



-- 
Dan Diephouse
http://mulesource.com | http://netzooid.com/blog

Re: MTOM schema validation

Posted by Adrian Corcoran <ad...@gmail.com>.
What I did in this case was put a interceptor in place to disable validation
if there was attachments present but this does not fix the issue.

I may be wrong on this but I think that this worked with XFire. However with
XFire I used jibx bindings.

On Wed, Jul 2, 2008 at 2:45 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> This is logged as:
> https://issues.apache.org/jira/browse/CXF-1194
> but I'm not sure what can be done about it.  The JAXB runtime handles both
> the schema validation and mtom stuff at once.   Thus, it's technically a
> bug/issue in the jaxb runtime.
>
> Note: this doesn't just affect CXF.   It affects other jaxb/mtom users such
> as springsource as well:
> http://forum.springframework.org/showthread.php?t=40389
> Their suggestion is to turn off validation when mtom is used which is about
> all I can suggest at this point as well.
>
> That said, it MIGHT be possible to register a ValidatationEventListener
> with the (un)marshallers that will trap the errors relating to mtom stuff,
> but I'm not sure how complex that would be.   I've never looked into it.
> Ideally, the jaxb ri would just work for this case.
>
>
> Dan
>
>
>
>
> On Jul 2, 2008, at 8:28 AM, Martin Tilma wrote:
>
>  Hello,
>>
>>
>> I use CXF 2.1.1. And use a ValidationInterceptor (that extends
>> AbstractSoapInterceptor) to validate the incomming soap message.
>>
>>
>> I use a xsd for the types including this one:
>>
>>        <xs:complexType name="LargeBinaryData">
>>                <xs:complexContent>
>>                        <xs:extension base="types:Data">
>>                                <xs:sequence>
>>                                        <xs:element name="binaryMetaData"
>> type="types:BinaryMetadata"/>
>>                                        <xs:element name="binaryData"
>> type="xs:base64Binary"
>> xmime:expectedContentTypes="application/octet-stream"/>
>>                                </xs:sequence>
>>                        </xs:extension>
>>                </xs:complexContent>
>>        </xs:complexType>
>>
>> For the validation we use the same xsd.
>>
>> Now the validation fails on the binaryData element. It complains about an
>> child element that isn't allowed.
>>
>> How can I solve this?
>>
>>
>> Regards,
>>
>> Martin
>>
>> --
>> Martin Tilma
>> Func. Internet Integration
>> W http://www.func.nl
>> T +31 20 4230000
>> F +31 20 4223500
>>
>
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>
>
>
>
>

Re: MTOM schema validation

Posted by Daniel Kulp <dk...@apache.org>.
This is logged as:
https://issues.apache.org/jira/browse/CXF-1194
but I'm not sure what can be done about it.  The JAXB runtime handles  
both the schema validation and mtom stuff at once.   Thus, it's  
technically a bug/issue in the jaxb runtime.

Note: this doesn't just affect CXF.   It affects other jaxb/mtom users  
such as springsource as well:
http://forum.springframework.org/showthread.php?t=40389
Their suggestion is to turn off validation when mtom is used which is  
about all I can suggest at this point as well.

That said, it MIGHT be possible to register a  
ValidatationEventListener with the (un)marshallers that will trap the  
errors relating to mtom stuff, but I'm not sure how complex that would  
be.   I've never looked into it.   Ideally, the jaxb ri would just  
work for this case.


Dan



On Jul 2, 2008, at 8:28 AM, Martin Tilma wrote:

> Hello,
>
>
> I use CXF 2.1.1. And use a ValidationInterceptor (that extends  
> AbstractSoapInterceptor) to validate the incomming soap message.
>
>
> I use a xsd for the types including this one:
>
> 	<xs:complexType name="LargeBinaryData">
> 		<xs:complexContent>
> 			<xs:extension base="types:Data">
> 				<xs:sequence>
> 					<xs:element name="binaryMetaData" type="types:BinaryMetadata"/>
> 					<xs:element name="binaryData" type="xs:base64Binary"  
> xmime:expectedContentTypes="application/octet-stream"/>
> 				</xs:sequence>
> 			</xs:extension>
> 		</xs:complexContent>
> 	</xs:complexType>
>
> For the validation we use the same xsd.
>
> Now the validation fails on the binaryData element. It complains  
> about an child element that isn't allowed.
>
> How can I solve this?
>
>
> Regards,
>
> Martin
>
> -- 
> Martin Tilma
> Func. Internet Integration
> W http://www.func.nl
> T +31 20 4230000
> F +31 20 4223500

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