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:[email protected]] 
Gesendet: Donnerstag, 20. Januar 2011 19:39
An: [email protected]
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

Reply via email to