You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Chris Kelly <ab...@tolstoy.com> on 2004/05/12 21:53:08 UTC

Sharing types between services

I have two services: Service1 and Service2. I have a class that methods in both services 
accept and return: CommonClass. These classes are in one package.

If I use Java2WSDL to produce .wsdl files for both services, Service1 puts CommonClass in its 
namespace, and Service2 puts CommonClass in its namespace. However, the code in the 
version of CommonClass generated by WSDL2Java tags it as belonging to Service2.

I'm getting an InvocationTargetException when I deploy and run a test, and I'm assuming that's 
because Service1 is returning a CommonClass belonging to Service1's namespace, but that 
conflicts with the metadata in CommonClass tagging it as belonging to Service2's namespace. 
There might be another reason for the exception, but in any case that's something I'd like to 
correct.

So, I created a .wsdl file putting CommonClass in its own namespace not having anything to do 
with Service1 or Service2, then I used the "-I" switch to Java2WSDL to import that into the 
WSDL for Service1. It did import it, but it also added CommonClass in the type section a 
second time as belonging to Service1's namespace.

1. Is creating a separate namespace as described above the correct way to deal with things 
like this, and

2. Is there a way to get Java2WSDL to automatically output what I need, or do I need to edit 
these files by hand?



Re: Sharing types between services

Posted by Chris Kelly <ab...@tolstoy.com>.
On 12 May 2004 at 12:53, Chris Kelly wrote:
> I have two services: Service1 and Service2. I have a class that methods in both services 
> accept and return: CommonClass. These classes are in one package.

I've since found this .NET-specific example of the same problem:

  http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/dnservice/html/service07162002.asp

Since I have a few common classes and five services, I'd rather avoid editing the .wsdl files 
either by hand or with ant, so if anyone knows how to get all or almost all the way there with 
Java2WSDL, please let me know. Or, is there an easy change I could make to the 
Java2WSDL source?