将值从DB解析为SOAP API

时间:2018-06-21 06:49:34

标签: ruby-on-rails ruby api soap

所以我需要创建SOAP API字段,该字段将由数据库中的值填充。

路径就像env:Envelope/env:Body/n1:GetPaisOrderDataResponse/return/order_service_parts/item/services/item

从此处ORDER_SERVICE_PARTS.IS_DELIVERY_MATERIALS获得的数据库值

目前,我正在使用API​​和ruby代码,我的工作方式如下:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:ActionWebService">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:CheckDocument soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <user xsi:type="urn:PaisUserInfo">
            <!--You may enter the following 2 items in any order-->
            <password xsi:type="xsd:string">%PASSWORD%</password>
            <username xsi:type="xsd:string">%USERNAME%</username>
         </user>
         <order_id xsi:type="xsd:string">%ORDERID%</order_id>
      </urn:CheckDocument>
   </soapenv:Body>
</soapenv:Envelope>

从Ruby开始:

  def check_documet(user, registration_number, documents)
    authenticate_user(user, ACCESS_PARAMETERS[:check_documet][:controller], ACCESS_PARAMETERS[:check_documet][:action])
    pais_standard_answer = PaisStandardAnswer.new(:status => ERROR_STATUS)

    order = Order.find(registration_number)
      if is_delivery_materials = 1
        pais_standard_answer.status = "This #{registration_number} exists!"
      end

0 个答案:

没有答案