Skip to content

Instantly share code, notes, and snippets.

@mimosz
Created August 9, 2012 09:52
Show Gist options
  • Save mimosz/3302785 to your computer and use it in GitHub Desktop.
Save mimosz/3302785 to your computer and use it in GitHub Desktop.
Soap Client
# -*- encoding: utf-8 -*-
require 'savon'
client = Savon.client('http://interface.youruijin.com/RaybanCodeServer.php?wsdl')
code = "TES#{Time.now.to_i}"
response = client.request :rsync_code, body: {
code: code,
buydate: '2012-08-09 16:56:35',
channel: 1,
trade_id: '测试',
sku_id: '测试',
sku_name: '测试',
sku_memo: '测试',
name: '测试',
email: '测试@gmail.com',
province: '上海',
city: '上海',
zone: '徐汇',
address: '上海市徐汇区冠生园路',
postcode: '210021',
mobile: '15026706692',
phone: '55410398'
}
result = response.body[:rsync_code_response][:result]
if result.to_i == 0
puts code
else
message = response.body[:rsync_code_response][:message]
puts "错误[#{result}]:#{code},#{message}。"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment