You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Mark Clarke <ma...@jumpingbean.co.za> on 2007/11/05 21:32:22 UTC

pojo object return type not included in wsdl as complextype

Hi there,

I can;t get cfx to place the definition of a pojo into the wsdl as a 
complextyope. On the interface I have tried the following:

==============================================

import .....

@WebService
public interface ISimpleBankAccount{

@ResponseWrapper(className="Balance") public Balance doDebit(Double amount);

@ResponseWrapper(className="Balance")
public Balance doCredit(Double amount);

}






public class Balance(){
java.util.Date date;
Double balance;
Double previousBlanace;

.... getter and setters


}

================================

What am I doing wrong?
===========================================
Cyber Connect - More than just broadband
http://www.CyberConnect.co.za - Vodacom 3G R99/month

Cyber Designs - Put your business on the net
http://www.CyberDesigns.co.za

Jumping Bean - Your Java and Linux Experts
http://www.JumpingBean.co.za

Tel: 011-781 80 14
Fax: 011-781 80 15
===========================================
Disclaimer

Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Employees of Cyber Designs are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy and outside the scope of the employment of the individual concerned. The company will not accept any liability in respect of such communication, and the employee responsible will be personally liable for any damages or other liability arising.

RE: pojo object return type not included in wsdl as complextype

Posted by "Vespa, Anthony J" <aj...@cbs.com>.
Try using the xmltype annotation in your object, ala:

@XmlType(name = "Balance", namespace = "http://object.package.com/")

So for example I have my objects in com.package.object - you need to
define it in that namespace


-----Original Message-----
From: Mark Clarke [mailto:mark@jumpingbean.co.za] 
Sent: Monday, November 05, 2007 3:32 PM
To: cxf-user@incubator.apache.org
Subject: pojo object return type not included in wsdl as complextype

Hi there,

I can;t get cfx to place the definition of a pojo into the wsdl as a 
complextyope. On the interface I have tried the following:

==============================================

import .....

@WebService
public interface ISimpleBankAccount{

@ResponseWrapper(className="Balance") public Balance doDebit(Double
amount);

@ResponseWrapper(className="Balance")
public Balance doCredit(Double amount);

}






public class Balance(){
java.util.Date date;
Double balance;
Double previousBlanace;

.... getter and setters


}

================================

What am I doing wrong?
===========================================
Cyber Connect - More than just broadband
http://www.CyberConnect.co.za - Vodacom 3G R99/month

Cyber Designs - Put your business on the net
http://www.CyberDesigns.co.za

Jumping Bean - Your Java and Linux Experts
http://www.JumpingBean.co.za

Tel: 011-781 80 14
Fax: 011-781 80 15
===========================================
Disclaimer

Any views or opinions presented in this email are solely those of the
author and do not necessarily represent those of the company. Employees
of Cyber Designs are expressly required not to make defamatory
statements and not to infringe or authorize any infringement of
copyright or any other legal right by email communications. Any such
communication is contrary to company policy and outside the scope of the
employment of the individual concerned. The company will not accept any
liability in respect of such communication, and the employee responsible
will be personally liable for any damages or other liability arising.

Re: pojo object return type not included in wsdl as complextype

Posted by Daniel Kulp <dk...@apache.org>.
Ah..   That would explain it.   JAX-WS/JAXB only handles concrete Java 
beans, not interfaces.   You cannot use interfaces for marshalled 
objects.

Dan


On Monday 05 November 2007, Mark Clarke wrote:
> Hi Dan,
>
> Thanks for the info. I only started using the response wrapper as I
> couldn't get the return object to be anything other than a java.lang
> type. I am doing code first development of the application. I am
> trying to do a simple method
> call returning a custom object.
>
> I have set up the following:
>
> 1) Interface to he service I want to expose as a web service.  I have
> annotated this with @WebService and the parameters with @WebParam.
>
> @WebService
> public interface ITestService {
>      public ITestResult
> processTestTransaction(@WebParam(name="id")String id);
>
> 2) I have annnotated the service implementation class with @WebService
> @WebService(endpointInterface =
> "za.co.test.web.service.ITestWebService") public class TestImpl
> implements ITestService {
>
> 3) I have setup, in applicationContext.xml,
>
>     <import resource="classpath:META-INF/cxf/cxf.xml" />
>     <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"
> /> <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
>
>     <jaxws:endpoint id="TestWebService"
> implementor="#testWebServiceBean" address="/testWebService" />
>
>     <bean id="testWebServiceBean"
> class="za.co.test.web.service.impl.TestWebServiceImpl">
>       <property name="testService" ref="testService"/>
>     </bean>
>
> 4) The returned object of the method has an interface and an
> implementation class. i.e
>
> public interface ITestResult{
>   ......}
>
>
> public class TestResult implements ITestResult{
>
> ......
>
> I still keep on getting the marshalling error?
>
>
> Thanks
>
> Mark
>
> Daniel Kulp wrote:
> > Mark,
> >
> > The class pointed at by the ResponseWrapper should NEVER be the same
> > as the return type.   The ResponseWrapper class should point to a
> > bean that holds onto the return type as a member. (as well as any
> > "out" types from any holders)   In you case, it would need to point
> > to something like:
> >
> > public class DoCreditResponse {
> >     private Balance _return;
> >
> >     public Balance get_return() {
> >         return _return;
> >     }
> >     public void set_return(Balance b) {
> >         _return = b;
> >     }
> > }
> >
> >
> > If you are using CXF 2.0.2 (if not, you really need to update) and
> > doing complete code first development, you probably should just
> > avoid using the @ResponseWrapper annotation entirely and let the
> > runtime handle it. 2.0.2 doesn't need the the generated wrapper
> > classes.
> >
> > In anycase, definitely check what version of CXF you're using.  
> > There have been a TON of fixes to the codefirst stuff since 2.0.
> >
> > Dan
> >
> > On Monday 05 November 2007, Mark Clarke wrote:
> >> Hi Daniel,
> >>
> >> The example was a quick and dirty to give some idea of what I am
> >> trying. From what I have read the className attribute should point
> >> to the fQN of the class, in my example I am assuming default
> >> packahe but the same would apply for any other package namespace.
> >> As the return type and the className refer to the same class I
> >> assume they would be the same?
> >>
> >> My basic problem is that any return type that is not a "standard"
> >> java.lang object just throws errors like "Marshalling Errror:
> >> <class> is not know to this context"
> >>
> >> Its quiet frustrating. I didnt have this problem with xfire :(
> >>
> >> Daniel Kulp wrote:
> >>> Mark,
> >>>
> >>> You might be hitting a class name conflict issue:
> >>> @ResponseWrapper(className="Balance")
> >>> public Balance doCredit(Double amount)
> >>>
> >>> You have a "Balance" object for the return type, but you are also
> >>> using a Balance object for the response wrapper.   Is that
> >>> intended?
> >>>
> >>> Also, the className attribute should point to a fully qualified
> >>> (with package) class name that we can do a "Class.forName(...)"
> >>> with.
> >>>
> >>> Dan
> >>>
> >>> On Monday 05 November 2007, Mark Clarke wrote:
> >>>> Hi there,
> >>>>
> >>>> I can;t get cfx to place the definition of a pojo into the wsdl
> >>>> as a complextyope. On the interface I have tried the following:
> >>>>
> >>>> ==============================================
> >>>>
> >>>> import .....
> >>>>
> >>>> @WebService
> >>>> public interface ISimpleBankAccount{
> >>>>
> >>>> @ResponseWrapper(className="Balance") public Balance
> >>>> doDebit(Double amount);
> >>>>
> >>>> @ResponseWrapper(className="Balance")
> >>>> public Balance doCredit(Double amount);
> >>>>
> >>>> }
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> public class Balance(){
> >>>> java.util.Date date;
> >>>> Double balance;
> >>>> Double previousBlanace;
> >>>>
> >>>> .... getter and setters
> >>>>
> >>>>
> >>>> }
> >>>>
> >>>> ================================
> >>>>
> >>>> What am I doing wrong?
> >>>> ===========================================
> >>>> Cyber Connect - More than just broadband
> >>>> http://www.CyberConnect.co.za - Vodacom 3G R99/month
> >>>>
> >>>> Cyber Designs - Put your business on the net
> >>>> http://www.CyberDesigns.co.za
> >>>>
> >>>> Jumping Bean - Your Java and Linux Experts
> >>>> http://www.JumpingBean.co.za
> >>>>
> >>>> Tel: 011-781 80 14
> >>>> Fax: 011-781 80 15
> >>>> ===========================================
> >>>> Disclaimer
> >>>>
> >>>> Any views or opinions presented in this email are solely those of
> >>>> the author and do not necessarily represent those of the company.
> >>>> Employees of Cyber Designs are expressly required not to make
> >>>> defamatory statements and not to infringe or authorize any
> >>>> infringement of copyright or any other legal right by email
> >>>> communications. Any such communication is contrary to company
> >>>> policy and outside the scope of the employment of the individual
> >>>> concerned. The company will not accept any liability in respect
> >>>> of such communication, and the employee responsible will be
> >>>> personally liable for any damages or other liability arising.
> >>
> >> ===========================================
> >> Cyber Connect - More than just broadband
> >> http://www.CyberConnect.co.za - Vodacom 3G R99/month
> >>
> >> Cyber Designs - Put your business on the net
> >> http://www.CyberDesigns.co.za
> >>
> >> Jumping Bean - Your Java and Linux Experts
> >> http://www.JumpingBean.co.za
> >>
> >> Tel: 011-781 80 14
> >> Fax: 011-781 80 15
> >> ===========================================
> >> Disclaimer
> >>
> >> Any views or opinions presented in this email are solely those of
> >> the author and do not necessarily represent those of the company.
> >> Employees of Cyber Designs are expressly required not to make
> >> defamatory statements and not to infringe or authorize any
> >> infringement of copyright or any other legal right by email
> >> communications. Any such communication is contrary to company
> >> policy and outside the scope of the employment of the individual
> >> concerned. The company will not accept any liability in respect of
> >> such communication, and the employee responsible will be personally
> >> liable for any damages or other liability arising.
>
> ===========================================
> Cyber Connect - More than just broadband
> http://www.CyberConnect.co.za - Vodacom 3G R99/month
>
> Cyber Designs - Put your business on the net
> http://www.CyberDesigns.co.za
>
> Jumping Bean - Your Java and Linux Experts
> http://www.JumpingBean.co.za
>
> Tel: 011-781 80 14
> Fax: 011-781 80 15
> ===========================================
> Disclaimer
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the company.
> Employees of Cyber Designs are expressly required not to make
> defamatory statements and not to infringe or authorize any
> infringement of copyright or any other legal right by email
> communications. Any such communication is contrary to company policy
> and outside the scope of the employment of the individual concerned.
> The company will not accept any liability in respect of such
> communication, and the employee responsible will be personally liable
> for any damages or other liability arising.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: Java first: Binding classes not exposed in service APIs

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 05 November 2007, Segal, Jeffrey wrote:
> I asked a smiliar question a few days ago referencing binding
> subclasses with Aegis
> (http://www.nabble.com/Migrating-XFire-Aegis-inheritance-to-CXF-tf4733
>90 3.html), but I wanted to follow up on the subject and ask a more
> general question.  Is binding arbitrary classes (i.e. those that are
> not necessarily exposed in a service interface) supported in CXF?  If
> so, how is this done using JAXB?  What would the Spring configuration
> look like?

JAXB has several ways of dealing with subclasses that aren't referenced 
directly from the SEI:

1) If the JAXB classes were generated from it's "xsd -> java" tools (or 
our wsdl2java), there are ObjectFactory object created that would 
reference it.   When the JAXBContext is created, we add the 
ObjectFactory classes for all the packages we know about to the context 
so they could be picked up that way.   

2) The JAXBDataBinding object has a spring configurable 
"extraClasses" property that can be an array of extra classes to add into 
the context so it knows about it.

3) jaxb.index files - for all classes that we know about, we check the 
package for a jaxb.index file which is just a text file with a list of 
other classes in that package to load.   

4) With JAXB 2.1/JAX-WS 2.1, there is support for an XmlSeeAlso 
annotation which you can put on the SEI or other beans to have JAXB add 
those classes.


-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: Java first: Binding classes not exposed in service APIs

Posted by Daniel Kulp <dk...@apache.org>.
Jeff,

Any chance you could log a JIRA and attach a test case for the enum 
problem?   It SOUNDS like Aegis isn't generating the schema for the 
enums correctly.   Or possibly some import namespaces is off or similar.

Dan



On Tuesday 06 November 2007, Segal, Jeffrey wrote:
> Update:
>
> I have verified that this is in fact supported by CXF, just not well
> documented yet.  Here is my Spring configuration, which changes the
> default nillable and minOccurs settings to avoid stubs which wrap
> every Object with JAXBElement:
>
>
>     <bean id="typeMappingRegistryConfiguration"
> class="org.apache.cxf.aegis.type.Configuration">
>         <property name="defaultMinOccurs">
>             <value>1</value>
>         </property>
>         <property name="defaultNillable" value="false"/>
>     </bean>
>
>     <bean id="typeMappingRegistry"
> class="org.apache.cxf.aegis.type.DefaultTypeMappingRegistry">
>         <property name="configuration"
> ref="typeMappingRegistryConfiguration"/>
>     </bean>
>
>     <bean id="aegisBean"
> class="org.apache.cxf.aegis.databinding.AegisDatabinding">
>         <property name="typeMappingRegistry"
> ref="typeMappingRegistry"/> </bean>
>
>     <bean id="jaxws-and-aegis-service-factory"
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
>         <property name="properties">
>             <map>
>                 <entry key="writeXsiType">
>                     <value type="java.lang.Boolean">true</value>
>                 </entry>
>                 <entry key="overrideTypesList">
>                     <list>
>                         <value>com.foo.bar.A</value>
>                         <value>com.foo.bar.B</value>
>                         <value>com.foo.bar.C</value>
>                     </list>
>                 </entry>
>             </map>
>         </property>
>
>         <property name="dataBinding" ref="aegisBean"/>
>         <property name="serviceConfigurations">
>             <list>
>                 <bean
> class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
>                 <bean
> class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
>                 <bean
> class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
>             </list>
>         </property>
>     </bean>
>
>     <jaxws:endpoint
>             id="fooService"
>             implementor="#myFooServiceBean"
>             implementorClass="com.service.foo.impl"
>             address="/foo">
>         <jaxws:serviceFactory>
>             <ref bean="jaxws-and-aegis-service-factory"/>
>         </jaxws:serviceFactory>
>     </jaxws:endpoint>
>
>
> This all works as advertised, which is great.  However, there are two
> features that appear to be lacking.
>
> First, let's say class A (referenced in the overrideTypesList above)
> has an enum property.  CXF will correctly convert it to an XML
> enumeration. However, when creating stubs, the following error occurs:
>
> WSDLToJava Error : Thrown by JAXB : undefined simple or complex type
> 'ns3:SomeEnumType'
>
> Am I right to assume that CXF does not fully support Java 5 enums?
>
> Second, let's say class A has properties of types D, E and F.  If
> class A was referenced in a service API (e.g., com.foo.bar.A getA(int
> id)), CXF is smart enough to bind D, E and F to XML in the resultant
> WSDL. However, if class A is only added to the WSDL via the
> overrideTypesList, classes D, E and F must also be manually added.  If
> D, E and F in turn each have 3 more POJOs of their own, one can see
> how calling out each dependency out gets very unwieldy.
>
> I think these two features would be a great addition to CXF's
> capabilities.  Thoughts?
>
> Cheers,
> Jeff
>
>
>
> -----Original Message-----
> From: Segal, Jeffrey [mailto:Jeffrey.Segal@solers.com]
> Sent: Monday, November 05, 2007 6:30 PM
> To: cxf-user@incubator.apache.org
> Subject: Java first: Binding classes not exposed in service APIs
>
> I asked a smiliar question a few days ago referencing binding
> subclasses with Aegis
> (http://www.nabble.com/Migrating-XFire-Aegis-inheritance-to-CXF-tf4733
>90 3.html), but I wanted to follow up on the subject and ask a more
> general question.  Is binding arbitrary classes (i.e. those that are
> not necessarily exposed in a service interface) supported in CXF?  If
> so, how is this done using JAXB?  What would the Spring configuration
> look like?
>
> Thanks!
> Jeff



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

RE: Java first: Binding classes not exposed in service APIs

Posted by "Segal, Jeffrey" <Je...@solers.com>.
Update:

I have verified that this is in fact supported by CXF, just not well
documented yet.  Here is my Spring configuration, which changes the
default nillable and minOccurs settings to avoid stubs which wrap every
Object with JAXBElement:


    <bean id="typeMappingRegistryConfiguration"
class="org.apache.cxf.aegis.type.Configuration">
        <property name="defaultMinOccurs">
            <value>1</value>
        </property>
        <property name="defaultNillable" value="false"/>
    </bean>

    <bean id="typeMappingRegistry"
class="org.apache.cxf.aegis.type.DefaultTypeMappingRegistry">
        <property name="configuration"
ref="typeMappingRegistryConfiguration"/>
    </bean>

    <bean id="aegisBean"
class="org.apache.cxf.aegis.databinding.AegisDatabinding">
        <property name="typeMappingRegistry" ref="typeMappingRegistry"/>
    </bean>

    <bean id="jaxws-and-aegis-service-factory"
class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
        <property name="properties">
            <map>
                <entry key="writeXsiType">
                    <value type="java.lang.Boolean">true</value>
                </entry>
                <entry key="overrideTypesList">
                    <list>
                        <value>com.foo.bar.A</value>
                        <value>com.foo.bar.B</value>
                        <value>com.foo.bar.C</value>
                    </list>
                </entry>
            </map>
        </property>

        <property name="dataBinding" ref="aegisBean"/>
        <property name="serviceConfigurations">
            <list>
                <bean
class="org.apache.cxf.jaxws.support.JaxWsServiceConfiguration"/>
                <bean
class="org.apache.cxf.aegis.databinding.AegisServiceConfiguration"/>
                <bean
class="org.apache.cxf.service.factory.DefaultServiceConfiguration"/>
            </list>
        </property>
    </bean>

    <jaxws:endpoint
            id="fooService"
            implementor="#myFooServiceBean"
            implementorClass="com.service.foo.impl"
            address="/foo">
        <jaxws:serviceFactory>
            <ref bean="jaxws-and-aegis-service-factory"/>
        </jaxws:serviceFactory>
    </jaxws:endpoint>


This all works as advertised, which is great.  However, there are two
features that appear to be lacking.  

First, let's say class A (referenced in the overrideTypesList above) has
an enum property.  CXF will correctly convert it to an XML enumeration.
However, when creating stubs, the following error occurs:

WSDLToJava Error : Thrown by JAXB : undefined simple or complex type
'ns3:SomeEnumType'

Am I right to assume that CXF does not fully support Java 5 enums?

Second, let's say class A has properties of types D, E and F.  If class
A was referenced in a service API (e.g., com.foo.bar.A getA(int id)),
CXF is smart enough to bind D, E and F to XML in the resultant WSDL.
However, if class A is only added to the WSDL via the overrideTypesList,
classes D, E and F must also be manually added.  If D, E and F in turn
each have 3 more POJOs of their own, one can see how calling out each
dependency out gets very unwieldy.

I think these two features would be a great addition to CXF's
capabilities.  Thoughts?

Cheers,
Jeff



-----Original Message-----
From: Segal, Jeffrey [mailto:Jeffrey.Segal@solers.com] 
Sent: Monday, November 05, 2007 6:30 PM
To: cxf-user@incubator.apache.org
Subject: Java first: Binding classes not exposed in service APIs

I asked a smiliar question a few days ago referencing binding subclasses
with Aegis
(http://www.nabble.com/Migrating-XFire-Aegis-inheritance-to-CXF-tf473390
3.html), but I wanted to follow up on the subject and ask a more general
question.  Is binding arbitrary classes (i.e. those that are not
necessarily exposed in a service interface) supported in CXF?  If so,
how is this done using JAXB?  What would the Spring configuration look
like?

Thanks!
Jeff

Java first: Binding classes not exposed in service APIs

Posted by "Segal, Jeffrey" <Je...@solers.com>.
I asked a smiliar question a few days ago referencing binding subclasses
with Aegis
(http://www.nabble.com/Migrating-XFire-Aegis-inheritance-to-CXF-tf473390
3.html), but I wanted to follow up on the subject and ask a more general
question.  Is binding arbitrary classes (i.e. those that are not
necessarily exposed in a service interface) supported in CXF?  If so,
how is this done using JAXB?  What would the Spring configuration look
like?

Thanks!
Jeff

Re: pojo object return type not included in wsdl as complextype

Posted by Mark Clarke <ma...@jumpingbean.co.za>.
Hi Dan,

Thanks for the info. I only started using the response wrapper as I 
couldn't get the return object to be anything other than a java.lang 
type. I am doing code first development of the application. I am trying 
to do a simple method
call returning a custom object.

I have set up the following:

1) Interface to he service I want to expose as a web service.  I have 
annotated this with @WebService and the parameters with @WebParam.

@WebService
public interface ITestService {
     public ITestResult 
processTestTransaction(@WebParam(name="id")String id);

2) I have annnotated the service implementation class with @WebService
@WebService(endpointInterface = "za.co.test.web.service.ITestWebService")
public class TestImpl implements ITestService {

3) I have setup, in applicationContext.xml,

    <import resource="classpath:META-INF/cxf/cxf.xml" />
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
   
    <jaxws:endpoint id="TestWebService" 
implementor="#testWebServiceBean" address="/testWebService" />

    <bean id="testWebServiceBean" 
class="za.co.test.web.service.impl.TestWebServiceImpl">
      <property name="testService" ref="testService"/>
    </bean>

4) The returned object of the method has an interface and an 
implementation class. i.e

public interface ITestResult{
  ......}


public class TestResult implements ITestResult{

......

I still keep on getting the marshalling error?


Thanks

Mark

Daniel Kulp wrote:
> Mark,
>
> The class pointed at by the ResponseWrapper should NEVER be the same as 
> the return type.   The ResponseWrapper class should point to a bean that 
> holds onto the return type as a member. (as well as any "out" types from 
> any holders)   In you case, it would need to point to something like:
>
> public class DoCreditResponse {
>     private Balance _return;
>
>     public Balance get_return() {
>         return _return;
>     }
>     public void set_return(Balance b) {
>         _return = b;
>     }
> }
>
>
> If you are using CXF 2.0.2 (if not, you really need to update) and doing 
> complete code first development, you probably should just avoid using 
> the @ResponseWrapper annotation entirely and let the runtime handle it.   
> 2.0.2 doesn't need the the generated wrapper classes.
>
> In anycase, definitely check what version of CXF you're using.   There 
> have been a TON of fixes to the codefirst stuff since 2.0.   
>
> Dan
>
>
>
>
> On Monday 05 November 2007, Mark Clarke wrote:
>   
>> Hi Daniel,
>>
>> The example was a quick and dirty to give some idea of what I am
>> trying. From what I have read the className attribute should point to
>> the fQN of the class, in my example I am assuming default packahe but
>> the same would apply for any other package namespace. As the return
>> type and the className refer to the same class I assume they would be
>> the same?
>>
>> My basic problem is that any return type that is not a "standard"
>> java.lang object just throws errors like "Marshalling Errror: <class>
>> is not know to this context"
>>
>> Its quiet frustrating. I didnt have this problem with xfire :(
>>
>> Daniel Kulp wrote:
>>     
>>> Mark,
>>>
>>> You might be hitting a class name conflict issue:
>>> @ResponseWrapper(className="Balance")
>>> public Balance doCredit(Double amount)
>>>
>>> You have a "Balance" object for the return type, but you are also
>>> using a Balance object for the response wrapper.   Is that intended?
>>>
>>> Also, the className attribute should point to a fully qualified
>>> (with package) class name that we can do a "Class.forName(...)"
>>> with.
>>>
>>> Dan
>>>
>>> On Monday 05 November 2007, Mark Clarke wrote:
>>>       
>>>> Hi there,
>>>>
>>>> I can;t get cfx to place the definition of a pojo into the wsdl as
>>>> a complextyope. On the interface I have tried the following:
>>>>
>>>> ==============================================
>>>>
>>>> import .....
>>>>
>>>> @WebService
>>>> public interface ISimpleBankAccount{
>>>>
>>>> @ResponseWrapper(className="Balance") public Balance doDebit(Double
>>>> amount);
>>>>
>>>> @ResponseWrapper(className="Balance")
>>>> public Balance doCredit(Double amount);
>>>>
>>>> }
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> public class Balance(){
>>>> java.util.Date date;
>>>> Double balance;
>>>> Double previousBlanace;
>>>>
>>>> .... getter and setters
>>>>
>>>>
>>>> }
>>>>
>>>> ================================
>>>>
>>>> What am I doing wrong?
>>>> ===========================================
>>>> Cyber Connect - More than just broadband
>>>> http://www.CyberConnect.co.za - Vodacom 3G R99/month
>>>>
>>>> Cyber Designs - Put your business on the net
>>>> http://www.CyberDesigns.co.za
>>>>
>>>> Jumping Bean - Your Java and Linux Experts
>>>> http://www.JumpingBean.co.za
>>>>
>>>> Tel: 011-781 80 14
>>>> Fax: 011-781 80 15
>>>> ===========================================
>>>> Disclaimer
>>>>
>>>> Any views or opinions presented in this email are solely those of
>>>> the author and do not necessarily represent those of the company.
>>>> Employees of Cyber Designs are expressly required not to make
>>>> defamatory statements and not to infringe or authorize any
>>>> infringement of copyright or any other legal right by email
>>>> communications. Any such communication is contrary to company
>>>> policy and outside the scope of the employment of the individual
>>>> concerned. The company will not accept any liability in respect of
>>>> such communication, and the employee responsible will be personally
>>>> liable for any damages or other liability arising.
>>>>         
>> ===========================================
>> Cyber Connect - More than just broadband
>> http://www.CyberConnect.co.za - Vodacom 3G R99/month
>>
>> Cyber Designs - Put your business on the net
>> http://www.CyberDesigns.co.za
>>
>> Jumping Bean - Your Java and Linux Experts
>> http://www.JumpingBean.co.za
>>
>> Tel: 011-781 80 14
>> Fax: 011-781 80 15
>> ===========================================
>> Disclaimer
>>
>> Any views or opinions presented in this email are solely those of the
>> author and do not necessarily represent those of the company.
>> Employees of Cyber Designs are expressly required not to make
>> defamatory statements and not to infringe or authorize any
>> infringement of copyright or any other legal right by email
>> communications. Any such communication is contrary to company policy
>> and outside the scope of the employment of the individual concerned.
>> The company will not accept any liability in respect of such
>> communication, and the employee responsible will be personally liable
>> for any damages or other liability arising.
>>     
>
>
>
>   

===========================================
Cyber Connect - More than just broadband
http://www.CyberConnect.co.za - Vodacom 3G R99/month

Cyber Designs - Put your business on the net
http://www.CyberDesigns.co.za

Jumping Bean - Your Java and Linux Experts
http://www.JumpingBean.co.za

Tel: 011-781 80 14
Fax: 011-781 80 15
===========================================
Disclaimer

Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Employees of Cyber Designs are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy and outside the scope of the employment of the individual concerned. The company will not accept any liability in respect of such communication, and the employee responsible will be personally liable for any damages or other liability arising.

Re: pojo object return type not included in wsdl as complextype

Posted by Daniel Kulp <dk...@apache.org>.
Mark,

The class pointed at by the ResponseWrapper should NEVER be the same as 
the return type.   The ResponseWrapper class should point to a bean that 
holds onto the return type as a member. (as well as any "out" types from 
any holders)   In you case, it would need to point to something like:

public class DoCreditResponse {
    private Balance _return;

    public Balance get_return() {
        return _return;
    }
    public void set_return(Balance b) {
        _return = b;
    }
}


If you are using CXF 2.0.2 (if not, you really need to update) and doing 
complete code first development, you probably should just avoid using 
the @ResponseWrapper annotation entirely and let the runtime handle it.   
2.0.2 doesn't need the the generated wrapper classes.

In anycase, definitely check what version of CXF you're using.   There 
have been a TON of fixes to the codefirst stuff since 2.0.   

Dan




On Monday 05 November 2007, Mark Clarke wrote:
> Hi Daniel,
>
> The example was a quick and dirty to give some idea of what I am
> trying. From what I have read the className attribute should point to
> the fQN of the class, in my example I am assuming default packahe but
> the same would apply for any other package namespace. As the return
> type and the className refer to the same class I assume they would be
> the same?
>
> My basic problem is that any return type that is not a "standard"
> java.lang object just throws errors like "Marshalling Errror: <class>
> is not know to this context"
>
> Its quiet frustrating. I didnt have this problem with xfire :(
>
> Daniel Kulp wrote:
> > Mark,
> >
> > You might be hitting a class name conflict issue:
> > @ResponseWrapper(className="Balance")
> > public Balance doCredit(Double amount)
> >
> > You have a "Balance" object for the return type, but you are also
> > using a Balance object for the response wrapper.   Is that intended?
> >
> > Also, the className attribute should point to a fully qualified
> > (with package) class name that we can do a "Class.forName(...)"
> > with.
> >
> > Dan
> >
> > On Monday 05 November 2007, Mark Clarke wrote:
> >> Hi there,
> >>
> >> I can;t get cfx to place the definition of a pojo into the wsdl as
> >> a complextyope. On the interface I have tried the following:
> >>
> >> ==============================================
> >>
> >> import .....
> >>
> >> @WebService
> >> public interface ISimpleBankAccount{
> >>
> >> @ResponseWrapper(className="Balance") public Balance doDebit(Double
> >> amount);
> >>
> >> @ResponseWrapper(className="Balance")
> >> public Balance doCredit(Double amount);
> >>
> >> }
> >>
> >>
> >>
> >>
> >>
> >>
> >> public class Balance(){
> >> java.util.Date date;
> >> Double balance;
> >> Double previousBlanace;
> >>
> >> .... getter and setters
> >>
> >>
> >> }
> >>
> >> ================================
> >>
> >> What am I doing wrong?
> >> ===========================================
> >> Cyber Connect - More than just broadband
> >> http://www.CyberConnect.co.za - Vodacom 3G R99/month
> >>
> >> Cyber Designs - Put your business on the net
> >> http://www.CyberDesigns.co.za
> >>
> >> Jumping Bean - Your Java and Linux Experts
> >> http://www.JumpingBean.co.za
> >>
> >> Tel: 011-781 80 14
> >> Fax: 011-781 80 15
> >> ===========================================
> >> Disclaimer
> >>
> >> Any views or opinions presented in this email are solely those of
> >> the author and do not necessarily represent those of the company.
> >> Employees of Cyber Designs are expressly required not to make
> >> defamatory statements and not to infringe or authorize any
> >> infringement of copyright or any other legal right by email
> >> communications. Any such communication is contrary to company
> >> policy and outside the scope of the employment of the individual
> >> concerned. The company will not accept any liability in respect of
> >> such communication, and the employee responsible will be personally
> >> liable for any damages or other liability arising.
>
> ===========================================
> Cyber Connect - More than just broadband
> http://www.CyberConnect.co.za - Vodacom 3G R99/month
>
> Cyber Designs - Put your business on the net
> http://www.CyberDesigns.co.za
>
> Jumping Bean - Your Java and Linux Experts
> http://www.JumpingBean.co.za
>
> Tel: 011-781 80 14
> Fax: 011-781 80 15
> ===========================================
> Disclaimer
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the company.
> Employees of Cyber Designs are expressly required not to make
> defamatory statements and not to infringe or authorize any
> infringement of copyright or any other legal right by email
> communications. Any such communication is contrary to company policy
> and outside the scope of the employment of the individual concerned.
> The company will not accept any liability in respect of such
> communication, and the employee responsible will be personally liable
> for any damages or other liability arising.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: pojo object return type not included in wsdl as complextype

Posted by Mark Clarke <ma...@jumpingbean.co.za>.
Hi Daniel,

The example was a quick and dirty to give some idea of what I am trying. 
  From what I have read the className attribute should point to the fQN 
of the class, in my example I am assuming default packahe but the same 
would apply for any other package namespace. As the return type and the 
className refer to the same class I assume they would be the same?

My basic problem is that any return type that is not a "standard" 
java.lang object just throws errors like "Marshalling Errror: <class> is 
not know to this context"

Its quiet frustrating. I didnt have this problem with xfire :(

Daniel Kulp wrote:
> 
> Mark,
> 
> You might be hitting a class name conflict issue:
> @ResponseWrapper(className="Balance")
> public Balance doCredit(Double amount)
> 
> You have a "Balance" object for the return type, but you are also using a 
> Balance object for the response wrapper.   Is that intended?   
> 
> Also, the className attribute should point to a fully qualified (with 
> package) class name that we can do a "Class.forName(...)" with.
> 
> Dan
> 
> 
> 
> On Monday 05 November 2007, Mark Clarke wrote:
>> Hi there,
>>
>> I can;t get cfx to place the definition of a pojo into the wsdl as a
>> complextyope. On the interface I have tried the following:
>>
>> ==============================================
>>
>> import .....
>>
>> @WebService
>> public interface ISimpleBankAccount{
>>
>> @ResponseWrapper(className="Balance") public Balance doDebit(Double
>> amount);
>>
>> @ResponseWrapper(className="Balance")
>> public Balance doCredit(Double amount);
>>
>> }
>>
>>
>>
>>
>>
>>
>> public class Balance(){
>> java.util.Date date;
>> Double balance;
>> Double previousBlanace;
>>
>> .... getter and setters
>>
>>
>> }
>>
>> ================================
>>
>> What am I doing wrong?
>> ===========================================
>> Cyber Connect - More than just broadband
>> http://www.CyberConnect.co.za - Vodacom 3G R99/month
>>
>> Cyber Designs - Put your business on the net
>> http://www.CyberDesigns.co.za
>>
>> Jumping Bean - Your Java and Linux Experts
>> http://www.JumpingBean.co.za
>>
>> Tel: 011-781 80 14
>> Fax: 011-781 80 15
>> ===========================================
>> Disclaimer
>>
>> Any views or opinions presented in this email are solely those of the
>> author and do not necessarily represent those of the company.
>> Employees of Cyber Designs are expressly required not to make
>> defamatory statements and not to infringe or authorize any
>> infringement of copyright or any other legal right by email
>> communications. Any such communication is contrary to company policy
>> and outside the scope of the employment of the individual concerned.
>> The company will not accept any liability in respect of such
>> communication, and the employee responsible will be personally liable
>> for any damages or other liability arising.
> 
> 
> 

===========================================
Cyber Connect - More than just broadband
http://www.CyberConnect.co.za - Vodacom 3G R99/month

Cyber Designs - Put your business on the net
http://www.CyberDesigns.co.za

Jumping Bean - Your Java and Linux Experts
http://www.JumpingBean.co.za

Tel: 011-781 80 14
Fax: 011-781 80 15
===========================================
Disclaimer

Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Employees of Cyber Designs are expressly required not to make defamatory statements and not to infringe or authorize any infringement of copyright or any other legal right by email communications. Any such communication is contrary to company policy and outside the scope of the employment of the individual concerned. The company will not accept any liability in respect of such communication, and the employee responsible will be personally liable for any damages or other liability arising.

Re: pojo object return type not included in wsdl as complextype

Posted by Daniel Kulp <dk...@apache.org>.

Mark,

You might be hitting a class name conflict issue:
@ResponseWrapper(className="Balance")
public Balance doCredit(Double amount)

You have a "Balance" object for the return type, but you are also using a 
Balance object for the response wrapper.   Is that intended?   

Also, the className attribute should point to a fully qualified (with 
package) class name that we can do a "Class.forName(...)" with.

Dan



On Monday 05 November 2007, Mark Clarke wrote:
> Hi there,
>
> I can;t get cfx to place the definition of a pojo into the wsdl as a
> complextyope. On the interface I have tried the following:
>
> ==============================================
>
> import .....
>
> @WebService
> public interface ISimpleBankAccount{
>
> @ResponseWrapper(className="Balance") public Balance doDebit(Double
> amount);
>
> @ResponseWrapper(className="Balance")
> public Balance doCredit(Double amount);
>
> }
>
>
>
>
>
>
> public class Balance(){
> java.util.Date date;
> Double balance;
> Double previousBlanace;
>
> .... getter and setters
>
>
> }
>
> ================================
>
> What am I doing wrong?
> ===========================================
> Cyber Connect - More than just broadband
> http://www.CyberConnect.co.za - Vodacom 3G R99/month
>
> Cyber Designs - Put your business on the net
> http://www.CyberDesigns.co.za
>
> Jumping Bean - Your Java and Linux Experts
> http://www.JumpingBean.co.za
>
> Tel: 011-781 80 14
> Fax: 011-781 80 15
> ===========================================
> Disclaimer
>
> Any views or opinions presented in this email are solely those of the
> author and do not necessarily represent those of the company.
> Employees of Cyber Designs are expressly required not to make
> defamatory statements and not to infringe or authorize any
> infringement of copyright or any other legal right by email
> communications. Any such communication is contrary to company policy
> and outside the scope of the employment of the individual concerned.
> The company will not accept any liability in respect of such
> communication, and the employee responsible will be personally liable
> for any damages or other liability arising.



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog