Webservice EASLogin登录接口说明 原创
金蝶云社区-李杨0283
李杨0283
0人赞赏了该文章 1,895次浏览 未经作者许可,禁止转载编辑于2019年11月22日 16:17:02

 请确认调用方用的端口是eas具体实例的端口还是群集的端口,实例端口看“安全模式”,群集端口一定要用“高可用webservice方案技术方案(连接集群端口)”这种。   
  一,安全模式(只适用实例端口)注意:85版本以后实例端口不能是实例1
1)启用安全模式。修改eas\Server\eas\server\profiles\server1~N\config\webservice.propetties文件
     isRomoteLocate=false

2)修改参数后,webservice调用端需要把登录返回的session传过去,java调用示例如下,其它语言调用参考

  1.   EASLoginProxy  proxy =null;

  2.      WSContext context = null;

  3.       

  4.       //登录

  5.       proxy = new  EASLoginProxyServiceLocator().getEASLogin();

  6.       context= proxy.login("kdjgf", "",  "eas", "zs70sp5", "l2", 1);

  7.       //具体业务调用

  8.       String[][] vouchers= null;

  9.     WSGLWebServiceFacadeSrvProxy proxyWS= null;

  10.    

  11.      proxyWS = new  WSGLWebServiceFacadeSrvProxyServiceLocator().getWSGLWebServiceFacade();

  12.       //设置登录返回的session在soap头 "http://login.webservice.bos.kingdee.com"是固定的

  13.   ((Stub) proxyWS).setHeader("http://login.webservice.bos.kingdee.com","SessionId", context.getSessionId());

  14.    vouchers = proxyWS.getVoucher("001", "2008", "5", 0, 0);


  15.  

复制代码




其本质是,每次WEBSERVICE 访问,必须带上相关的 SessionID 信息,如下红字部分。系统将根据 SOAP头中的SessionID 信息,获取相关的上下文信息。

<SOAP-ENV:Envelopexmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:m0="http://com.kingdee.eas.base.btp.app.BTPManager/isPropOwner/parameter/promote">
   <SOAP-ENV:Header>
       <ns1:SessionId xmlns:ns1="http://login.webservice.bos.kingdee.com">ada894c0-8223-41dc-b816-61eb67dc38bd</ns1:SessionId>
   </SOAP-ENV:Header>
   <SOAP-ENV:Body>
       <m:isPropOwnerxmlns:m="http://com.kingdee.eas.base.btp.app.BTPManager/Service">
           <m0:bosTypeString>BF76D8D1</m0:bosTypeString>
           <m0:propName>id</m0:propName>
       </m:isPropOwner>
   </SOAP-ENV:Body>
< /SOAP-ENV:Envelope>



补充,donet/C#调用方式,部署私包sp_SOAPHead_forDoNet_V15.jar 路径:server/lib/sp

1).生成代理类,代理类中加入头信息变量定义

public KDSessionId SessionId;//头信息要与接口中的相对应


2). 代理类中在需要调用的方法上加上参数

[SoapHeader("SessionId")] //与类中定义的头同名


3).定义头信息类

///

   /// 头信息,需要与接口定义的头同名

   ///

   public class KDSessionId: SoapHeader

    {

       public string SessionId;//变量名与接口定义同名

    }

4).调用

WSGLWebServiceFacadeSrvProxyService webuser= new WSGLWebServiceFacadeSrvProxyService();

webuser.SessionId = new KDSessionId() {SessionId = wscontext.sessionId };

webuser.deleteVoucher("03.02","2016.01", "1", "1");



二,高可用webservice方案技术方案(适用集群端口和实例端口)1.启用安全模式。修改eas\Server\eas\server\profiles\server1~N\config\webservice.propetties文件
     isRomoteLocate=false

2.在服务端server-config.wsdd(路径:eas/server/deploy/eas.ear/web.war/WEB-INF, 如果缓存更新不及时,手动删除web的缓存目录/apusic/domains/server(1~N)/deploy/EAS/tmpfiles) 全局参数部分,添加scope的范围:

         <parameter name="scope"value="session"/>

,保证服务端返回设置jsessionid的cookie

3,

(java)

在webservice客户端调用处设置call.setMaintainSession(true); 保证axis自动携带cookie到服务端

注意,调用业务方法的时候就使用这个call,不要新建

例如:

         

  1. //调用登陆接口

  2.            Service s=new Service();

  3.            Call call=(Call)s.createCall();

  4.            call.setOperationName("login");

  5.            call.setTargetEndpointAddress("http://localhost:56898/ormrpc/services/EASLogin?wsdl");

  6.            call.setReturnType(new QName("urn:client","WSContext"));

  7.            call.setReturnClass(WSContext.class);

  8.            call.setReturnQName(new QName("","loginReturn"));

  9.            //超时

  10.            call.setTimeout(Integer.valueOf(1000*600000*60));

  11.            call.setMaintainSession(true);

  12.            //登陆接口参数

  13.            WSContext rs=(WSContext)call.invoke(new Object[]{"am", "", "eas", "bos80demo", "l2", Integer.valueOf(0)});

  14.            System.out.println(rs.getSessionId());

  15.            //清理

  16.            call.clearOperation();

  17.            //调用业务接口

  18.            call.setOperationName("addwuliao");

  19.            call.setTargetEndpointAddress("http://localhost:56898/ormrpc/services/WStettreeFacade");

  20.            //call.setReturnType(new QName("urn:lang.java","String"));

  21.            //call.setReturnClass(String.class);

  22.            call.setReturnQName(new QName("","addwuliaoReturn"));

  23.            call.setTimeout(Integer.valueOf(1000*600000*60));

  24.            call.setMaintainSession(true);

  25.            SOAPHeaderElement header=new SOAPHeaderElement("http://login.webservice.bos.kingdee.com","SessionId", rs.getSessionId());

  26.            call.addHeader(header);

  27.            //接口参数

  28.            String aa=(String)call.invoke(new Object[]{"callbianma", "callwuliaoName"} );

复制代码


(C#)

1.设置System.Net.ServicePointManager.Expect100Continue = false;2. 在登录接口和业务接口代理类的CookieContainner设置成同一个

如此会正常设置jsessionid,而ngnix,f5等负载均衡通过jsessionid做会话粘帖,可满足高可用方案。通过EAS的nap做负载均衡方案,通过nap自己设置的NAPRoutIDcookie做负载均衡转发,只需设置第二步即可。

  其他语言同理,保证2次请求的请求头Cookie里的JSESSIONID EASSESSIONID和NAPRoutID一致就能实现会话粘贴


三,接口参数说明
1.login(String userName, String password, String slnName,String dcName, String language, int dbType, String authPattern,int

  1. isEncodePwd)

  2. userName 用户名 ,

  3. password 密码 ,

  4. slnName eas,

  5. dcName 数据中心,

  6. language 语言 (l1,l2,l3),

  7. dbType 数据库类型(MS SQL Server:0,DB2 UDB:1,Oracle:2,MS SQL Server:3),

  8. authPattern 验证方式 默认 "BaseDB" ; 其他认证方式KEY可从easAuthPatterns.xml中获取 ,

  9. isEncodePwd  密码是否加密方式传递,0未加密,1加密

复制代码


2.login(String userName, String password, String slnName,String dcName, String language, int dbType, String authPattern)

  1. isEncodePwd 默认为0,不加密方式

复制代码


3.login(String userName, String password, String slnName,String dcName, String language, int dbType)

  1. authPattern验证方式 默认 "BaseDB"  ,isEncodePwd 默认为0,不加密方式

复制代码





其他:
客户端set-url.bat 端口设置成webserivce调用对应的实例或集群的端口一致,然后查询分析器执行服务端脚本,返回false就是成功启用了安全模式。否则失败,请检查安全模式的配置文件
com.kingdee.bos.webservice.WSConfig.getRomoteLocate()

 

赞 0