<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    少年阿賓

    那些青春的歲月

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
    //方法一:
    package com.abin.lir.axis2.client;
    import org.apache.axiom.om.OMAbstractFactory;
    import org.apache.axiom.om.OMElement;
    import org.apache.axiom.om.OMFactory;
    import org.apache.axiom.om.OMNamespace;
    import org.apache.axis2.AxisFault;
    import org.apache.axis2.addressing.EndpointReference;
    import org.apache.axis2.client.Options;
    import org.apache.axis2.client.ServiceClient;
    public class UserClient {
    public static void main(String[] args) {
    try { 
    ServiceClient sc = new ServiceClient(); 
    Options opts = new Options(); 
    opts.setTo(new EndpointReference("http://localhost:9090/universal/services/play")); 
    opts.setAction("urn:echo"); 
    opts.setTimeOutInMilliSeconds(10000);
    sc.setOptions(opts); 
    OMElement res = sc.sendReceive(createPayLoad()); 
    System.out.println(res); 
    } catch (AxisFault e) { 
    e.printStackTrace(); 
    }
    public static OMElement createPayLoad(){ 
    OMFactory fac = OMAbstractFactory.getOMFactory(); 
    OMNamespace omNs = fac.createOMNamespace("http://localhost:9090/universal/services/play", "nsl"); 
    OMElement method = fac.createOMElement("getPassengerInfos",omNs); 
    OMElement value = fac.createOMElement("userID",omNs); 
    value.setText("1024"); 
    method.addChild(value); 
    return method; 
    }





    //方法二
    package com.abin.lir.axis2.client;
    import javax.xml.namespace.QName;
    import org.apache.axis2.AxisFault;
    import org.apache.axis2.addressing.EndpointReference;
    import org.apache.axis2.client.Options;
    import org.apache.axis2.rpc.client.RPCServiceClient;
    public class RPCClient {
    public static void main(String[] args) throws AxisFault {
     // 使用RPC方式調用WebService         
            RPCServiceClient serviceClient = new RPCServiceClient(); 
            Options options = serviceClient.getOptions(); 
            // 指定調用WebService的URL 
            EndpointReference targetEPR = new EndpointReference( 
                    "http://localhost:9090/universal/services/play"); 
            options.setTo(targetEPR); 
            // 指定方法的參數值 
            Object[] requestParam = new Object[] {"1024"}; 
            // 指定方法返回值的數據類型的Class對象 
            Class[] responseParam = new Class[] {String.class}; 
            // 指定要調用的getGreeting方法及WSDL文件的命名空間 
            QName requestMethod = new QName("http://localhost:9090/universal/services/play", "getPassengerInfos"); 
            // 調用方法并輸出該方法的返回值 
            try {
    System.out.println(serviceClient.invokeBlocking(requestMethod, requestParam, responseParam)[0]);
    } catch (AxisFault e) {
    e.printStackTrace();
    }
    }




    //方法三
    package com.abin.lir.axis2.client;
    import org.apache.axiom.om.OMAbstractFactory;
    import org.apache.axiom.om.OMElement;
    import org.apache.axiom.om.OMFactory;
    import org.apache.axiom.om.OMNamespace;
    import org.apache.axis2.Constants;
    import org.apache.axis2.addressing.EndpointReference;
    import org.apache.axis2.client.Options;
    import org.apache.axis2.client.ServiceClient;
    public class AXIOMClient {
    private static EndpointReference targetEPR = new EndpointReference(
    "http://localhost:9090/universal/services/play");
    public static OMElement getPassengerInfos(String symbol) {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace(
    "http://localhost:9090/universal/services/play",
    "tns");
    OMElement method = fac.createOMElement("getPassengerInfos", omNs);
    OMElement value = fac.createOMElement("userID", omNs);
    value.addChild(fac.createOMText(value, symbol));
    method.addChild(value);
    return method;
    }
    public static void main(String[] args) {
    try {
    OMElement getPassenger = getPassengerInfos("1024");
    Options options = new Options();
    options.setTo(targetEPR);
    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
    ServiceClient sender = new ServiceClient();
    sender.setOptions(options);
    OMElement result = sender.sendReceive(getPassenger);
    String response = result.getFirstElement().getText();
    System.err.println("Current passengers: " + response);
    } catch (Exception e) {
    e.printStackTrace();
    }
    }
    }
    posted on 2013-01-20 23:26 abin 閱讀(9313) 評論(0)  編輯  收藏 所屬分類: AXIS2
    主站蜘蛛池模板: 色欲国产麻豆一精品一AV一免费| 蜜臀AV免费一区二区三区| 18成禁人视频免费网站| 成人免费无码精品国产电影| 亚洲处破女AV日韩精品| 亚洲kkk4444在线观看| 香蕉免费一级视频在线观看| 日本免费xxxx| 久久久久噜噜噜亚洲熟女综合 | 亚洲av午夜福利精品一区| 亚洲国产日韩精品| 你懂的网址免费国产| 大学生一级特黄的免费大片视频| 国产亚洲婷婷香蕉久久精品| 亚洲1区2区3区精华液| 18禁美女黄网站色大片免费观看 | 午夜不卡久久精品无码免费| 可以免费观看一级毛片黄a| 亚洲精品国产福利在线观看| 一个人免费观看www视频| 免费电影在线观看网站| 亚洲AV无码久久精品蜜桃| 黄网站色视频免费观看45分钟| 国产高清免费视频| 久久久久久久综合日本亚洲| 婷婷国产偷v国产偷v亚洲| 中文字幕无码播放免费| 亚洲国产三级在线观看| 青草青草视频2免费观看| 无码中文字幕av免费放| 亚洲一区二区电影| 8888四色奇米在线观看免费看| 亚洲精品无码你懂的网站| 亚洲中文字幕久久精品无码A| 免费黄色一级毛片| 亚洲国产片在线观看| 国产精品免费大片| 国产亚洲精品拍拍拍拍拍| 色偷偷亚洲第一综合| 好男人视频在线观看免费看片| 亚洲最大视频网站|