This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.



Less than 42 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding Web Service Call from Java  RSS feed

 
knpatel patel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

i am new to web services, i want to call a web service from a java file.

i have written code like this,

String wsdlURL = "http://localhost:8080/FRT/services/DataSyncService?wsdl";
String namespace = "http://spireline.com";
//String serviceName = "HelloWebService";
String serviceName = "DataSyncService";
QName serviceQN = new QName(namespace, serviceName);

ServiceFactory serviceFactory;
try {
serviceFactory = ServiceFactory.newInstance();
/* The "new URL(wsdlURL)" parameter is optional */
try {
Service service = serviceFactory.createService(new URL(wsdlURL), serviceQN);
DataSyncServiceService ds = (DataSyncServiceService) service.getPort(DataSyncServiceService.class);
System.err.println("DataSyncService Location Is " + ds.getDataSyncServiceAddress());
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

so will this code work?..let me know.. and tx
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you asking this question? You're in a position to try the code, we're not.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!