NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Where to specify the URL for web service client

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
joe



Joined: 20 Feb 2009
Posts: 2

PostPosted: Fri Feb 20, 2009 1:56 am    Post subject: Where to specify the URL for web service client Reply with quote

Really easy question...

In NetBeans 6.5 I created a web service client using the wizard. When it prompted for the WSDL, I pointed it to a local WSDL file on my file system because the WSDL is shipped with an SDK that I am using and is not available via http. That all worked fine.

In a source file I right clicked to add a web service call, and it generated the code just fine.

But I can't figure out how to specify the web service's URL to make the call. Ideally I can do this from the code and not from a configuration file, but any help would be appreciated.

It's got to be simple, but google and I couldn't find it.

Thanks in advance...
Back to top
Manuel Mall
Posted via mailing list.





PostPosted: Fri Feb 20, 2009 6:07 am    Post subject: Where to specify the URL for web service client Reply with quote

See: https://jax-ws.dev.java.net/faq/index.html

((BindingProvider)proxy).getRequestContext().put(BindingProvider.ENDPOINT_AD
DRESS_PROPERTY, "...");

-----Original Message-----
From: joe [mailto:address-removed]
Sent: Friday, 20 February 2009 10:57 AM
To: address-removed
Subject: [nbj2ee] Where to specify the URL for web service client

Really easy question...



In NetBeans 6.5 I created a web service client using the wizard. When it
prompted for the WSDL, I pointed it to a local WSDL file on my file system
because the WSDL is shipped with an SDK that I am using and is not available
via http. That all worked fine.



In a source file I right clicked to add a web service call, and it generated
the code just fine.



But I can't figure out how to specify the web service's URL to make the
call. Ideally I can do this from the code and not from a configuration
file, but any help would be appreciated.



It's got to be simple, but google and I couldn't find it.



Thanks in advance...
Back to top
Jacek_Haraburda
Posted via mailing list.





PostPosted: Fri Feb 20, 2009 9:19 am    Post subject: Odp: Where to specify the URL for web service client Reply with quote

You should modify a litle generated code. Simple example:
remove annotation:
//@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/client/ClientService/ClienttService.wsdl")
private ClientService clientService = null;

//add method to initiate service:
private ClientService getClientService()
{
if (this.clientService == null)
{
this.clientService =
new ClientService("http://point.to.target.wsdl.location?WSDL", new QName("Client", "ClientService"));
}
return this.clientService;
}

And in generated "try catch":
my.package.ClientPortType port = getClientService().getClientBindingPort();


I have ws.property file with ws URLs placed in glassfish "config" directory (diferent on diferent enviroments (dev,test,production)),
new ClientService(this.getWsdlStorer().getServiceUrl("CLIENT_SERVICE"), new QName("Client", "ClientService"));

Regards
Jacek




"joe" <address-removed>
2009-02-20 02:56 Odpowiedz u
Back to top
joe



Joined: 20 Feb 2009
Posts: 2

PostPosted: Fri Feb 20, 2009 7:11 pm    Post subject: It Works Reply with quote

Thank you both. It's working now.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo