Hi!
I had similar requirements and decided to rely on code generation by
WSDL2JAVA. WSDL2JAVA takes the unique shared XSD from a source directory
and copies it for each service. That is, I have a directory
wsdlDefinitions that contains service1.wsdl, service2.wsdl, and
common.xsd. Then I run WSDL2JAVA to generate server code with the -R
option, and
.../MyService1/META-INF/service1.wsdl
.../MyService1/META-INF/common.xsd
.../MyService2/META-INF/service2.wsdl
.../MyService2/META-INF/common.xsd
are generated. I have no troubles with the replication of common.xsd
because I only change wsdlDefinitions/common.xsd. Generated artefacts
won't be touched anyway.
I know that my approach above may not be appropriate in your situation. If
so, perhaps You can try setting the useOriginalWSDL parameter in the
service.xml to true. Frankly, I don't know the effects of doing this.
Good luck,
Peter.
Mauro Molinari <[EMAIL PROTECTED]> schrieb am 20.11.2007
10:53:47:
> Hello!
> I have a problem if I want to share some schema files between services.
>
> Suppose I have the following structure:
>
> The WSDLs for MyService1 and MyService2 are in the following folders,
> respectively:
> contextpath/WEB-INF/services/MyService1/META-INF/
> contextpath/WEB-INF/services/MyService2/META-INF/
>
> I want them to share Common.xsd: where should I put it?
> If I put it here:
> contextpath/WEB-INF/services/
> and the xsd:import schemaLocation in the WSDLs points to
> "../../Common.xsd", Axis2 can find them and processes the services
> correctly, but when it substitutes the link to it in the WSDLs, it
> generates the following links:
>
> MyService1?xsd=../../Common.xsd (in MyService1 WSDL)
> MyService2?xsd=../../Common.xsd (in MyService2 WSDL)
>
> The problem is that from an HTTP client point of view, this translates
> to path contextpath/Common.xsd: in fact, if you try to write the link:
>
> http://server:8080/contextpath/services/MyService1?xsd=../../Common.xsd
> a "file not found" error is given.
> Another clue is that if I try to generate a client pointing to
> http://server:8080/contextpath/services/MyService1?wsdl, Java2WSDL says
> that it cannot retrieve the schema.
>
> By manually typing:
> http://server:8080/contextpath/services/MyService1?xsd=../Common.xsd
> I see that the schema can actually be found; but if I replace the
> xsd:import in the original WSDL so that the schemaLocation points to
> "../Common.xsd", then Axis2 can't find it anymore, because it searches
> for it in contextpath/WEB-INF/services/MyService1/ and the generation of
> the WSDL fails.
>
> How to face this problem? Where should I put the shared schemas? How to
> reference them from within the original WSDLs?
>
> Thanks in advance.
>
> --
> Mauro Molinari
> Software Developer
> [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]