Hi all. A few days ago, I asked about a problem I was having with CXF, unmarshalling, and multi-wsdl generation. I've spent some more time trying to figure out what's going wrong, and I'd like to provide a test case.
dfp-test.tgz (attached) contains the test case. To run it, - unpack dfp-test.tgz - sen the CXF_HOME environment variable to an appropriate place.- run ant
Running ant will - run wsdl2java to generate java code from two wsdls. (Both WSDLs come from Google APIs) - Compile the code, and a test driver (Main.java) - Run Main.java Main.java runs four test cases; three positive and one negative. The negative test case illustrates JAXB failing to unmarshall xml produced by one of the services in question. I believe the unmarshalling failure is due to a missing @XmlSeeAlso element a class called ApiError. In the .tgz, there's a README.txt with full stacktraces. I'm hoping the .tgz is allowed through the mailing list. If not, please let me how I should submit it. I worked around the unmarshalling problem by using xmlbeans data bindings instead of JAXB. Steve
Date: Mon, 29 Oct 2012 14:15:16 -0400 From: Steve Revilak <[email protected]> To: [email protected] Subject: ObjectFactory and Multiple WSDLs in same namespace Hello CXF Users, I'm having trouble generating java code from a collection of WSDLs. I'm finding that even if all code generation is done in one pass (via wsdl2java -wsdlList), I'm left with an incomplete ObjectFactory. This is similar to the issue reported in https://issues.apache.org/jira/browse/CXF-1340. I understand that wsdl2java presumes a 1:1 mapping between namespaces and packages; but I have a case where the 1:1 mapping poses problems, and I'd like to understand my options for working around it. I'm working with public WSDLs, so I'd like to provide a small, but real-world use case for what I'm trying to do. The WSDLs in question come from Google's DoubleClick for Publishers API. The API has a CRUD design, where each type of entity has its own SEI (and WSDL). I'll pick three WSDLs for my example: https://www.google.com/apis/ads/publisher/v201208/CustomTargetingService?wsdl https://www.google.com/apis/ads/publisher/v201208/LineItemService?wsdl https://www.google.com/apis/ads/publisher/v201208/UserService?wsdl I can generate code like this (where wsdl.txt contains CustomTargetingService.wsdl, LineItemService.wsdl, and UserService.wsdl): ~/apache-cxf-2.7.0/bin/wsdl2java -verbose -d ~/dfp-src -p dfp.example -wsdlList ./wsdl.txt The resulting ObjectFactory only creates objects from UserService. As google provides them, all WSDLs have targetNamespace="https://www.google.com/apis/ads/publisher/v201208" I looked into using separate packages for each WSDL, but this approach comes with problems. Several classes are common between WSDLs. For example, there's a type called DateTime that appears in several service definitions, and there are cases where I'd might get a DateTime object from service A, and would want to pass it to a call to service B. I can't do that if A and B are in different packages. What can I do in this case? http://cxf.547215.n5.nabble.com/Wsdl2java-package-usage-td553695.html suggests merging ObjectFactory code by hand. This is certainly possible, but it's also labor-intensive and error-prone. Is there a way to intercept missing type errors from CXF? For example, if CXF can't find an ObjectFactory method to create a UniqueError, I'd like to try and instantiate a dfp.example.UniqueError (since I know that the types are in one package, and I know what that package is). Any suggestions would be sincerely appreciated. Steve
dfp-test.tgz
Description: GNU Zip compressed data
pgpZcGnRTPLr5.pgp
Description: PGP signature
