友情链接1:21点 足球投注 投注网 明升体育 hg0088 葡京赌场 网上赌球 诈金花 澳门金沙网址 澳门银河网址 澳门银河 澳门银河官网 银河官网 威尼斯人 澳门威尼斯人 澳门威尼斯人官网 威尼斯人官网 金沙 澳门金沙 澳门金沙官网 金沙官网 现金网 赌球网 全讯网 明升国际 足球开户 ******官网 ******网址 现金赌博 澳门现金网 ******官方网站

Java Webservice涔媂Fire鐨勫鎴风璋冪敤 | Mingo's Blog

Java Webservice涔媂Fire鐨勫鎴风璋冪敤

鏃堕棿锛2012骞03鏈12鏃浣滆咃細Mingo琚洿瑙備簡锛14,696 娆璇勮娆℃暟锛2

鍓嶉潰鎴戜滑璇村埌Java Webservice涔媂Fire寤虹珛鏈嶅姟鍣ㄧ锛岃繖閲屾垜浠湅鐪嬫庝箞鍦ㄥ鎴风璋冪敤Webservice鐨勪袱绉嶆柟寮
涓銆侀氳繃鏈嶅姟绔彁渚涚殑鎺ュ彛绫昏繘琛岃皟鐢ㄣ
浠g爜濡備笅锛

package com.xfire.client;

import java.net.MalformedURLException;
import java.util.List;

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;

import com.xfire.domain.Person;
import com.xfire.spring.IPersonService;

public class PojoInvokeClient {

  public static void main(String[] args) {
        Service serviceModel = new ObjectServiceFactory().create(IPersonService.class);
        XFire xfire = XFireFactory.newInstance().getXFire();
        XFireProxyFactory factory = new XFireProxyFactory(xfire);
        String serviceUrl = "http://127.0.0.1:8080/xfire/services/PersonService";
        IPersonService client = null;
        try {
              client = (IPersonService) factory.create(serviceModel, serviceUrl);
        } catch (MalformedURLException e) {
              System.out.println("Client call webservice has exception: "+ e.toString());
        }
        String result1 =client.sayHello("寮犱笁");
  }
}

浜屻佺洿鎺ラ氳繃url璋冪敤, 涓嶇敤瀹㈡埛绔彁渚涙帴鍙g被銆

package com.xfire.client;

import java.net.MalformedURLException;
import java.net.URL;

import org.codehaus.xfire.client.Client;

public class UrlInvokeClient {

  public static void main(String[] args) {
    Client client = null;
    try {
      client = new Client(new URL("http://127.0.0.1:8080/xfire/PersonService.ws?wsdl"));
      Object[] result1 = client.invoke("sayHello", new Object[] {"寮犱笁"});
      System.out.println(result1[0]);
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

 

澹版槑: 鏈枃閲囩敤 BY-NC-SA 鍗忚杩涜鎺堟潈 | Mingo's Blog
杞浇璇锋敞鏄庤浆鑷Java Webservice涔媂Fire鐨勫鎴风璋冪敤

鏍囩锛,,鍒嗙被锛Java缂栫▼