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

  • SEARCH
  • Home
  • 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 508653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:55:46+00:00 2026-05-13T06:55:46+00:00

Sorry I am asking the same question twice. I deployed the JAX-WS web service,

  • 0

Sorry I am asking the same question twice.

I deployed the JAX-WS web service, and consume it from my client code.
My requirement is,
how should I avoid building my client code (stubs) while relocating my JAX-WS web service from one place to another?

Thank you.

  • 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-13T06:55:46+00:00Added an answer on May 13, 2026 at 6:55 am

    If you are using Spring, you can create a helper bean for configuring your client (which is what I’ve done on a recent project):

    <bean name="exampleClient" class="com.lingoswap.ws.util.JaxWsClientFactoryBean">
        <property name="wsdlDocumentLocation" value="${exampleClient.wsdlDocumentLocation}" />
        <property name="namespaceURI" value="http://com.example/exampleClient" />
        <property name="localPart" value="ExampleService" />
        <property name="serviceEndpointInterface" value="com.example.ExampleServicePortType" />
    </bean>
    

    The parts between the ${…} are property placeholders, which means that the value is looked up from a properties file, which is specified by a PropertyPlaceholderConfigurer. An example of specifying the value looks as follows:

    ## Web Service WSDL locations
    exampleClient.wsdlDocumentLocation=http://www.example.com/exampleService?wsdl
    

    You can then modify the properties file (maybe ‘myapplication.properties’) to change the WSDL location as needed (even at runtime if you use a custom TargetSource with a ProxyFactoryBean) For what it’s worth, here is my implementation of a simple JaxWsClientFactoryBean (no automatic property modification support):

    package com.lingoswap.ws.util;
    
    import java.net.URL;
    import javax.xml.namespace.QName;
    import javax.xml.ws.Service;
    import org.springframework.beans.factory.FactoryBean;
    import org.springframework.beans.factory.InitializingBean;
    
    public class JaxWsClientFactoryBean implements FactoryBean, InitializingBean {
    
        private URL wsdlDocumentLocation;
        private Class<?> serviceEndpointInterface;
        private String namespaceURI;
        private String localPart;
    
        // derived from namespaceURI and localPart
        private QName serviceName;
    
        public void afterPropertiesSet() {    
            serviceName = new QName(namespaceURI, localPart);
        }
    
        public Object getObject() {
            Service service = Service.create(wsdlDocumentLocation, serviceName);
            Object port = service.getPort(serviceEndpointInterface);
            return port;
        }
        public Class<?> getObjectType() {
            return serviceEndpointInterface;
        }
        public boolean isSingleton() {
            return false;
        }
        public URL getWsdlDocumentLocation() {
            return wsdlDocumentLocation;
        }
        public void setWsdlDocumentLocation(final URL wsdlDocumentLocation) {
            this.wsdlDocumentLocation = wsdlDocumentLocation;
        }
        public Class<?> getServiceEndpointInterface() {
            return serviceEndpointInterface;
        }
        public void setServiceEndpointInterface(
            final Class<?> serviceEndpointInterface) {
            this.serviceEndpointInterface = serviceEndpointInterface;
        }
        public String getNamespaceURI() {
            return namespaceURI;
        }
        public void setNamespaceURI(final String namespaceURI) {
            this.namespaceURI = namespaceURI;
        }
        public String getLocalPart() {
            return localPart;
        }
        public void setLocalPart(final String localPart) {
            this.localPart = localPart;
        }
    }
    

    I decided to offer an answer, even though you’ve already answered your own question. Maybe you will find this advice useful. The good thing about using a FactoryBean-like implementation is that it can be reused for all of your web service clients and encapsulates the creation of the web services from their consumers. Your web tier or business tier objects will only depend on the SEI (service endpoint interface).

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

Sidebar

Related Questions

sorry for asking this dumb question i will try to explain as good as
Sorry for asking, but how do I access myFunction() from someFunction ()? <script> $(document).ready(function()
Sorry for asking a question about something I don't know much about, but I've
OK.. I am sorry for asking an often asked question once again, but I
sorry im a newbie, i dont know if i am asking the right question,
Sorry if im asking something stupid but please dont shoot me down! I have
I hate asking for code but I just can't seem to do the below
OK, I know that this has been asked previously, so please forgive me for
I have just learned Java in my college. However, in that I can just
I have a nomenclature to respect while performing some tasks against the Active Directory.

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.