Topic: Datanoise-actionwebserives – api method's parameter don’t map values

Datanoise-actionwebserives – API method's parameter and corresponding soap-body elements (xml tag) is not mapped as per its name, but its mapped according to the element order of soap-body. If order of elements in soap-body is changed then prameter’s value in api method will be changed, it is not mapped by variable name and soap-body’s element name. Example is as given below
Web services API:
class HelloMessageApi < ActionWebService::API::Base
  api_method :hello_message, :expects => [{:firstname=>:string},
{:lastname=>:string}], :returns => [:string]
class HelloMessageController < ApplicationController
web_service_api HelloMessageApi
web_service_dispatching_mode :direct
  wsdl_service_name 'hello_message'
  web_service_scaffold :invoke
  def hello_message(firstname, lastname)
    return "Hello "+ firstname +" "+lastname

I am calling my web services from soap client (Savon) as given bellow
<?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:xsd="" xmlns:sub="" xmlns:xsi="" xmlns:soapenv="">

Result from webservices is: Hello Smith Jone. But expected result was: Hello Jone Smith.

As you can see 1st  part of Body is <lastname>Smith</lastname> and 2nd part of Body is <firstname>John</firstname>
The Method- hello_message(firstname, lastname)- is called with wrong value . John as a lastname and Smith as firstname according to the element order appears in body.

Is it possible to map correct value corresponding to the variable’s name in method and xml’s tag element name in soap-body, irrespective of its order appears in the soap-body?

I am expecting the values to be mapped by variable's name and soap-body element's name,  for example, firstname = <firstname>John</firstname> and lastname = <lastname>Smith</lastname>.


Last edited by mukteshwar (2011-09-21 02:21:22)