Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 806457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:14:46+00:00 2026-05-15T00:14:46+00:00

I have hard times using maven to generate my web service client. So please

  • 0

I have hard times using maven to generate my web service client. So please refer to Creating a web-service client directly from the source for the first part of my question.

To keep it simple and short, I want to go from here (a file in src/main/java) :

package com.example.maven.jaxws.helloservice;
   
import javax.jws.WebService;

@WebService
public class Hello {
     public String sayHello(String param) {
         return "Hello " + param;
     }
} 

to there :

/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.1.7-b01-
 * Generated source version: 2.1
 * 
 */
@WebServiceClient(name = "HelloService", targetNamespace = "http://helloservice.jaxws.maven.example.com/", wsdlLocation = "http://localhost:8080/test/")
public class HelloService extends Service {

    private final static URL HELLOSERVICE_WSDL_LOCATION;
    private final static Logger logger = 
         Logger.getLogger(com.example.wsimport.HelloService.class.getName());
    ...etc

using only 1 pom.xml file.

Please note the wsdlLocation set on the end.
The pom.xml file will probably use both maven-jaxws-plugin wsgen AND wsimport with some tricky configuration to achieve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T00:14:47+00:00Added an answer on May 15, 2026 at 12:14 am

    Assuming, you’re not going to try to use the generated stubs in the same project that you’re doing this in (which would create circular dependencies and be a bad idea…) then, yes, you can do something like this.

    The config is not all that tricky, in fact you’d kind of guessed it in your question but here goes:

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-wsdl</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>wsgen</goal>
                        </goals>
                        <configuration>
                            <sei><!-- fully qualified class name goes here --></sei>
                            <genWsdl>true</genWsdl>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generate-stubs</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <wsdlDirectory>target/jaxws/wsgen/wsdl</wsdlDirectory>
                            <wsdlFiles>                   
                                <wsdlFile><!-- class name goes here -->Service.wsdl</wsdlFile>
                            </wsdlFiles>
                            <!-- *** you need the next line to set the wsdlLocation in the generated stubs *** -->
                            <wsdlLocation>http://localhost:8080/test</wsdlLocation> 
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    

    Update – to package up the generated code into a jar I would use the maven-jar-plugin like so:

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>package-wsclient-jars</id>
                            <phase>package</phase>
                            <goals>
                                <goal>jar</goal>
                            </goals>
                            <configuration>
                                <classesDirectory>target/jaxws/<!-- rest of the path here, can't remember it right now --></classesDirectory>
                                <classifier>wsclient</classifier>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
    

    I’ve quickly pasted this from our config but our usage is a little different (as we zip up the wsdl files not the generated client but I believe this will get you pretty close). You’ll probably have to setup the version for the maven-jar-plugin if you’re not already using it – 2.3.1 seems to be the latest.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I intended to use JBoss-Maven-Plugin for hotdeployment of jars to JBoss. I have three
I have a page with a div that is dynamically filled using a paginator
Being new to Xcode and Objective-C I find it hard to get my head
I've got 2 applications using Core Data with a sqlite persistent store. I've got
Basically, I have a custom templated control with a custom data container class. When
I'm doing another Java project for my class. In this assignment, we have to
The question says it all. The specialty in my case is that the current
I need a way to store large-numbers of variously sized XML data in a
I'm looking for a way to calculate the age of a person, given their
I am new to R so I apologize if this is easy and straight

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.