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

Attachment: pgpP5qYxwhG0R.pgp
Description: PGP signature

Reply via email to