【问题标题】:3dCart API integration with rails23dCart API 与 rails2 的集成
【发布时间】:2013-07-13 07:10:51
【问题描述】:

我需要将我的 rails 2 应用程序与 3dCart API 集成。我想请求获取商店中的订单数量。 为此,我关注http://api.3dcart.com/cart.asmx?op=getOrderCount

我创建了以下 XML 文件

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <getOrderCount xmlns="http://3dcart.com/">
      <storeUrl>https://echtest3d.3dcartstores.com/</storeUrl>
      <userKey>MY API KEY</userKey>
    </getOrderCount>
  </soap:Body>

然后我将其发布如下

http = Net::HTTP.new("api.3dcart.com")
http.use_ssl = false
http.post("/cart.asmx", xml_file, {
               'Content-Type' => 'text/xml; charset=utf-8',
               'Content-Length' => "#{xml_file.length}",
               'SOAPAction' => 'http://3dcart.com/getOrderCount' })

我的问题是,响应虽然是

Net::HTTP OK 200 OK readbody=true

它包含以下错误节点:

error trying to get data from the store. Technical description: The remote name could not be resolved: 'https'

【问题讨论】:

    标签: ruby-on-rails xml api soap


    【解决方案1】:

    商店 URL 不应包含 https 前缀,它应该只是

    echtest3d.3dcartstores.com/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      • 2020-01-25
      • 2016-10-11
      • 2014-03-02
      • 2018-12-25
      • 2018-09-16
      相关资源
      最近更新 更多