3

I am new to SOAP webservices. I have a WSDL file and an XSD file. I have to create webservice and its corresponding webservice client using maven.

I have imported the WSDL file in eclipse, it generates all the classes automatically and run the webservice. But I want to do same using maven project.

Please suggest steps that how can I achieve this?

Naqi
  • 252
  • 1
  • 2
  • 10
  • 1
    Have you tried googling first? https://www.google.pl/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=maven+generate+client+sources+from+wsdl especially heve you have perfect answer: http://stackoverflow.com/questions/3587982/which-is-the-best-mavens-plugin-to-generate-a-web-service-client – Andrzej Łach Nov 06 '16 at 17:05
  • Possible duplicate of [Which is the best maven's plugin to generate a Web Service Client?](https://stackoverflow.com/questions/3587982/which-is-the-best-mavens-plugin-to-generate-a-web-service-client) – SiKing Aug 11 '17 at 22:18

1 Answers1

0

You can use the cxf-apache-maven. Just set at your pom.xml file with the dependencies. Example:

<dependencies>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>3.1.6</version>
    </dependency>

    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>3.1.6</version>
    </dependency>
</dependencies>

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-codegen-plugin</artifactId>
        <version>3.1.6</version>

  <executions>
    <execution>
      <id>ID NAME</id>
      <phase>generate-sources</phase>
      <configuration>
          <sourceRoot>${project.build.directory}/generated/cxf</sourceRoot>
          <wsdlOptions>
            <wsdlOption>
                <wsdl>WSDL FILE LOCATION/URL</wsdl>
                <extraargs>
                <extraarg>-p</extraarg>
                <extraarg> DESTINATION PACKAGE </extraarg>
                </extraargs>
              </wsdlOption>
           </wsdlOptions>
         </configuration>
         <goals>
            <goal>wsdl2java</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

You can see another examples at the apache docs: http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html

Another option is use the jaxws-maven-plugin, is similar. glooge the both to find which better for your case.

felipe218
  • 3
  • 2