I am using cxf-codegen-plugin v. 3.2.4 in a maven project. WSDL refers to the schema:
<xsd:import namespace="http://mynamespace/"
schemaLocation="../schema/MySchema.xsd"/>
But when the generated Server runs, the published wsdl refers to the schema like this:
<xsd:import namespace="http://mynamespace/" schemaLocation="http://localhost:9999/?xsd=1"/>
And this generated xsd changed the argument names for a given method. The original schema has the following definition:
<xs:complexType name="myMethod">
<xs:sequence>
<xs:element name="messageHeader" type="tns:soapMessageHeader" minOccurs="0"/>
<xs:element name="myId" type="xs:string" minOccurs="0"/>
<xs:element name="mySecondId" type="xs:string" minOccurs="0"/>
<xs:element name="myThirdId" type="xs:string" minOccurs="0"/>
<xs:element name="password" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
Whereas the generated schema has the following:
<xs:complexType name="myMethod">
<xs:sequence>
<xs:element name="arg0" type="tns:soapMessageHeader" minOccurs="0"/>
<xs:element name="arg1" type="xs:string" minOccurs="0"/>
<xs:element name="arg2" type="xs:string" minOccurs="0"/>
<xs:element name="arg3" type="xs:string" minOccurs="0"/>
<xs:element name="arg4" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
It changed the element names from the defined ones to "arg0", "arg...". I need this not to be done.
My pom has this:
<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>${source.wsdl.path}</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/MyServiceDefinition.wsdl</wsdl>
<extraargs>
<extraarg>-impl</extraarg>
<extraarg>-verbose</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
The automatically generated interface for the service has the @WebParam annotation.
Can anyone help me, please?
In http://www.benmccann.com/web-services-tutorial-with-apache-cxf the author indicates the usage of endpointInterface annotation attribute in order to respect the annotations inside the automatically generated interface (by cxf itself):
@WebService(endpointInterface = "com.company.auth.service.AuthService",
serviceName = "corporateAuthService")
This alternative requires no additional xml configuration.
Tomcat EE documentation gives us a completed example: http://tomee.apache.org/examples-trunk/simple-webservice
Yet another stackoverflow question that could be related: jax-ws regarding endpointinterface