title: Using Savon and nokogiri to make a Soap Request
body: <p>A sample request that I am trying to make looks like this:</p>
  
  <pre><code>&lt;s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;s:Body&gt;
      &lt;GetList xmlns="http://tempuri.org/"&gt;
        &lt;listRequest i:type="b:NpsListRequest" xmlns:a="http://schemas.datacontract.org/2004/07/Services.List" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:b="http://schemas.datacontract.org/2004/07/Services.List.Strategies"&gt;
          &lt;a:id&gt;1&lt;/a:id&gt;         
        &lt;/listRequest&gt;
      &lt;/GetList&gt;
    &lt;/s:Body&gt;
  &lt;/s:Envelope&gt;
  </code></pre>
  
  <p>I can replicate that exactly, using Nokogiri, like so:</p>
  
  <pre><code>    builder = Nokogiri::XML::Builder.new do |xml|
        xml['s'].Envelope('xmlns:s' =&gt; "http://schemas.xmlsoap.org/soap/envelope/") {
          xml['s'].Body {
            xml.GetList('xmlns' =&gt; "http://tempuri.org/") {
              xml.listRequest('i:type' =&gt; "b:NpsListRequest", 'xmlns:a' =&gt; "http://schemas.datacontract.org/2004/07/Services.List", 'xmlns:i' =&gt; "http://www.w3.org/2001/XMLSchema-instance", 'xmlns:b' =&gt; "http://schemas.datacontract.org/2004/07/Services.List.Strategies") {
                xml['a'].id(1)
              }
            }
          }
        }
      end
  
      builder.to_xml
  </code></pre>
  
  <p>Then, I build my soap_client using Savon:</p>
  
  <pre><code>def soap_client
        soap_client = Savon.client(
          wsdl: "http://1.1.1.1/Api.svc?wsdl", #PLE
          headers: {"Authorization" =&gt;  "Basic"},
          basic_auth: ['user', 'password'],
          env_namespace: :soapenv,
          namespace_identifier: :ser,
          ssl_verify_mode: :none,
          log: true,
          :pretty_print_xml =&gt; true
      )
    end
  </code></pre>
  
  <p>Now, I need to make a <code>:get_list</code> call that looks like the above sample request.</p>
  
  <p><code>soap_client.operations</code> returns this:</p>
  
  <p><code>[:get_list]</code> So I know I'm authenticated and the client is working correctly.</p>
  
  <p>I can't figure out how to actually make the <code>:get_list</code> call.</p>
  
  <p>I would like something simple where I don't even have to use <code>Nokogiri</code> to build my own xml, like this:</p>
  
  <p><code>soap_client.call :get_list, message: {id =&gt; 1}</code></p>
  
  <p>But that doesn't seem to be a feasible solution. Any thoughts on how I can pass the XML I'm building using Nokogiri through to the <code>:get_list</code> call for my <code>soap_client</code>? I am open to other suggestions as well.</p>