金蝶 EAS WebService 启动安全性后的调用方法

栏目:eas cloud知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

金蝶 EAS WebService 启动安全性后的调用方法

金蝶EAS WebService开启安全性后,调用方法代码

  1. 首先登录获取 SessionID

public static String login() throws ServiceException, RemoteException {
    EASLoginProxyServiceLocator locator = new EASLoginProxyServiceLocator();
    EASLoginProxy login = locator.getEASLogin();
    WSContext context = login.login("xxx", "xxx", "eas", "xxx", "L2", 1);
    return context.getSessionId();}123456


  1. 调用方法前,先获取SessionID

String sessionID = login();1


  1. 调用具体方面前,设置head头信息

((Stub) proxy).setHeader("http://login.webservice.bos.kingdee.com", "SessionId", sessionID);1


  1. 整合起来如下:

public static void testMaterial() throws RemoteException, ServiceException {
    String sessionID = login();
    WSMaterialWSFacadeSrvProxyService service = new WSMaterialWSFacadeSrvProxyServiceLocator();
    try {
        WSMaterialWSFacadeSrvProxy proxy= service.getWSMaterialWSFacade();
        ((Stub) proxy).setHeader("http://login.webservice.bos.kingdee.com", "SessionId", sessionID);
        System.out.println("materialInfo:" + wsFacade.getMaterialInfo());
    } catch (RemoteException | ServiceException e) {
        e.printStackTrace();
    }}1234567891011


  1. 引入的类/包名

import com.kingdee.eas.xxx.login.webservice.EASLoginProxy;import com.kingdee.eas.xxx.login.webservice.EASLoginProxyServiceLocator;import com.kingdee.eas.xxx.login.webservice.WSContext;import com.kingdee.eas.xxx.material.webservice.WSMaterialWSFacadeSrvProxy;import com.kingdee.eas.xxx.material.webservice.WSMaterialWSFacadeSrvProxyService;import com.kingdee.eas.xxx.material.webservice.WSMaterialWSFacadeSrvProxyServiceLocator;import org.apache.axis.client.Stub;1234567


  1. 需要的jar包
    在这里插入图片描述

  2. POM依赖

<dependencies>
  <dependency>
    <groupId>commons-beanutils</groupId>
    <artifactId>commons-beanutils</artifactId>
    <version>1.9.3</version>
  </dependency>
  <dependency>
    <groupId>commons-collections</groupId>
    <artifactId>commons-collections</artifactId>
    <version>3.2.1</version>
  </dependency>
  <dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
  </dependency>
  <dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.1.1</version>
  </dependency>
  <dependency>
    <groupId>net.sf.ezmorph</groupId>
    <artifactId>ezmorph</artifactId>
    <version>1.0.6</version>
  </dependency>
  <dependency>
    <groupId>net.sf.json-lib</groupId>
    <artifactId>json-lib</artifactId>
    <version>2.4</version>
    <classifier>jdk15</classifier>
  </dependency>
  <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
    <scope>test</scope>
  </dependency>
</dependencies>

金蝶 EAS WebService 启动安全性后的调用方法

金蝶EAS WebService开启安全性后,调用方法代码首先登录获取 SessionIDpublic static String login() throws ServiceException, RemoteEx...
点击下载文档
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息