WebServiceText.java 1.3 KB
package com.espeed.text;

import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;


public class WebServiceText {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		//String url = "http://115.29.230.132:88/webmailWebservice/userinfowebservice?wsdl";  
		String url="http://localhost:8088/espeedyxyInterface/YXYWebservice/yxycountwebservice?wsdl";
		//第一种
//        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();   
//        factory.setServiceClass(WebServiceWsdlInterface.class);  
//        factory.setAddress(url);  
//        WebServiceWsdlInterface client = (WebServiceWsdlInterface) factory.create();  
//        try {  
//            String a=client.sendWsdlWebService("bbs");
//            System.out.println(a);
//        } 
//        catch (Exception e){  
//           System.out.println("sa");  
//        }          
		//第二种
		JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); 
		org.apache.cxf.endpoint.Client client = dcf.createClient(url); 
		try {
			//第一个参数是要调用的方法名
			Object[] result= client.invoke("findcountwebmailhome","info","21gmail.com");
			//JSONObject json=JSONObject.fromObject(result);
			System.out.println(result[0].toString());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}