Solved

How can I change the end point of a Web Service Client in NetBeans 6.1 at runtime?

Posted on 2008-10-16
11
1,855 Views
Last Modified: 2013-12-14
I am using NetBeans 6.1 to construct a console application using JAX-WS to generate code to consume a Web Service. How can I change the url of the end point for the web service at runtime? It would be preferable to be set in an xml configuration file.

Thanks in advance
0
Comment
Question by:Compmind
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 22784342
0
 

Author Comment

by:Compmind
ID: 22809183
I was able to change where it queries the web service but not from where it downloads the wsdl file
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 22809969
Didn't get you, Generally we change the end points when the server IP address is changed or when the same service available at different IP.

if the WSDL location and service location are generally same but they are not must to be same. Please clarify what changes you meant.
0
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 

Author Comment

by:Compmind
ID: 22825000
ok I want to be able at runtime to change the WSDL location and the service location both at the same time.
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 22827048
do u have the service hosted at multiple locations? if its the same WSDL then service location change will do.

Can you share some source code which has the wsdl location in it.

0
 

Author Comment

by:Compmind
ID: 22830452
This code will change the service location but not the WSDL location and the service is hosted at different locations(development and production)  but the locations cannot communicate with each other. So it wouldn't work if I can only change the service location because it would try to download the WSDL from the development location which is not accesible from the production location.
  private static void logOut(int sessionID){
          try {
             int sid = sessionID;
                com.ca.unicenterserviceplus.servicedesk.USDWebService service = new com.ca.unicenterserviceplus.servicedesk.USDWebService();
   com.ca.unicenterserviceplus.servicedesk.USDWebServiceSoap port = service.getUSDWebServiceSoap();
   ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPointURL);
//endPointURL is a string
      port.logout(sid);
        } catch (Exception ex) {
             ex.printStackTrace();
        }
   
  }

Open in new window

0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 22831821
you have used WSDL only for creation of Client stubs and thats it. I don't think it will download WSDL every time, once the stubs are created based on the endpoint (generally derived from WSDL , in your case you are overriding manually) the service will be invoked appropriately.

if u have to change the WSDL it self then u must recreated the stubs with the new WSDL.
0
 

Author Comment

by:Compmind
ID: 23692828
Well in netbeans it does download the WSDL I do not why but it does it

I get the following error

javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://192.168.10.71:8080/axis/services/USD_R11_WebService?WSDL. It failed with:

Connection timed out: connect.
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 23694108
Try opening the same link in browser and see

http://192.168.10.71:8080/axis/services/USD_R11_WebService?WSDL

it look like wsdl location  is incorrect.
0
 

Accepted Solution

by:
Compmind earned 0 total points
ID: 23712556
the wsdl location is correct. The thing is that this was generated while pointing to 192.168.10.71 and was installed on the server with ip 10.1.34.153 and they cannot see each other for security reasons for some reason it tries to download the WSDL from 192.168.10.71.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question