aspose file tools*
The moose likes Web Services and the fly likes XFIRE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "XFIRE" Watch "XFIRE" New topic
Author

XFIRE

Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

I'm using XFIRE, and i want to invoke my web service from a web browser. Can anybody tell me how ?

I am being able to view the WDSL file as the following: http://localhost:8080/WS/services/WebServiceTest?wsdl

But i want to invoke a method named example in this service, so what shall i do ?

Thanks,


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
You may be interested in JavaScript SOAP clients. Check the following links, or use Google:
http://www.ibm.com/developerworks/views/webservices/libraryview.jsp?search_by=Call+SOAP+Web+services+with+Ajax,+Part&type_by=articles
http://www.codeproject.com/KB/ajax/JavaScriptSOAPClient.aspx
Best wishes!
dhaval nagar
Greenhorn

Joined: Oct 20, 2008
Posts: 11
Hi,

run this code to test any XFire web serivce. Test is my service implementation class.

public class Test1 {

private static String serviceUrl = "http://localhost:8084/test-web-app1/services/Test";

public static void main(String[] args) throws Exception {
log("Client.main : Start...");
if (args.length > 0) {
serviceUrl = args[0];
}
Test1 client = new Test1();
log("Response from WEB SERVICE: " + client.callWebService("adsf"));
log("Client.main : End.");
}

public String callWebService(String name) throws Exception {

log("Client.main : Start...");
//Create a metadata of the service
Service serviceModel = new ObjectServiceFactory().create(Test.class);
log("callSoapServiceLocal(): got service model.");

//Create a proxy for the deployed service
XFire xfire = XFireFactory.newInstance().getXFire();
XFireProxyFactory factory = new XFireProxyFactory(xfire);

Test client = null;
try {
client = (Test) factory.create(serviceModel, serviceUrl);
} catch (Throwable e) {
e.printStackTrace();
log("WsClient.callWebService(): EXCEPTION: " + e.toString());
}

//Invoke the service
String serviceResponse = "";
try {
serviceResponse = client.test();
} catch (Exception e) {
log("Client.callWebService(): EXCEPTION: " + e.toString());
serviceResponse = e.toString();
}
log("Client.main : End. status = " + serviceResponse);

//Return the response
return serviceResponse;
}

public static void log(Object msg) {
System.out.println(msg.toString());
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XFIRE