You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Siva krishna <gu...@gmail.com> on 2011/02/01 09:35:43 UTC

Re: share data types between services

Hi Christian and Willem,

Thanks for your suggestions. I will investigate further and post back when I
have some results.

/Siva

On Mon, Jan 24, 2011 at 2:00 PM, Christian Schneider
<cs...@talend.com>wrote:

> Hi Silva,
>
> as far as I know .Net by default creates a independent package for each
> webservice. It does not share data classes even if it could. There is a
> switch in the .Net code generation that controls this behaviour.
>
> See:
>
> http://stackoverflow.com/questions/1707233/sharing-classes-across-different-web-services-proxy-classes
>
> If you share types between services you should be very careful about your
> versioning scheme. As long as all services belong to the same application
> and are updated at the same time you will be safe.
>
> Christian
>
>
> -----Ursprüngliche Nachricht-----
> Von: Siva krishna [mailto:guru.sreenivas@gmail.com]
> Gesendet: Donnerstag, 20. Januar 2011 19:39
> An: users@cxf.apache.org
> Betreff: share data types between services
>
> Hello Everybody,
>
> I am new to this forum as well as to the Webservice world. I have a problem
> with code first webservice implementation with CXF. Please bear with me if
> the solution is so obvious.
>
> We already have a  client server application - both client and server in
> java and server is backed by spring framework and we use spring HttpInvoker
>  remoting approach to communicate between client and server.
>
> We now need to support a .NET client. So we chose web-service approach and
> enabled the interfaces as webservices using CXF framework and JAXB
> databinding as a default option.
>
> The problem is, we have several services and each share a bunch datamodel
> classes. but once we enable each service as a seperate webservice all the
> datamodel classes endup as a seperate type when imported the WSDL file in
> .NET Visual studio IDE. How can we share the data model objects between
> webservices. just to give an example
>
> Service 1:
> --------------
> @Webservice
> public class Service1 {
>
> A getA();
>
> }
>
> Service 2:
> -------------
> @Webservice
> public class Service2 {
>
> String getDetails(A a);
>
> }
>
>
> class A {
> int a;
> float x;
> }
>
> A is datamodel class that is shared between to services. However when WSDL
> are references in .NET they end up as to different types and service2 could
> not take the object A that is received from Service1.
>
> Please throw some light on what am I missing. How can I put all the
> datamodel classes into same namespace so that the generated WSDL files also
> referes them as same data types. Let me know if I am not clear.
>
> Thank you all in advance.
>
> /Kalyan
>

Re: share data types between services

Posted by Siva krishna <gu...@gmail.com>.
Hi Christian,

I could able to solve the problem with the information provided in the link.
Thank you.

/Siva

On Tue, Feb 1, 2011 at 9:35 AM, Siva krishna <gu...@gmail.com>wrote:

> Hi Christian and Willem,
>
> Thanks for your suggestions. I will investigate further and post back when
> I have some results.
>
> /Siva
>
> On Mon, Jan 24, 2011 at 2:00 PM, Christian Schneider <
> cschneider@talend.com> wrote:
>
>> Hi Silva,
>>
>> as far as I know .Net by default creates a independent package for each
>> webservice. It does not share data classes even if it could. There is a
>> switch in the .Net code generation that controls this behaviour.
>>
>> See:
>>
>> http://stackoverflow.com/questions/1707233/sharing-classes-across-different-web-services-proxy-classes
>>
>> If you share types between services you should be very careful about your
>> versioning scheme. As long as all services belong to the same application
>> and are updated at the same time you will be safe.
>>
>> Christian
>>
>>
>> -----Ursprüngliche Nachricht-----
>> Von: Siva krishna [mailto:guru.sreenivas@gmail.com]
>> Gesendet: Donnerstag, 20. Januar 2011 19:39
>> An: users@cxf.apache.org
>> Betreff: share data types between services
>>
>> Hello Everybody,
>>
>> I am new to this forum as well as to the Webservice world. I have a
>> problem with code first webservice implementation with CXF. Please bear with
>> me if the solution is so obvious.
>>
>> We already have a  client server application - both client and server in
>> java and server is backed by spring framework and we use spring HttpInvoker
>>  remoting approach to communicate between client and server.
>>
>> We now need to support a .NET client. So we chose web-service approach and
>> enabled the interfaces as webservices using CXF framework and JAXB
>> databinding as a default option.
>>
>> The problem is, we have several services and each share a bunch datamodel
>> classes. but once we enable each service as a seperate webservice all the
>> datamodel classes endup as a seperate type when imported the WSDL file in
>> .NET Visual studio IDE. How can we share the data model objects between
>> webservices. just to give an example
>>
>> Service 1:
>> --------------
>> @Webservice
>> public class Service1 {
>>
>> A getA();
>>
>> }
>>
>> Service 2:
>> -------------
>> @Webservice
>> public class Service2 {
>>
>> String getDetails(A a);
>>
>> }
>>
>>
>> class A {
>> int a;
>> float x;
>> }
>>
>> A is datamodel class that is shared between to services. However when WSDL
>> are references in .NET they end up as to different types and service2 could
>> not take the object A that is received from Service1.
>>
>> Please throw some light on what am I missing. How can I put all the
>> datamodel classes into same namespace so that the generated WSDL files also
>> referes them as same data types. Let me know if I am not clear.
>>
>> Thank you all in advance.
>>
>> /Kalyan
>>
>
>