zoukankan      html  css  js  c++  java
  • delphi调用java编写的webservice

      delphi调用java编写的webservice
     
    JAVA
    pojo:

    public class GroupInfo implements Serializable{
        private static final long serialVersionUID = 7646885719123155790L;
        private int groupId;        //组id
        private String groupName;    //组名称
        private int parentGroupId;    //上级组id
    }

    方法:

    public List<GroupInfo> getAllGroupInfo(String username, String password) {
        IQueryDao queryDao = new QueryDaoImpl();
        int policyid = queryDao.getDefaultPolicyID(username, password);
        if (policyid==0)
            return new ArrayList<GroupInfo>();
        else
            return queryDao.getAllGroupInfo(policyid);
    }

    说明:传入用户名密码,返回一个list,里面的对象是类GroupInfo的实例。

    .

    .

    Delphi
    File-->New-->Other-->WebServices-->WSDL Importer,
    wsdl source填写http://192.168.1.174:8080/reservices/services/res_query?wsdl,确定后,自动生成了webserive的访问代码,文件名为res_query.pas

    调用代码如下:

    procedure TForm1.Button2Click(Sender: TObject);
    var
      I: Integer;
      service: res_queryPortType;
      arr: ArrayOfGroupInfo;
    begin
      service := Getres_queryPortType(true, 'http://192.168.1.174:8080/res_services/services/res_query?wsdl',nil);
      arr := service.getAllGroupInfo('admin', 'admin');
      memo1.Lines.Clear;
      for I := 0 to Length(arr) do
      begin
        try
          memo1.Lines.Add(arr[I].groupName);
        except
        end;
      end;
    end;

    本例在MyEclipse6.5, XFire1.2, Delphi7下测试通过。

    Delphi 调用Java 写的WebSevice

    无特殊要求,只要能得到wsdl,你可以先在IE里头访问一下试试。
    所有的字符参数全部要用widestring

     
  • 相关阅读:
    js中BOM和DOM的区别
    正则表达式
    第一个网页
    RegExp
    pseudoclasses&伪元素
    自我介绍
    DOM document 对象
    神经网络学习小节
    果然是神经网络
    果然是实践出真知啊
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/3292018.html
Copyright © 2011-2022 走看看