On Wednesday 27 February 2008, Ayush Gupta wrote:
> Yes, I've used JAXB with interfaces and its painful but does work.
>
> However, it appears from the code in JAXBUtils that CXF explicitly
> excludes interfaces even if they are annotated to be properly
> marshaled by JAXB (as per
> https://jaxb.dev.java.net/guide/Mapping_interfaces.html)

Fixable....   I'll try to get that fixed tomorrow.   :-)

Dan



>
> -----Original Message-----
> From: jim ma [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 26, 2008 9:18 PM
> To: cxf-user@incubator.apache.org
> Subject: Re: Does CXF Support Interfaces as Web Params?
>
> Kohsuke Kawaguchi's blog talked about this , you can get some
> information from
> this link:
> http://weblogs.java.net/blog/kohsuke/archive/2006/06/jaxb_and_interf.h
>tml
>
> On Wed, Feb 27, 2008 at 9:25 AM, Glen Mazza <[EMAIL PROTECTED]> 
wrote:
> > I think the answer is "no", neither CXF nor GlassFish Metro support
> > interfaces as parameters.  It's either a JAX-WS or JAXB rule, I'm
> > not certain.
> >
> > Glen
> >
> > Am Dienstag, den 26.02.2008, 15:07 -0800 schrieb Ayush Gupta:
> > > In my web service, there is a method which takes an interface as
> > > its parameter, instead of a concrete class. Reference code is at
> > > the bottom
> >
> > of
> >
> > > this email.
> > >
> > >
> > >
> > > When I run the client, I get an exception "Caused by:
> > > javax.xml.bind.JAXBException:
>
> com.passenger.test.ComplexObjectInterfaceis
>
> > > not known to this context". Further investigation and digging
> > > through
> >
> > the
> >
> > > CXF code bought me to JAXBUtils. getValidClass(Class<?> cls) which
> > > is
> >
> > called
> >
> > > while building the JAXBContext. The code in JAXBUtils.
> > > getValidClass explicitly excludes inclusion of any interfaces! I
> > > also tried setting
> >
> > the
> >
> > > XmlJavaTypeAdapter on the interface but that didn't work.
> > >
> > >
> > >
> > > So, does CXF Support Interfaces as Web Params? I'd appreciate
> > > anyone throwing some light on this!
> > >
> > >
> > >
> > > Thanks
> > >
> > > -ayush
> > >
> > >
> > >
> > >
> > >
> > > Web Service Interface:
> > >
> > > public interface TestServiceInterface {
> > >
> > >     public void testMethod(MyInterface param);
> > >
> > > }
> > >
> > >
> > >
> > > Parameter Interface:
> > >
> > > public interface MyInterface{
> > >
> > >     String getText();
> > >
> > >     void setText(String t);
> > >
> > > }
> > >
> > >
> > >
> > >
> > >
> > > Parameter concrete class:
> > >
> > > public class MyClass implements MyInterface {
> > >
> > >     private String text;
> > >
> > >
> > >
> > >     public String getText() {
> > >
> > >         return text;
> > >
> > >     }
> > >
> > >
> > >
> > >     public void setText(String t) {
> > >
> > >         this.text = t;
> > >
> > >     }
> > >
> > > }
> > >
> > >
> > >
> > > Client:
> > >
> > >     Service service = Service.create(SERVICE_NAME);
> > >
> > >     service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
> > > ENDPOINT_ADDRESS);
> > >
> > >     TestServiceInterface  serviceInterface  =
> > > service.getPort(TestServiceInterface.class);
> > >
> > >     serviceInterface. testMethod(new MyClass());



-- 
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to