rigyt
rigyt

Reputation: 2353

Savon: how to add container tag within body

A web service I want to use needs an outer tag to hold all body tags.

Like this:

   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.api.web.cg.igfs.xxx">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:Init>
         <request>
            <tid>SOME_ID</tid>

How can I add the enclosing request tag?

In Savon, client.call(:init, message: { tid: 'SOME_ID', .. }) generates:

   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://services.api.web.cg.igfs.xxx">
   <soapenv:Header/>
   <soapenv:Body>
      <ser:Init>
        <tid>SOME_ID</tid>

Upvotes: 0

Views: 147

Answers (1)

j-dexx
j-dexx

Reputation: 10406

You should just be able to add it at the top of your hash

client.call(:init, message: { request: { tid: 'SOME_ID', .. }})

Upvotes: 1

Related Questions