Looks like there is a bug with:
<targetNamespace>http://www.mycompany.com/services/test</targetNamespace>
and the simple frontend. It's not completely honoring that so various things
are in the wrong namespace and the generated wsdl is not correct. I would
suggest not using that at this point (and log a bug and attach your project).
<schemaTargetNamespace>http://www.mycompany.com/data/test</schemaTargetNamespace>
<schemaTargetNamespacePrefix>td</schemaTargetNamespacePrefix>
<targetNamespacePrefix>ts</targetNamespacePrefix>
Not sure where you got these options. They don't exist and thus would have
no affect.
Dan
On Wednesday 25 August 2010 5:12:39 am Sean Patrick Floyd wrote:
> Hello,
>
>
>
> I have a sample maven project which has the following structure:
>
>
>
> Root
>
> - Api (service interfaces)
>
> - Impl (api implementation)
>
> - Server (web service wrapped around impl)
>
> - Client (web service client, knows only about api and about
> server's generated wsdl)
>
>
>
> In the server artifact, I use the maven java2ws plugin to generate a simple
> frontend:
>
>
>
> <plugin>
>
> <groupId>org.apache.cxf</groupId>
>
> <artifactId>cxf-java2ws-plugin</artifactId>
>
> <version>2.2.9</version>
>
> <dependencies>
>
> <dependency>
>
> <groupId>org.apache.cxf</groupId>
>
> <artifactId>cxf-rt-frontend-simple</artifactId>
>
> <version>${cxf.version}</version>
>
> </dependency>
>
> </dependencies>
>
> <configuration>
>
>
> <className>com.mycompany.service.impl.TestServiceImpl</className>
>
> <genWsdl>true</genWsdl>
>
> <frontend>simple</frontend>
>
> <databinding>aegis</databinding>
>
> <serviceName>testService</serviceName>
>
> <quiet>false</quiet>
>
>
> <schemaTargetNamespace>http://www.mycompany.com/data/test</schemaTargetName
> s pace>
>
> <schemaTargetNamespacePrefix>td</schemaTargetNamespacePrefix>
>
>
> <targetNamespace>http://www.mycompany.com/services/test</targetNamespace>
>
> <targetNamespacePrefix>ts</targetNamespacePrefix>
>
> <soap12>true</soap12>
>
> <attachWsdl>false</attachWsdl>
>
> <argline>-s
> ${project.build.directory}/generated-sources/cxf</argline>
>
> </configuration>
>
> <executions>
>
> <execution>
>
> <phase>generate-sources</phase>
>
> <id>generate-wsdl</id>
>
> <configuration>
>
>
> <outputFile>${project.build.outputDirectory}/testService.wsdl</outputFile>
>
> </configuration>
>
> <goals>
>
> <goal>java2ws</goal>
>
> </goals>
>
> </execution>
>
> </executions>
>
> </plugin>
>
>
>
> I then unpack this WSDL in the client artifact and try to generate client
> code from it using the codegen plugin:
>
>
>
> <plugin>
>
> <groupId>org.apache.maven.plugins</groupId>
>
> <artifactId>maven-dependency-plugin</artifactId>
>
> <version>2.1</version>
>
> <executions>
>
> <execution>
>
> <id>unpack</id>
>
> <phase>generate-sources</phase>
>
> <goals>
>
> <goal>unpack</goal>
>
> </goals>
>
> <configuration>
>
> <artifactItems>
>
> <artifactItem>
>
> <groupId>${project.groupId}</groupId>
>
> <artifactId>server</artifactId>
>
> <version>${project.version}</version>
>
> <type>jar</type>
>
> <overWrite>true</overWrite>
>
>
> <outputDirectory>${project.build.directory}/unpacked</outputDirectory>
>
> <includes>**/*.wsdl</includes>
>
> </artifactItem>
>
> </artifactItems>
>
> </configuration>
>
> </execution>
>
> </executions>
>
> </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>
>
> <configuration>
>
>
> <sourceRoot>${project.build.directory}/generated-sources/cxf</sourceRoot>
>
> <wsdlOptions>
>
> <wsdlOption>
>
>
> <wsdl>${project.build.directory}/unpacked/testService.wsdl</wsdl>
>
> </wsdlOption>
>
> </wsdlOptions>
>
> </configuration>
>
> <goals>
>
> <goal>wsdl2java</goal>
>
> </goals>
>
> </execution>
>
> </executions>
>
> </plugin>
>
>
>
> However, I get the following exception:
>
>
>
> file:/C:/. [path snipped] ./testService.wsdl:[91,5]
>
> Caused by
> {http://impl.service.mycompany.com/}[binding:TestServiceImplSoapBinding]
> not exist.
>
>
>
> What am I missing?
>
>
>
> Can find the sample project at this address:
>
>
>
> http://mostlymagic.com/cxf-test.zip
>
>
>
> Thanks in advance for your help,
>
>
>
> Sean
--
Daniel Kulp
[email protected]
http://dankulp.com/blog