Hello all, I'm trying to use wsdl2java to create a client for a WS. The WS is built using an SAP SOA/ESB tool (not too sure). In any event, the Port Type defined in the WSDL, and one of the complex types have the same name, sorta.
The port type is all uppercase and has underscores in it, the complex type is a standard name. This poses a problem for the wsdl2java tool as it uses these names (minus namespace) tweaks them, and generates the resulting classes. What ends up happening is i get the Service created and no parameter object, and the wsdl2java call actually fails quietly. I was able to recreate the issue with a dummy wsdl i had laying around from one of my classes: Here's the WSDL <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions name="JaxWsCreateRecipeWsService" targetNamespace=" http://ws.cs5551.cse.umkc.edu/" xmlns:ns1=" http://schemas.xmlsoap.org/soap/http" xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns=" http://ws.cs5551.cse.umkc.edu/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <wsdl:types> <xs:schema elementFormDefault="unqualified" targetNamespace=" http://ws.cs5551.cse.umkc.edu/" version="1.0" xmlns:tns=" http://ws.cs5551.cse.umkc.edu/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="createRecipe" type="tns:createRecipe"/> <xs:element name="createRecipeResponse" type="tns:createRecipeResponse"/> <xs:complexType name="createRecipe"> <xs:sequence> <xs:element minOccurs="0" name="recipe" type="tns:recipe"/> </xs:sequence> </xs:complexType> <xs:complexType name="recipe"> <xs:sequence> <xs:element minOccurs="0" name="id" type="xs:long"/> <xs:element minOccurs="0" name="image" type="xs:string"/> <xs:element minOccurs="0" name="name" type="xs:string"/> <xs:element minOccurs="0" name="prepTime" type="xs:int"/> </xs:sequence> </xs:complexType> <xs:complexType name="createRecipeResponse"> <xs:sequence> <xs:element minOccurs="0" name="recipe" type="tns:recipe"/> </xs:sequence> </xs:complexType> </xs:schema> </wsdl:types> <wsdl:message name="createRecipeResponse"> <wsdl:part element="tns:createRecipeResponse" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:message name="createRecipe"> <wsdl:part element="tns:createRecipe" name="parameters"> </wsdl:part> </wsdl:message> <wsdl:portType name="CREATE_RECIPE"> <wsdl:operation name="createRecipe"> <wsdl:input message="tns:createRecipe" name="createRecipe"> </wsdl:input> <wsdl:output message="tns:createRecipeResponse" name="createRecipeResponse"> </wsdl:output> </wsdl:operation> </wsdl:portType> <wsdl:binding name="JaxWsCreateRecipeWsServiceSoapBinding" type="tns:CREATE_RECIPE"> <soap:binding style="document" transport=" http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="createRecipe"> <soap:operation soapAction="" style="document"/> <wsdl:input > <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="JaxWsCreateRecipeWsService"> <wsdl:port binding="tns:JaxWsCreateRecipeWsServiceSoapBinding" name="JaxWsCreateRecipeWsPort"> <soap:address location=" http://localhost:8080/recipe-ws/services/CreateRecipeService"/> </wsdl:port> </wsdl:service> </wsdl:definitions> Here's a maven pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>test</groupId> <artifactId>test-service</artifactId> <packaging>jar</packaging> <version>1.0.0-SNAPSHOT</version> <properties> <cxf.version>2.4.1</cxf.version> </properties> <build> <plugins> <plugin> <artifactId>maven-clean-plugin</artifactId> <configuration> <filesets> <fileset> <directory>src/main/java/com</directory> <includes> <include>**</include> </includes> </fileset> </filesets> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> <version>${cxf.version}</version> <executions> <execution> <id>generate-sources</id> <phase>generate-sources</phase> <goals> <goal>wsdl2java</goal> </goals> <configuration> <sourceRoot>${basedir}/src/main/java</sourceRoot> <wsdlOptions> <wsdlOption> <wsdl> ${basedir}/src/main/resources/recipeservice.wsdl</wsdl> <extraargs> <extraarg>-wsdlLocation</extraarg> <extraarg>classpath:recipeservice.wsdl</extraarg> <extraarg>-client</extraarg> <extraarg>-server</extraarg> <extraarg>-impl</extraarg> <extraarg>-frontend</extraarg> <extraarg>jaxws21</extraarg> </extraargs> </wsdlOption> </wsdlOptions> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>javax.jws</groupId> <artifactId>jsr181-api</artifactId> <version>1.0-MR1</version> <type>jar</type> <scope>provided</scope> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.xml.ws</groupId> <artifactId>jaxws-api</artifactId> <version>2.1</version> <scope>provided</scope> </dependency> </dependencies> </project> If you run the generate-sources on it, you'll see what i'm referring to. Has anyone run into this problem before? Is there a fix for it? Is it an issue of the wsdl2java too, or the cxf code gen tool? Obviously if i rename either the portType or the parameter element the issue resolves itself, but i was just wondering if anyone knew if any of the other parameters for configuring the wsdl2java tool could fix this, i have yet to see anything that does. Thanks in advance! -B
