Savon: how to add container tag within body

148 views Asked by At

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>
1

There are 1 answers

1
j-dexx On BEST ANSWER

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

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