开发者

Ran wsdl2ruby.rb ... now what?

From client

# 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)

From Mapping registry

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_ty开发者_如何学JAVApe => 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]]
    ]
)

Running request/response

@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)

I have tried various values for header and request and alternate between errors

SOAP::Mapping::MappingError (Cannot map Hash to SOAP/OM.):

Wrong number of agruments

and can't convert hash

Any help would be appreciated, I cannot use savon because I get httpi errors on production


As it turns out each item in the mapping is an object you can call new on

@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) 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜