0
votes

I am using Apache CXF 2.4.2 for implementing a SOAP webservice. I followed/adapted the tutorial (see next link) to create a webservice by a contract.

http://confluence.highsource.org/display/HJ3/Apache+CXF+Tutorial+-+Building+JAX-WS,+JAXB+and+JPA-based+web+service+with+Apache+CXF,+Spring+and+Hyperjaxb3

In this example, you can see a wsdl and a xsd file which contains the data model. This datamodel is imported by the wsdl file. After that I generate the code with the Maven cxf-codegen-plugin (v. 2.4.2). Everything seem OK. I can compile my project and also I can consume the webservice on my local maschine by using the Eclipse Webservices Explorer.

But on another computer there I can see only the webservice opererations. The wsdl contains no datamodel (http://***:18080/webservice/Test?wsdl) and another consumer is not able to generate a client.

I tested another case where I put the data type declarations directly into the wsdl but the effect is the same :-(. It seems so that Apache CXF creates internally a new wsdl on the fly.

write a wsdl -> generate code -> apache cxf generates wsdl on the fly

Are there any switches where I can change this behavior?

Thanks

~Chris

2

2 Answers

0
votes

Please follow these steps:

  1. Create a folder META-INF/wsdl within your 'main/resources' an put your wsdl file and xsd files in it.
  2. Set the extraarg -wsdlLocation option of the cxf-codegen-plugin like this (see http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html and http://cxf.apache.org/docs/wsdl-to-java.html):

    <wsdlOptions>
      <wsdlOption>
        ...
        <extraargs>
          ...
          <extraarg>-wsdlLocation </extraarg>
          <extraarg>wsdl/yourfile.wsdl</extraarg>
          ...
        <extraargs>
      <wsdlOption>
        ...
    <wsdlOptions>
    
  3. Make sure, your wsdl and xsd are bundled within your jar. Should be done by default.

CXF should expose your file and not its generated one.

0
votes

I had the problems in publishing the original WSDL.

You can try this answer and let me know