3dCart API与rails2集成

时间:2013-07-15 12:08:44

标签: ruby-on-rails xml api soap

我需要将 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'

1 个答案:

答案 0 :(得分:3)

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

echtest3d.3dcartstores.com/