You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Holger Stolzenberg <h....@ewerk.com> on 2007/08/21 17:13:23 UTC

Enforce complex type definition in WSDL

Hi folks,


Using CXF 2.0.1-INCUBATOR + JAXB Databinding:


I have a ProductService SEI with the following signature:

public ServiceStatus getProductById( int id );
public ServiceStatus getProductByToken( String token );


So for this WS the ServiceStatus object is defined in the WSDL. This ServiceStatus object is a wrapper that holds the services status outcome, e.g. code ... , and the product itself if loaded. For that it also has a geberic method

public Object getObject();

In an special use case this method should return an Object of the type lets say 'Product'. Because the Product class itself has never been declared or used in the SEI it won´t show up in the WSDL. But there I need the complex type definition for 'Product' in order to ensure class mapping for a PHP client.

As a workaround I put the following method to the SEI:

public void noop( Product product );

Now the Product class has been declared in the SEI abd therefore a complex type definition is created in the WSDL. Everything works fine now.

My question is how can I force the creation of a complex type in the WSDL that my service may return but has not been declared or used somewhere in the
SEI??

Mit lieben Grüßen aus dem eWerk

  |  Holger Stolzenberg
  |  Softwareentwickler
  |
  |  Geschäftsführer: 
  |  Frank Richter, Erik Wende, Hendrik Schubert
  |
  |  eWerk IT GmbH
  |  Markt 16
  |  Leipzig 04109
  |  http://www.ewerk.com
  |  HRB 9065, AG Leipzig
  |  Hauptniederlassung Leipzig
  |
  |  fon +49.341.4 26 49-0
  |  fax +49.341.4 26 49-88
  |  mailto:h.stolzenberg@ewerk.com
  |
  |  Support:
  |  fon 0700 CALLME24 (0700 22556324)
  |  fax 0700 CALLME24 (0700 22556324)
  |
  | Auskünfte und Angebote per Mail
  | sind freibleibend und unverbindlich. 

Re: Enforce complex type definition in WSDL

Posted by Freeman Fang <fr...@iona.com>.
Hi Holger,

I guess what you really need is an addtional class(Product) which is not 
defined in your SEI signature, if in this case,  the discussion and 
solution for CXF-340 may be helpful.
https://issues.apache.org/jira/browse/CXF-340

Best Regards

Freeman

Holger Stolzenberg wrote:
> Hi folks,
>
>
> Using CXF 2.0.1-INCUBATOR + JAXB Databinding:
>
>
> I have a ProductService SEI with the following signature:
>
> public ServiceStatus getProductById( int id );
> public ServiceStatus getProductByToken( String token );
>
>
> So for this WS the ServiceStatus object is defined in the WSDL. This ServiceStatus object is a wrapper that holds the services status outcome, e.g. code ... , and the product itself if loaded. For that it also has a geberic method
>
> public Object getObject();
>
> In an special use case this method should return an Object of the type lets say 'Product'. Because the Product class itself has never been declared or used in the SEI it won´t show up in the WSDL. But there I need the complex type definition for 'Product' in order to ensure class mapping for a PHP client.
>
> As a workaround I put the following method to the SEI:
>
> public void noop( Product product );
>
> Now the Product class has been declared in the SEI abd therefore a complex type definition is created in the WSDL. Everything works fine now.
>
> My question is how can I force the creation of a complex type in the WSDL that my service may return but has not been declared or used somewhere in the
> SEI??
>
> Mit lieben Grüßen aus dem eWerk
>
>   |  Holger Stolzenberg
>   |  Softwareentwickler
>   |
>   |  Geschäftsführer: 
>   |  Frank Richter, Erik Wende, Hendrik Schubert
>   |
>   |  eWerk IT GmbH
>   |  Markt 16
>   |  Leipzig 04109
>   |  http://www.ewerk.com
>   |  HRB 9065, AG Leipzig
>   |  Hauptniederlassung Leipzig
>   |
>   |  fon +49.341.4 26 49-0
>   |  fax +49.341.4 26 49-88
>   |  mailto:h.stolzenberg@ewerk.com
>   |
>   |  Support:
>   |  fon 0700 CALLME24 (0700 22556324)
>   |  fax 0700 CALLME24 (0700 22556324)
>   |
>   | Auskünfte und Angebote per Mail
>   | sind freibleibend und unverbindlich. 
>
>   

Re: AW: Enforce complex type definition in WSDL

Posted by Bozhong Lin <bl...@iona.com>.
Hi Julio,

Would you please help log a JRIA issue [1] with test case if it is 
indeed a bug?

Thanks,
Bo

Julio Arias wrote:
> Sorry I forgot about that, there is bug with the jaxws:endpoint 
> configuration, you can apply it to the endpoint in a different way but 
> you would need to declare more beans. I really don't know the 
> difference between jaxws:endpoint and jaxws:server configs. I can give 
> you an example on how to add the extra classes to the jaxws:endpoint 
> it goes like this:
>
> <bean id="jaxbDataBinding" class="org.apache.cxf.jaxb.JAXBDataBinding">
>         <property name="extraClass">
>             <bean class="ClassArrayFactoryBean">
>                 <property name="classNames">
>                     <list>
>                         <value>your.package.Class</value>
>                     </list>
>                 </property>
>             </bean>
>         </property>
> </bean>
>
> <jaxws:endpoint id="yourService" address="/YourServiceAddress" 
> implementor="#yourServiceImpl">
>     <jaxws:serviceFactory>
>         <bean 
> class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
>             <property name="dataBinding" ref="jaxbDataBinding"/>
>         </bean>
>     </jaxws:serviceFactory>
> </jaxws:endpoint>
>
>

Re: AW: Enforce complex type definition in WSDL

Posted by Julio Arias <ju...@rbxglobal.com>.
Sorry I forgot about that, there is bug with the jaxws:endpoint  
configuration, you can apply it to the endpoint in a different way  
but you would need to declare more beans. I really don't know the  
difference between jaxws:endpoint and jaxws:server configs. I can  
give you an example on how to add the extra classes to the  
jaxws:endpoint it goes like this:

<bean id="jaxbDataBinding" class="org.apache.cxf.jaxb.JAXBDataBinding">
         <property name="extraClass">
             <bean class="ClassArrayFactoryBean">
                 <property name="classNames">
                     <list>
                         <value>your.package.Class</value>
                     </list>
                 </property>
             </bean>
         </property>
</bean>

<jaxws:endpoint id="yourService" address="/YourServiceAddress"  
implementor="#yourServiceImpl">
	<jaxws:serviceFactory>
		<bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
			<property name="dataBinding" ref="jaxbDataBinding"/>
		</bean>
	</jaxws:serviceFactory>
</jaxws:endpoint>



On Aug 22, 2007, at 3:14 AM, Holger Stolzenberg wrote:

> Ok I have read through CXF-340. After I applied the solution to my  
> project I noticed that this 'jaxb.additionalContextClasses'  
> property is set for the 'jaxws:server' element.
>
> I tried to specify it in the same way for a 'jaxws:endpoint'  
> element but it did not work. So I changed my declarations to  
> 'jaxws:server' elements.
>
> Everything works fine.
>
> Would it make sense to specify these additional classes at  
> endpoint? And could someone please figure out in short what the  
> main difference is between server and endpoint (specific to CXF)  
> and for which use cases the choose one of them?
>
>
> -----Ursprüngliche Nachricht-----
> Von: Julio Arias [mailto:julio.arias@rbxglobal.com]
> Gesendet: Mittwoch, 22. August 2007 04:35
> An: cxf-user@incubator.apache.org
> Betreff: Re: Enforce complex type definition in WSDL
>
> Hi Holger -
>
> You can add extra classes to your JAXB context, look at https://  
> issues.apache.org/jira/browse/CXF-340 for more info.
>
> On Aug 21, 2007, at 9:13 AM, Holger Stolzenberg wrote:
>
>> Hi folks,
>>
>>
>> Using CXF 2.0.1-INCUBATOR + JAXB Databinding:
>>
>>
>> I have a ProductService SEI with the following signature:
>>
>> public ServiceStatus getProductById( int id ); public ServiceStatus
>> getProductByToken( String token );
>>
>>
>> So for this WS the ServiceStatus object is defined in the WSDL.
>> This ServiceStatus object is a wrapper that holds the services status
>> outcome, e.g. code ... , and the product itself if loaded.
>> For that it also has a geberic method
>>
>> public Object getObject();
>>
>> In an special use case this method should return an Object of the  
>> type
>> lets say 'Product'. Because the Product class itself has never been
>> declared or used in the SEI it won´t show up in the WSDL. But there I
>> need the complex type definition for 'Product' in order to ensure
>> class mapping for a PHP client.
>>
>> As a workaround I put the following method to the SEI:
>>
>> public void noop( Product product );
>>
>> Now the Product class has been declared in the SEI abd therefore a
>> complex type definition is created in the WSDL. Everything works fine
>> now.
>>
>> My question is how can I force the creation of a complex type in the
>> WSDL that my service may return but has not been declared or used
>> somewhere in the SEI??
>>
>> Mit lieben Grüßen aus dem eWerk
>>
>>   |  Holger Stolzenberg
>>   |  Softwareentwickler
>>   |
>>   |  Geschäftsführer:
>>   |  Frank Richter, Erik Wende, Hendrik Schubert
>>   |
>>   |  eWerk IT GmbH
>>   |  Markt 16
>>   |  Leipzig 04109
>>   |  http://www.ewerk.com
>>   |  HRB 9065, AG Leipzig
>>   |  Hauptniederlassung Leipzig
>>   |
>>   |  fon +49.341.4 26 49-0
>>   |  fax +49.341.4 26 49-88
>>   |  mailto:h.stolzenberg@ewerk.com
>>   |
>>   |  Support:
>>   |  fon 0700 CALLME24 (0700 22556324)
>>   |  fax 0700 CALLME24 (0700 22556324)
>>   |
>>   | Auskünfte und Angebote per Mail
>>   | sind freibleibend und unverbindlich.
>
>
>
>
> Julio Arias
> Java Developer
> Roundbox Global : enterprise : technology : genius
> ---------------------------------------------------------------------
> Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
> tel: 404.567.5000 ext. 2001 | cell: 011) 506.849.5981
> email: julio.arias@rbxglobal.com | www.rbxglobal.com
> ---------------------------------------------------------------------
>




Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 011) 506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------


AW: Enforce complex type definition in WSDL

Posted by Holger Stolzenberg <h....@ewerk.com>.
Ok I have read through CXF-340. After I applied the solution to my project I noticed that this 'jaxb.additionalContextClasses' property is set for the 'jaxws:server' element.

I tried to specify it in the same way for a 'jaxws:endpoint' element but it did not work. So I changed my declarations to 'jaxws:server' elements.

Everything works fine.

Would it make sense to specify these additional classes at endpoint? And could someone please figure out in short what the main difference is between server and endpoint (specific to CXF) and for which use cases the choose one of them?


-----Ursprüngliche Nachricht-----
Von: Julio Arias [mailto:julio.arias@rbxglobal.com] 
Gesendet: Mittwoch, 22. August 2007 04:35
An: cxf-user@incubator.apache.org
Betreff: Re: Enforce complex type definition in WSDL

Hi Holger -

You can add extra classes to your JAXB context, look at https:// issues.apache.org/jira/browse/CXF-340 for more info.

On Aug 21, 2007, at 9:13 AM, Holger Stolzenberg wrote:

> Hi folks,
>
>
> Using CXF 2.0.1-INCUBATOR + JAXB Databinding:
>
>
> I have a ProductService SEI with the following signature:
>
> public ServiceStatus getProductById( int id ); public ServiceStatus 
> getProductByToken( String token );
>
>
> So for this WS the ServiceStatus object is defined in the WSDL.  
> This ServiceStatus object is a wrapper that holds the services status 
> outcome, e.g. code ... , and the product itself if loaded.
> For that it also has a geberic method
>
> public Object getObject();
>
> In an special use case this method should return an Object of the type 
> lets say 'Product'. Because the Product class itself has never been 
> declared or used in the SEI it won´t show up in the WSDL. But there I 
> need the complex type definition for 'Product' in order to ensure 
> class mapping for a PHP client.
>
> As a workaround I put the following method to the SEI:
>
> public void noop( Product product );
>
> Now the Product class has been declared in the SEI abd therefore a 
> complex type definition is created in the WSDL. Everything works fine 
> now.
>
> My question is how can I force the creation of a complex type in the 
> WSDL that my service may return but has not been declared or used 
> somewhere in the SEI??
>
> Mit lieben Grüßen aus dem eWerk
>
>   |  Holger Stolzenberg
>   |  Softwareentwickler
>   |
>   |  Geschäftsführer:
>   |  Frank Richter, Erik Wende, Hendrik Schubert
>   |
>   |  eWerk IT GmbH
>   |  Markt 16
>   |  Leipzig 04109
>   |  http://www.ewerk.com
>   |  HRB 9065, AG Leipzig
>   |  Hauptniederlassung Leipzig
>   |
>   |  fon +49.341.4 26 49-0
>   |  fax +49.341.4 26 49-88
>   |  mailto:h.stolzenberg@ewerk.com
>   |
>   |  Support:
>   |  fon 0700 CALLME24 (0700 22556324)
>   |  fax 0700 CALLME24 (0700 22556324)
>   |
>   | Auskünfte und Angebote per Mail
>   | sind freibleibend und unverbindlich.




Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 011) 506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------


Re: Enforce complex type definition in WSDL

Posted by Julio Arias <ju...@rbxglobal.com>.
Hi Holger -

You can add extra classes to your JAXB context, look at https:// 
issues.apache.org/jira/browse/CXF-340 for more info.

On Aug 21, 2007, at 9:13 AM, Holger Stolzenberg wrote:

> Hi folks,
>
>
> Using CXF 2.0.1-INCUBATOR + JAXB Databinding:
>
>
> I have a ProductService SEI with the following signature:
>
> public ServiceStatus getProductById( int id );
> public ServiceStatus getProductByToken( String token );
>
>
> So for this WS the ServiceStatus object is defined in the WSDL.  
> This ServiceStatus object is a wrapper that holds the services  
> status outcome, e.g. code ... , and the product itself if loaded.  
> For that it also has a geberic method
>
> public Object getObject();
>
> In an special use case this method should return an Object of the  
> type lets say 'Product'. Because the Product class itself has never  
> been declared or used in the SEI it won´t show up in the WSDL. But  
> there I need the complex type definition for 'Product' in order to  
> ensure class mapping for a PHP client.
>
> As a workaround I put the following method to the SEI:
>
> public void noop( Product product );
>
> Now the Product class has been declared in the SEI abd therefore a  
> complex type definition is created in the WSDL. Everything works  
> fine now.
>
> My question is how can I force the creation of a complex type in  
> the WSDL that my service may return but has not been declared or  
> used somewhere in the
> SEI??
>
> Mit lieben Grüßen aus dem eWerk
>
>   |  Holger Stolzenberg
>   |  Softwareentwickler
>   |
>   |  Geschäftsführer:
>   |  Frank Richter, Erik Wende, Hendrik Schubert
>   |
>   |  eWerk IT GmbH
>   |  Markt 16
>   |  Leipzig 04109
>   |  http://www.ewerk.com
>   |  HRB 9065, AG Leipzig
>   |  Hauptniederlassung Leipzig
>   |
>   |  fon +49.341.4 26 49-0
>   |  fax +49.341.4 26 49-88
>   |  mailto:h.stolzenberg@ewerk.com
>   |
>   |  Support:
>   |  fon 0700 CALLME24 (0700 22556324)
>   |  fax 0700 CALLME24 (0700 22556324)
>   |
>   | Auskünfte und Angebote per Mail
>   | sind freibleibend und unverbindlich.




Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 011) 506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------