⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 axisclient.java

📁 java WebService 调用的一个demo
💻 JAVA
字号:
package com.fubao.testwsclient;

import java.net.MalformedURLException;

import org.codehaus.xfire.XFireFactory;
import org.codehaus.xfire.client.XFireProxyFactory;
import org.codehaus.xfire.service.Service;
import org.codehaus.xfire.service.binding.ObjectServiceFactory;

import com.fubao.testws.AxisHelloInterface;

public class AxisClient {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Service srvcModel = new ObjectServiceFactory().create(AxisHelloInterface.class);
		XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());
		String helloWorldURL = "http://localhost:8088/testAxis/services/Hello";
		try {
		   //HelloService srvc = ((HelloService) factory.create(srvcModel,helloWorldURL));
		   //String hellostring = ((HelloService) factory.create(srvcModel,helloWorldURL)).sayHello("lifubao");
          // System.out.println(hellostring);
		   /*System.out.println(srvc.sayHello("Robin"));  
		   User u=new User();
		   u.setName("RRRRR");
	       Course c=srvc.choose(u);
		   System.out.println(c.getName());
		   List al=new ArrayList();
		   al.add("1212");
		   al.add("2222");
		   List t=srvc.test(al);
		   for (int i = 0; i < t.size(); i++) {
		       Course co=(Course)t.get(i);
		       System.out.println(co.getName());
	       }		  */ 
           AxisHelloInterface hello = (AxisHelloInterface) factory.create(srvcModel,helloWorldURL);
           System.out.println(hello.sayHello("fubaohello"));
           
	    } catch (MalformedURLException e) {
		   e.printStackTrace();
        }
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -