Aegis has interface support. You can specify a map from Class<?> to class
name that maps interface classes to proxy class names, and it will create
objects of the proxy types.

On Wed, Feb 27, 2008 at 10:15 PM, Daniel Kulp <[EMAIL PROTECTED]> wrote:

> 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)
>
> Actually, that code IS correct.   I've been experimenting with this quite
> a bit tonight and JAXB will barf if you try to create a context with any
> class that is an interface, even if the interface has the
> XmlJavaTypeAdapter annotation on it and such.   Thus, that code is
> correct.   However, this also means that you cannot use interfaces
> for "top level"  things, only for stuff within actual concrete beans.
>
> That said, I was pleasantly suprised when I wrote my test case that the
> test actually worked with whats on the trunk today PROVIDING you have a
> valid version of asm jar available AND you use wrapped doc/lit.   With
> the work I did two weeks ago, in the wrapped doc/lit case, it will use
> ASM to buildup concrete beans in memory and the interface params get put
> over just fine and they work.   (This is on the 2.1 line only.  Way to
> complex to port back to 2.0.x.)
>
> If you AREN'T using wrapped doc/lit or you don't have an asm jar
> available, then there are issues.  We have to drop down to JAXB
> proprietary API's and types to get them to work.   That's not going to
> be easy and due to the extra book keeping, is going to be a performance
> issue.    In general, I strongly suggest the wrapped doc/lit with asm.
>
> In anycase, I'm adding a sample of this to the java_first_jaxws sample to
> kind of show it working.   I'll start a new snapshot deploy before I
> head to bed tonight so the 2.1 snapshots in the morning should have it.
> I'd really appreciate it if folks could look at it and let me know how
> to improve the sample to show some more of these complex scenarios.   I
> do admit most of our samples are very basic.  This should be a step in
> the right direction for providing something a bit more complex.
>
> 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