Use same ComplexType in different WSDL files
I would li开发者_StackOverflow中文版ke to use same ComplexType in two different WSDLs. How to define and include these ComplexTypes so i can use it in both WSDLs? (and practically in case of Java they are generated to the same package/datatype)
The answer is really dependent on your deployment model etc. But here is a simple solution
- Let that complex type be in its own namespace
- Bundle the complex type as a separate component on its own say COMMON-XSD
For each WSDL
- IMPORT the complex type
- Put a dependency on the COMMON-XSD
- Use the facilities provided by your build tool to copy the XSD to this project (mvn and ant can do it)
- Most wsdl-to-java tools allow you to map the COMMON-XSD namespace to whatever package you want
- Generate code for WSDL
I suggest you go through this nice article.
I can provide more specific answers if you include more details on your build env and deployment model
精彩评论