【发布时间】:2019-03-01 04:19:30
【问题描述】:
我有一个带有连接详细信息的 JDA 服务器。我必须从我的 python 程序连接到这个 JDA 服务器并执行 MOCA 命令。到目前为止,我已经搜索并没有找到任何相关文档。
找到了一些 jar 文件,但没有使用 python。我的 python 客户端应用程序必须连接到 JDA 并执行命令。
执行请求并获得会话密钥值。还使用 session-key 执行了命令,但输出没有得到反映。
调用此特定命令以使用请求正文作为登录。
<moca-request autocommit="True">
<environment>
<var name="USR_ID" value="super"/>
</environment>
<query>login user where usr_id = 'super' and usr_pswd = 'super'</query>
</moca-request>
我能够成功登录并得到响应
<?xml version="1.0" encoding="UTF-8"?>
<moca-response>
<session-id></session-id>
<status>0</status>
<moca-results>
<metadata>
<column name="usr_id" type="S" length="0" nullable="true"/>
<column name="locale_id" type="S" length="0" nullable="true"/>
<column name="addon_id" type="S" length="0" nullable="true"/>
<column name="cust_lvl" type="I" length="0" nullable="true"/>
<column name="session_key" type="S" length="0" nullable="true"/>
<column name="pswd_expir" type="I" length="0" nullable="true"/>
<column name="pswd_expir_dte" type="D" length="0" nullable="true"/>
<column name="pswd_disable" type="I" length="0" nullable="true"/>
<column name="pswd_chg_flg" type="O" length="0" nullable="true"/>
<column name="pswd_expir_flg" type="O" length="0" nullable="true"/>
<column name="pswd_warn_flg" type="O" length="0" nullable="true"/>
<column name="srv_typ" type="S" length="0" nullable="true"/>
<column name="super_usr_flg" type="O" length="0" nullable="true"/>
<column name="ext_ath_flg" type="O" length="0" nullable="true"/>
</metadata>
<data>
<row>
<field>SUPER</field>
<field>US_ENGLISH</field>
<field>3pl,WM,SEAMLES,3pl</field>
<field>10</field>
<field>;uid=SUPER|sid=b6698786-85dc-41ec-9e54-c0d8f99b5cbf|dt=jttyorn7|sec=ALL;Hz1biv4HuD_Uq3g.R9QtCfwjQ0</field>
<field null="true"></field>
<field null="true"></field>
<field>6008</field>
<field>0</field>
<field>0</field>
<field>0</field>
<field>DEVELOPMENT</field>
<field>1</field>
<field>0</field>
</row>
</data>
</moca-results>
</moca-response>
根据 xml 响应,我已将会话密钥设为;uid=SUPER|sid=b6698786-85dc-41ec-9e54-c0d8f99b5cbf|dt=jttyorn7|sec=ALL;Hz1biv4HuD_Uq3g.R9QtCfwjQ0并尝试执行命令。
这就是我执行命令的方式
<moca-request autocommit="True">
<environment>
<var name="USR_ID" value="super"/>
<var name="SESSION_KEY" value=";uid=SUPER|sid=b6698786-85dc-41ec-9e54-c0d8f99b5cbf|dt=jttyorn7|sec=ALL;Hz1biv4HuD_Uq3g.R9QtCfwjQ0"/>
<var name="LOCALE_ID" value="US_ENGLISH"/>
<var name="MOCA_APPL_ID" value="MYAPP"/>
</environment>
<query>
create record where table = 'alt_prtmst' and prtnum = 'TEST1' and alt_prtnum = 'TEST123' and alt_prt_typ = 'SAP' and prt_client_id = '----' </query>
</moca-request>
命令执行没有任何错误,我也得到了响应。
<?xml version="1.0" encoding="UTF-8"?>
<moca-response>
<session-id></session-id>
<status>0</status>
</moca-response>
但变化没有得到反映。
我还在查询中尝试了另一个 moca 命令..
<query>
list warehouses
</query>
即使它执行了如何取回准确的输出
【问题讨论】: