0

I'm using wash-out gem (https://github.com/inossidabile/wash_out) for exposing a SOAP service.

Sample usage of wash-out documentation goes something like this:

# Params from XML attributes;
  # e.g. for a request to the 'AddCircle' action:
  #   <soapenv:Envelope>
  #     <soapenv:Body>
  #       <AddCircle>
  #         <Circle radius="5.0">
  #           <Center x="10" y="12" />
  #         </Circle>
  #       </AddCircle>
  #     </soapenv:Body>
  #   </soapenv:Envelope>
  soap_action "AddCircle",
              :args   => { :circle => { :center => { :@x => :integer,
                                                     :@y => :integer },
                                        :@radius => :double } },
              :return => nil, # [] for wash_out below 0.3.0
              :to     => :add_circle
  def add_circle
    circle = params[:circle]
    Circle.new(circle[:center][:x], circle[:center][:y], circle[:radius])

    render :soap => nil
  end

But my XML request has many nested arguments and I don't want to define mappings (:args) for each XML attribute. Is there any way to map the XML request (XSD) to a ruby hash into a form which is required as :args for the soap action.

  • 1
    It is very unclear what you are asking here. Chances are the answer is yes but you will need to clarify the question what part are you trying to map and what are you trying to map into? – engineersmnky Feb 20 '18 at 20:26
  • @engineersmnky The initial problem statement was ambiguous.I have edited it now. I want to map the XML request (XSD) to a ruby hash into a form which is required as :args for the soap action. – Raman Preet Singh Feb 21 '18 at 06:12

1 Answers1

0

I dont know any way to do that without mapping every nested attribute one by one to a ruby object, but you can try to use the xml-mapping gem and try to test what you want.