金蝶 EAS WebService 启动安全性后的调用方法
金蝶EAS WebService开启安全性后,调用方法代码
首先登录获取 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
调用方法前,先获取SessionID
String sessionID = login();1
调用具体方面前,设置head头信息
((Stub) proxy).setHeader("http://login.webservice.bos.kingdee.com", "SessionId", sessionID);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
引入的类/包名
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
需要的jar包
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...
点击下载文档
本文2024-09-16 22:52:03发表“eas cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-eas-50887.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章