You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Rodrigo Ruiz <rr...@gridsystems.com> on 2005/09/01 16:54:38 UTC

how to share types between services

Hi all,

I am new to this project, and I would like to know about how does Axis C 
handles the following case:

I have about twenty web services (and counting) for which I would like 
to create C++ client stubs. None of my client applications use all these 
services, so I want to have a separate DLL for each service.
These services share some complex-types that they use as input or output 
parameters. The WSDL definitions of these types are always identical for 
all the services, because they actually are the same java class.
Some of the service methods are intended to be used in a chain, that is, 
the output of one method is used as the input for another method. I 
would like to be able to do this in my client code without having to 
copy data between equivalent types, just as I can do in an Axis Java client.

For example, the following is a code snipplet of a java client 
application that uses some services in chain:

// Service stub instances
ServiceA sa = ...;
ServiceB sb = ...;
ServiceC sc = ...;

// Remote calls
Equation eq = sa.getEquation();
for (int i = 0; i < 100; i++) {
  Sample sample = sb.getDataSample();
  double result = sc.solve(eq, sample);
  System.out.println("Result: " + result);
}

I would like to be able to, somehow, share the Equation class between 
the stubs for ServiceA and ServiceC, without having to compile them into 
a single library. This is, to have a ServiceA.dll and a ServiceC.dll, 
but only one implementation of the Equation class, so I can use both 
dlls in the same client app without link errors. Is this possible at all?

Thanks in advance,
Rodrigo Ruiz

Re: how to share types between services

Posted by John Hawkins <HA...@uk.ibm.com>.
The answer is I don't know but thinking aloud I can't see many issues.
You could statically link the libs in which case I can't see you getting 
any issues.

I don't think there are any issues (at least one windows) of more than one 
app using the same dll when dynamically linked either.


There would be seperated classes (and thus files) for each complex type 
so, sure you could put each one into it's own lib e.g. complextype 
one->complextype.dll but this seems a bit wasteful. I'd be inclined just 
to put them into one "AllComplexTypes.dll".



Rodrigo Ruiz <rr...@gridsystems.com> wrote on 01/09/2005 16:31:13:

> Thank you for your fast answer John :-)
> 
> Then, what would occur if I try to use several DLLs (or .so libraries) 
> sharing classes from the same client app?
> Would I get compile or link errors, or would the problem appear at 
> run-time when trying to use the response of ServiceA as a parameter for 
> ServiceC?
> 
> Are separate files generated for each type? In that case I could create 
> a different DLL for each shared type
> 
> Sorry, I know the fast answer is "try it yourself", but I am doing a 
> product evaluation task, and I have a very short time assigned to finish 

> it :-S
> 
> Thanks,
> Rodrigo Ruiz
> 
> John Hawkins wrote:
> 
> >
> > Hi Rodrigo,
> >
> > Well, of the top of my head you could compile the complex types into 
> > their own library and link that library into your application.
> >
> > I don't think we have any Axis specific way that we do this now 
though.
> >
> > hope this helps,
> > John.
> >
> >
> >
> >
> > *Rodrigo Ruiz <rr...@gridsystems.com>*
> >
> > 01/09/2005 15:54
> > Please respond to
> > "Apache AXIS C User List"
> >
> >
> > 
> > To
> >    axis-c-user@ws.apache.org
> > cc
> > 
> > Subject
> >    how to share types between services
> >
> >
> >
> > 
> >
> >
> >
> >
> >
> > Hi all,
> >
> > I am new to this project, and I would like to know about how does Axis 
C
> > handles the following case:
> >
> > I have about twenty web services (and counting) for which I would like
> > to create C++ client stubs. None of my client applications use all 
these
> > services, so I want to have a separate DLL for each service.
> > These services share some complex-types that they use as input or 
output
> > parameters. The WSDL definitions of these types are always identical 
for
> > all the services, because they actually are the same java class.
> > Some of the service methods are intended to be used in a chain, that 
is,
> > the output of one method is used as the input for another method. I
> > would like to be able to do this in my client code without having to
> > copy data between equivalent types, just as I can do in an Axis Java 
> > client.
> >
> > For example, the following is a code snipplet of a java client
> > application that uses some services in chain:
> >
> > // Service stub instances
> > ServiceA sa = ...;
> > ServiceB sb = ...;
> > ServiceC sc = ...;
> >
> > // Remote calls
> > Equation eq = sa.getEquation();
> > for (int i = 0; i < 100; i++) {
> >  Sample sample = sb.getDataSample();
> >  double result = sc.solve(eq, sample);
> >  System.out.println("Result: " + result);
> > }
> >
> > I would like to be able to, somehow, share the Equation class between
> > the stubs for ServiceA and ServiceC, without having to compile them 
into
> > a single library. This is, to have a ServiceA.dll and a ServiceC.dll,
> > but only one implementation of the Equation class, so I can use both
> > dlls in the same client app without link errors. Is this possible at 
all?
> >
> > Thanks in advance,
> > Rodrigo Ruiz
> >
> 
>------------------------------------------------------------------------
> >
> >No virus found in this incoming message.
> >Checked by AVG Anti-Virus.
> >Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 
26/08/2005
> > 
> >

Re: how to share types between services

Posted by Rodrigo Ruiz <rr...@gridsystems.com>.
Thank you for your fast answer John :-)

Then, what would occur if I try to use several DLLs (or .so libraries) 
sharing classes from the same client app?
Would I get compile or link errors, or would the problem appear at 
run-time when trying to use the response of ServiceA as a parameter for 
ServiceC?

Are separate files generated for each type? In that case I could create 
a different DLL for each shared type

Sorry, I know the fast answer is "try it yourself", but I am doing a 
product evaluation task, and I have a very short time assigned to finish 
it :-S

Thanks,
Rodrigo Ruiz

John Hawkins wrote:

>
> Hi Rodrigo,
>
> Well, of the top of my head you could compile the complex types into 
> their own library and link that library into your application.
>
> I don't think we have any Axis specific way that we do this now though.
>
> hope this helps,
> John.
>
>
>
>
> *Rodrigo Ruiz <rr...@gridsystems.com>*
>
> 01/09/2005 15:54
> Please respond to
> "Apache AXIS C User List"
>
>
> 	
> To
> 	axis-c-user@ws.apache.org
> cc
> 	
> Subject
> 	how to share types between services
>
>
>
> 	
>
>
>
>
>
> Hi all,
>
> I am new to this project, and I would like to know about how does Axis C
> handles the following case:
>
> I have about twenty web services (and counting) for which I would like
> to create C++ client stubs. None of my client applications use all these
> services, so I want to have a separate DLL for each service.
> These services share some complex-types that they use as input or output
> parameters. The WSDL definitions of these types are always identical for
> all the services, because they actually are the same java class.
> Some of the service methods are intended to be used in a chain, that is,
> the output of one method is used as the input for another method. I
> would like to be able to do this in my client code without having to
> copy data between equivalent types, just as I can do in an Axis Java 
> client.
>
> For example, the following is a code snipplet of a java client
> application that uses some services in chain:
>
> // Service stub instances
> ServiceA sa = ...;
> ServiceB sb = ...;
> ServiceC sc = ...;
>
> // Remote calls
> Equation eq = sa.getEquation();
> for (int i = 0; i < 100; i++) {
>  Sample sample = sb.getDataSample();
>  double result = sc.solve(eq, sample);
>  System.out.println("Result: " + result);
> }
>
> I would like to be able to, somehow, share the Equation class between
> the stubs for ServiceA and ServiceC, without having to compile them into
> a single library. This is, to have a ServiceA.dll and a ServiceC.dll,
> but only one implementation of the Equation class, so I can use both
> dlls in the same client app without link errors. Is this possible at all?
>
> Thanks in advance,
> Rodrigo Ruiz
>
>------------------------------------------------------------------------
>
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.344 / Virus Database: 267.10.16/83 - Release Date: 26/08/2005
>  
>

Re: how to share types between services

Posted by John Hawkins <HA...@uk.ibm.com>.
Hi Rodrigo,

Well, of the top of my head you could compile the complex types into their 
own library and link that library into your application. 

I don't think we have any Axis specific way that we do this now though.

hope this helps,
John.





Rodrigo Ruiz <rr...@gridsystems.com> 
01/09/2005 15:54
Please respond to
"Apache AXIS C User List"


To
axis-c-user@ws.apache.org
cc

Subject
how to share types between services






Hi all,

I am new to this project, and I would like to know about how does Axis C 
handles the following case:

I have about twenty web services (and counting) for which I would like 
to create C++ client stubs. None of my client applications use all these 
services, so I want to have a separate DLL for each service.
These services share some complex-types that they use as input or output 
parameters. The WSDL definitions of these types are always identical for 
all the services, because they actually are the same java class.
Some of the service methods are intended to be used in a chain, that is, 
the output of one method is used as the input for another method. I 
would like to be able to do this in my client code without having to 
copy data between equivalent types, just as I can do in an Axis Java 
client.

For example, the following is a code snipplet of a java client 
application that uses some services in chain:

// Service stub instances
ServiceA sa = ...;
ServiceB sb = ...;
ServiceC sc = ...;

// Remote calls
Equation eq = sa.getEquation();
for (int i = 0; i < 100; i++) {
  Sample sample = sb.getDataSample();
  double result = sc.solve(eq, sample);
  System.out.println("Result: " + result);
}

I would like to be able to, somehow, share the Equation class between 
the stubs for ServiceA and ServiceC, without having to compile them into 
a single library. This is, to have a ServiceA.dll and a ServiceC.dll, 
but only one implementation of the Equation class, so I can use both 
dlls in the same client app without link errors. Is this possible at all?

Thanks in advance,
Rodrigo Ruiz