On Friday 12 September 2008 1:23:02 pm Lee Breisacher wrote:
> Thanks Daniel. I had sortof concluded the same thing after studying the
> code for several hours. Another question:  For starters, rather than trying
> to modify DispatchInDatabindingInterceptor and others, I thought I would
> try to write my own "standalone" Interceptor that just does the schema
> validation (e.g. SchemaValidationInterceptor).  I'm pretty sure I can use
> the JAXP Validator framework to do the validation, but it requires
> instances of javax.xml.validation.Schema whereas CXF seems to use
> org.apache.ws.commons.schema.XmlSchema everywhere (e.g. SchemaUtil). Do you
> (or anyone) know of an easy way to get/convert javax.xml.validation.Schema
> from org.apache.ws.commons.schema.XmlSchema?

Yep.    
 Service service = ServiceModelUtil.getService(message.getExchange());
 Schema schema = 
EndpointReferenceUtils.getSchema(service.getServiceInfos().get(0));


Dan


>
> Thanks,
>
> Lee
>
> > -----Original Message-----
> > From: Daniel Kulp [mailto:[EMAIL PROTECTED]
> > Sent: Friday, September 12, 2008 9:51 AM
> > To: [email protected]
> > Cc: Lee Breisacher
> > Subject: Re: WebServiceProvider + schema validation
> >
> > On Thursday 11 September 2008 8:23:17 pm Lee Breisacher wrote:
> > > > then the publish fails because it ends up in
> >
> > buildServiceFromWSDL().
> >
> > > I misunderstood this error. Now I've fixed that, but still no
> > > validation is taking place.
> > >
> > > So, this is really quite a simple question:  How can I turn on
> > > server-side schema validation when the implementation is a
> >
> > WebServiceProvider?
> >
> > Hmmmm.....  I'm not sure there is a way right now.   Currently, the
> > schema-validation-enabled thing is passed into the databinding so the
> > databinding can setup the necessary stuff to do the
> > validation.   With the
> > provider stuff, there isn't a databinding so it's not doing anything.
> >
> > Definitely log a bug.   If you want to dig into it, most likely, the
> > DispatchInDatabindingInterceptor would need to be updated to
> > validate the XML
> > stuff after parsing it.   The setSchemaInMessage method in
> > the superclass can
> > be used as an example of how to get the Schema object.   From
> > there, for the
> > SOAPMessage case, use it directly after parsing.   For the
> > XMLMessage case,
> > probably set it into the XMLStreamDataReader and update the
> > XMLStreamDataReader to domparse + validate if schema-validate
> > is enabled.
> >
> > Dan
> >
> > > Thanks,
> > >
> > > Lee
> > >
> > > > -----Original Message-----
> > > > From: Lee Breisacher [mailto:[EMAIL PROTECTED]
> > > > Sent: Thursday, September 11, 2008 1:29 AM
> > > > To: [email protected]
> > > > Subject: WebServiceProvider + schema validation
> > > >
> > > > I have a wsdl with various operations. I'm implementing using a
> > > > single WebServiceProvider class. That's all working fine.
> > > > However, I want to enable schema validation, so incoming requests
> > > > are validated against the wsdl. If I try the obvious, like this:
> > > >
> > > >         EndpointImpl ep = (EndpointImpl)Endpoint.create(new
> > > > MyWebServiceProvider());
> > > >         ep.setWsdlLocation("test.wsdl");
> > > >         ep.publish(address);
> > > >         ep.getService().put("schema-validation-enabled", "true");
> > > >
> > > > then the publish fails because it ends up in
> >
> > buildServiceFromWSDL().
> >
> > > > If I try it this way:
> > > >
> > > >         EndpointImpl ep = (EndpointImpl)Endpoint.create(new
> > > > MyWebServiceProvider());
> > > >         ep.publish(address);
> > > >         ep.setWsdlLocation("test.wsdl");
> > > >         ep.getService().put("schema-validation-enabled", "true");
> > > >
> > > > then the schema validation doesn't happen. I assume this
> >
> > is because
> >
> > > > setWsdlLocation doesn't really do anything useful
> > > > *after* the endpoint is already published.
> > > >
> > > > So, I'm thinking there must be a way to associate the wsdl (or at
> > > > least its schema) with the endpoint, but not try to build the
> > > > endpoint from the wsdl. Any suggestions?
> > > >
> > > > Thanks,
> > > >
> > > > Lee
> >
> > --
> > Daniel Kulp
> > [EMAIL PROTECTED]
> > http://www.dankulp.com/blog



-- 
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to