Ruby on rails 使用Savon gem格式化SOAP API时出现问题
我害怕这一天会到来。。处理SOAP API的 这对我来说是一个全新的领域,我用SAVON gem做了一些挖掘,但我似乎无法构建我的呼叫 基本上,我想做的是: 步骤1:调用API以检索最新的CallerVersion(API版本) 步骤2:使用最新的CallerVersion并向验证API发送第二个请求,以查看我的客户是否在有效的服务区域 这就是我想到的(但它会崩溃,燃烧得很厉害) 下面是GetLatestCaller调用的SOAP请求和响应文档Ruby on rails 使用Savon gem格式化SOAP API时出现问题,ruby-on-rails,soap,savon,Ruby On Rails,Soap,Savon,我害怕这一天会到来。。处理SOAP API的 这对我来说是一个全新的领域,我用SAVON gem做了一些挖掘,但我似乎无法构建我的呼叫 基本上,我想做的是: 步骤1:调用API以检索最新的CallerVersion(API版本) 步骤2:使用最新的CallerVersion并向验证API发送第二个请求,以查看我的客户是否在有效的服务区域 这就是我想到的(但它会崩溃,燃烧得很厉害) 下面是GetLatestCaller调用的SOAP请求和响应文档 POST /webservices/Custome
POST /webservices/CustomerManagement.asmx HTTP/1.1
Host: alarmadmin.alarm.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<Authentication xmlns="http://www.alarm.com/WebServices">
<User>string</User>
<Password>string</Password>
<TwoFactorDeviceId>string</TwoFactorDeviceId>
</Authentication>
</soap12:Header>
<soap12:Body>
<GetLatestCallerVersion xmlns="http://www.alarm.com/WebServices" />
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetLatestCallerVersionResponse xmlns="http://www.alarm.com/WebServices">
<GetLatestCallerVersionResult>int</GetLatestCallerVersionResult>
</GetLatestCallerVersionResponse>
</soap12:Body>
</soap12:Envelope>
POST/webservices/CustomerManagement.asmx HTTP/1.1
主机:alarmadmin.alarm.com
内容类型:应用程序/soap+xml;字符集=utf-8
内容长度:长度
一串
一串
一串
HTTP/1.1200ok
内容类型:应用程序/soap+xml;字符集=utf-8
内容长度:长度
int
以下是CheckCaller_V2请求和响应
POST /webservices/Validate.asmx HTTP/1.1
Host: alarmadmin.alarm.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<Authentication xmlns="http://www.alarm.com/WebServices">
<User>string</User>
<Password>string</Password>
<TwoFactorDeviceId>string</TwoFactorDeviceId>
</Authentication>
</soap12:Header>
<soap12:Body>
<CheckCoverage_v2 xmlns="http://www.alarm.com/WebServices">
<input>
<Address>
<Street1>string</Street1>
<Street2>string</Street2>
<SubCity>string</SubCity>
<City>string</City>
<SubState>string</SubState>
<State>string</State>
<Zip>string</Zip>
<CountryId>Canada</CountryId>
</Address>
<Network>Gsm</Network>
<Generation>FourG</Generation>
<CallerVersion>returned from GetLatestCaller call</CallerVersion>
</input>
</CheckCoverage_v2>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CheckCoverage_v2Response xmlns="http://www.alarm.com/WebServices">
<CheckCoverage_v2Result>NotChecked or FullCoverage or MostlyCovered or NoCoverage or Error or BadZip or PartialCoverage or NotSupported or NotOffered</CheckCoverage_v2Result>
</CheckCoverage_v2Response>
</soap12:Body>
</soap12:Envelope>
POST/webservices/Validate.asmx HTTP/1.1
主机:alarmadmin.alarm.com
内容类型:应用程序/soap+xml;字符集=utf-8
内容长度:长度
一串
一串
一串
一串
一串
一串
一串
一串
一串
一串
加拿大
Gsm
福格
从GetLatestCaller调用返回
HTTP/1.1200ok
内容类型:应用程序/soap+xml;字符集=utf-8
内容长度:长度
缺口、全覆盖、大部分覆盖、无覆盖、错误、坏压缩、部分覆盖、不支持或不提供
我是全新的肥皂在这里的任何援助将不胜感激。如果需要更多信息,请告诉我。请使用SOAP UI检查请求定义。在soapui中加载WSDL文件时,我能够得到以下信息。 在那之后,它变得相对容易跟随。看起来所有操作都有相同的头,所以我将创建一个
caller\u client=Savon.client(
wsdl:'https://alarmadmin.alarm.com/webservices/CustomerManagement.asmx?WSDL',
env_名称空间::soapenv,
名称空间_标识符::web,
soap_头:{
“web:身份验证”:{
“web:用户”:“xxxx”,
“web:密码”:“xxxxx”,
“web:TwoFactorDeviceId”:“xxx”
}
})
然后调用单独的操作就变成了
caller\u client.call(:获取最新的调用方版本)
如果要列出所有可能的操作,可以使用
caller\u client.operations
如果要将消息传递给单个操作,请使用以下格式
caller\u client.call(:从\u iccid获取\u modem\u serial\u,消息:{iccid:'xxxx'})
POST /webservices/Validate.asmx HTTP/1.1
Host: alarmadmin.alarm.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<Authentication xmlns="http://www.alarm.com/WebServices">
<User>string</User>
<Password>string</Password>
<TwoFactorDeviceId>string</TwoFactorDeviceId>
</Authentication>
</soap12:Header>
<soap12:Body>
<CheckCoverage_v2 xmlns="http://www.alarm.com/WebServices">
<input>
<Address>
<Street1>string</Street1>
<Street2>string</Street2>
<SubCity>string</SubCity>
<City>string</City>
<SubState>string</SubState>
<State>string</State>
<Zip>string</Zip>
<CountryId>Canada</CountryId>
</Address>
<Network>Gsm</Network>
<Generation>FourG</Generation>
<CallerVersion>returned from GetLatestCaller call</CallerVersion>
</input>
</CheckCoverage_v2>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CheckCoverage_v2Response xmlns="http://www.alarm.com/WebServices">
<CheckCoverage_v2Result>NotChecked or FullCoverage or MostlyCovered or NoCoverage or Error or BadZip or PartialCoverage or NotSupported or NotOffered</CheckCoverage_v2Result>
</CheckCoverage_v2Response>
</soap12:Body>
</soap12:Envelope>