myeclipse create webservice

来源:互联网 发布:phoneshop mac 编辑:程序博客网 时间:2024/06/06 00:57

1, 新建web service Project

 

2,新建webservice class

 

 

3 webservice client

package com.client;

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.webservice.IService;

public class Client {

 public static void main(String[] args) {
   Service srvcModel = new ObjectServiceFactory().create(IService.class);
   XFireProxyFactory factory = new XFireProxyFactory(XFireFactory.newInstance().getXFire());
   String helloWorldURL = "http://localhost:8080/WebService/services/Service";
   try
   {
    IService srvc = (IService)factory.create(srvcModel, helloWorldURL);
    String result = srvc.example("hello world");
    System.out.print(result);
   } catch (MalformedURLException e) {
    e.printStackTrace();
   }
 }

}

原创粉丝点击