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

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

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

    少年阿賓

    那些青春的歲月

      BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
      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方式調(diào)用WebService         
            RPCServiceClient serviceClient = new RPCServiceClient(); 
            Options options = serviceClient.getOptions(); 
            // 指定調(diào)用WebService的URL 
            EndpointReference targetEPR = new EndpointReference( 
                    "http://localhost:9090/universal/services/play"); 
            options.setTo(targetEPR); 
            // 指定方法的參數(shù)值 
            Object[] requestParam = new Object[] {"1024"}; 
            // 指定方法返回值的數(shù)據(jù)類型的Class對象 
            Class[] responseParam = new Class[] {String.class}; 
            // 指定要調(diào)用的getGreeting方法及WSDL文件的命名空間 
            QName requestMethod = new QName("http://localhost:9090/universal/services/play", "getPassengerInfos"); 
            // 調(diào)用方法并輸出該方法的返回值 
            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
    主站蜘蛛池模板: 亚洲男人的天堂久久精品| 国产精品怡红院永久免费| 亚洲精品天堂在线观看| 亚洲一区爱区精品无码| 在线不卡免费视频| ww4545四虎永久免费地址| 两个人日本免费完整版在线观看1| 亚洲精品无码少妇30P| 亚洲国产精品xo在线观看| 亚洲av永久无码精品表情包| 亚洲 小说区 图片区 都市| 成年人免费观看视频网站| 在线成人爽a毛片免费软件| 大地资源在线资源免费观看| 一区二区免费电影| 精品成人一区二区三区免费视频| 亚洲 日韩经典 中文字幕| 亚洲国产精品人久久电影| 亚洲永久永久永久永久永久精品| 久久精品国产亚洲AV不卡| 啊v在线免费观看| 国产免费观看视频| 四虎影院永久免费观看| 日韩激情淫片免费看| 四虎www免费人成| 在线看片人成视频免费无遮挡| 久久WWW免费人成人片| 91精品视频免费| 成人免费一级毛片在线播放视频| 最近2022中文字幕免费视频| 一级毛片全部免费播放| 无码人妻一区二区三区免费n鬼沢 无码人妻一区二区三区免费看 | 四虎影视永久免费观看网址| 国产美女无遮挡免费视频网站 | 狠狠亚洲婷婷综合色香五月排名| 亚洲精品天堂成人片?V在线播放| 免费一级一片一毛片| 亚洲Av无码乱码在线播放| 亚洲色偷拍区另类无码专区| 亚洲无码视频在线| 亚洲精品无码精品mV在线观看|