来自客户
# SYNOPSIS
# linkInfo(requestHeader, linkInfoRequest)
#
# ARGS
# requestHeader RequestHeader - {urn:Map24Routing}RequestHeader
# linkInfoRequest LinkInfoRequest - {urn:Map24Routing}LinkInfoRequest
#
# RETURNS
# linkInfoResponse LinkInfoResponse - {urn:Map24Routing}LinkInfoResponse
#
requestHeader = linkInfoRequest = nil
puts obj.linkInfo(requestHeader, linkInfoRequest)
从映射注册表
EncodedRegistry.register(
:class => RequestHeader,
:schema_type => XSD::QName.new(NsMap24Routing, "RequestHeader"),
:schema_element => [
["map24ID", ["SOAP::SOAPString", XSD::QName.new(NsMap24Routing, "Map24ID")], [0, 1]],
["clientID", ["SOAP::SOAPString", XSD::QName.new(NsMap24Routing, "ClientID")], [0, 1]],
["requestID", ["SOAP::SOAPString", XSD::QName.new(NsMap24Routing, "RequestID")], [0, 1]],
["authenticationKey", ["SOAP::SOAPString", XSD::QName.new(NsMap24Routing, "AuthenticationKey")], [0, 1]],
["customerHashtable", ["ArrayOfCustomerKeyValuePair", XSD::QName.new(NsMap24Routing, "CustomerHashtable")], [0, 1]]
]
)
EncodedRegistry.register(
:class => LinkInfoRequest,
:schema_type => XSD::QName.new(NsMap24Routing, "LinkInfoRequest"),
:schema_element => [
["coordinate", ["Coordinate", XSD::QName.new(NsMap24Routing, "Coordinate")], [0, 1]],
["maxRoadType", ["SOAP::SOAPInt", XSD::QName.new(NsMap24Routing, "MaxRoadType")], [0, 1]],
["requestProperties", ["ArrayOfRequestProperty", XSD::QName.new(NsMap24Routing, "RequestProperties")], [0, 1]],
["routingServiceID", ["SOAP::SOAPString", XSD::QName.new(NsMap24Routing, "RoutingServiceID")], [0, 1]]
]
)
运行请求/响应
@client = Map24RoutingPortType.new
header = {:Map24ID => Map24Routing::MAP_24_ID}
request = {:Coordinate => {:Longitude => lng.to_f * 60, :Latitude => lat.to_f * 60}}
response = @client.linkInfo(header,request)
我已尝试过各种标头和请求值,并在错误之间切换
SOAP :: Mapping :: MappingError(无法将Hash映射到SOAP / OM。):
错误的数量
并且无法转换哈希
任何帮助将不胜感激,我不能使用savon,因为我在生产中出现了httpi错误
答案 0 :(得分:0)
事实证明,映射中的每个项目都是一个对象,您可以在
上调用new@client = Map24RoutingPortType.new
header = RequestHeader.new
header.map24ID = Map24Routing::MAP_24_ID
coordinate = Coordinate.new
coordinate.longitude = lng.to_f * 60
coordinate.latitude = lat.to_f * 60
request = LinkInfoRequest.new
request.coordinate = coordinate
response = @client.linkInfo(header,request)