Hai All,
I am new to XFire WebService. I Created the WebService and deployed in
Tomcat. Now I will call the webservice from Normal Java Program. That
Program is need to creating webservice interface in client side. so how can
we call the webservice without creating webservice interface in client side.
Server is running on other machine.
My Client Program
============
package com.erights.xfire.userinfo;
import java.net.MalformedURLException;
import java.util.ArrayList;
import org.codehaus.xfire.XFire;
import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;
/**webservice client class
* Date 13/06/207
* author 150510
*/
public class ServiceClient {
/**Method callWebService -calling the webservice
* @param username
* @param password
* @exception MalformedURLException and Exception
*/
public void callWebService(String auserName, String apassword) throws
MalformedURLException,Exception
{
ArrayList serviceArray = new ArrayList();
// create a metadata of the service
Service oserviceModel = new
ObjectServiceFactory().create(IErightsService.class);
// create a proxy for the deployed service
XFire xfire = XFireFactory.newInstance().getXFire();
XFireProxyFactory factory = new XFireProxyFactory(xfire);
IErightsService client = null;
try
{
client = (IErightsService)
factory.create(oserviceModel,"http://10.230.142.27:8080/Service/services/Erights"
);
serviceArray = client.userAuthenticate(auserName, apassword);
System.out.println("UserValues"+serviceArray.toString());
}
catch (MalformedURLException e)
{
System.out.println("ServiceClient.callWebService():Exception:"+e.toString());
}
}
public static void main(String args[]){
ServiceClient sc = new ServiceClient();
try {
sc.callWebService("[EMAIL PROTECTED]","welcome123");
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
--
View this message in context:
http://www.nabble.com/Creating-Xfire-Client-tf3927677.html#a11138804
Sent from the XFire - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email