savon调用WebService服务

来源:互联网 发布:淘宝店铺ip地址怎么查 编辑:程序博客网 时间:2024/05/24 06:49

查询手机号归属地
wsdl: http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?WSDL

require 'savon'client = Savon.client( wsdl:'http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?WSDL')puts client.methodsputs client.operations #查看可操作方法 #[:get_mobile_code_info, :get_database_info]#调用get_database_info方法,该方法可以获得国内手机号码归属地数据库信息。输入参数:无;返回数据:一维字符串数组(省份 城市 记录数量)client.call(:get_database_info).body获得国内手机号码归属地省份、地区和手机卡类型信息。输入参数:mobileCode = 字符串(手机号码,最少前7位数字),userID = 字符串(商业用户ID)免费用户为空字符串;返回数据:字符串(手机号码:省份 城市 手机卡类型)res = client.call(:get_mobile_code_info) do   message mobileCode:'xxxxx'end#ORres = client.call(:get_mobile_code_info,:message=>{:mobileCode=>"xxxx"})puts res.body
原创粉丝点击