如何手工调用统一支付接口

-
-
2024-12-27

构造请求报文

先构造soap报文:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ctrl="http://ctrl.eipmp.shine.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <ctrl:executeMsg>
         <!--Optional:-->
         <arg0>A1B24BCC11358B5D</arg0>
         <!--Optional:-->
         <arg1><![CDATA[
         <ipmp>
  <head>
    <reference></reference>
    <busiCode>40025</busiCode>
  </head>
  <body>
    <submitWay>06</submitWay>
    <bankAccount>
      <bankCode>0500</bankCode>
      <bankAcct>boco001</bankAcct>
      <bankAcctName>交行01</bankAcctName>
      <currency>CNY</currency>
    </bankAccount>
    <stockAccount>
      <brokerCode>券商代码</brokerCode>
      <brokerName>券商名称</brokerName>
      <busiDeptCode>部门编码</busiDeptCode>
      <busiDeptName>部门名称</busiDeptName>
      <companyAcct>资金账号</companyAcct>
      <companyAcctPwd>zjmm</companyAcctPwd>
      <certType>01</certType>
      <certNo>350101196601208121</certNo>
    </stockAccount>
    <custName>客户名称</custName>
    <custAddress>客户地址</custAddress>
    <currFlag>0</currFlag>
    <operModel>1</operModel>
    <checkType>0</checkType>
    <reservationNo></reservationNo>
    <telphone>010-6392351</telphone>
    <mobile>15002000123</mobile>
    <email>jsthzd@qq.com</email>
    <address>通信地址</address>
    <postcode>363000</postcode>
    <smsNo>15002402421</smsNo>
    <extendBusiInfo></extendBusiInfo>
  </body>
</ipmp>
         ]]></arg1>
      </ctrl:executeMsg>
   </soapenv:Body>
</soapenv:Envelope>

arg0是连接用户的密码

arg1是要发送请求的报文

上面示例里面的是三方存管签约注册,可以替换成其他业务,比如银期余额查询

<ipmp>
  <head>
    <reference></reference>
    <busiCode>40002</busiCode>
  </head>
  <body>
    <submitWay>06</submitWay>
    <bankAccountNo>银行账号</bankAccountNo>
    <bankAccountName>银行账户户名<bankAccountName>
    <brokerCode>期货公司代码</brokerCode>
    <brokerName>期货公司名称</brokerName>
    <busiDeptCode>期货公司营业部代码</busiDeptCode>
    <busiDeptName>期货公司名称</busiDeptName>
    <stockAccountNo>资金账号</stockAccountNo>
    <stockAccountPwd>资金账户密码</stockAccountPwd>
    <currency>CNY</currency>
    <date>20241227</date>
    <certType>证件类型(35-统一社会信用代码,33-组织机构代码证)</certType>
    <certNo>证件号码</certNo>
  </body>
 </ipmp>

填充上述报文里的各要素,reference是唯一报文id,每次请求都要不一样,可以自己造一个

然后把上面这个报文替换到上面的soap报文里的arg1里面,注意要保留前后的<![CDATA[  报文填这里  ]]

使用http工具发送报文

使用http工具把soap报文用POST发送到统一支付的web地址

http://localhost:8280/EIpmpService/ws/EIpmpService_MessageCtrl

注意请求头要添加SOAPAction:"executeMsg"

比如使用curl,先把报文保存到文件40002.xml

# 先定位到报文目录,比如用户目录
cd ~
# 执行curl post报文
curl -X POST http://localhost:8280/EIpmpService/ws/EIpmpService_MessageCtrl \
     -H "Content-Type: text/xml; charset=utf-8" \
     -H "SOAPAction: \"executeMsg\"" \
     -d @40002.xml

目录