I'm using SOAP::Lite in a client which consumes a SOAP service over which I have no control. Traditionally, I've used code like this:

my $response; eval { $response = $soap_handle->call('MyMethod', $security_token, $datagra +m); }}; if ($@) { print "Error: SOAP call died: $@. \n"; }

When the method doesn't call for any arguments, I just pass undef in $datagram, and it worked just fine, producing XML like this:

<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope blah blah blah> <soapenv:Header> <wsse:Security blah><blah>blah</blah></wsse:Security> </soapenv:Header> <soapenv:Body> <MyMethod xsi:nil="true" /> </soapenv:Body> </soapenv:Envelope>

Recently, the vendor has updated their web service, and they no longer accept the xsi:nil="true" attribute.

How can I suppress that nil attribute using SOAP::Lite, so that my tag looks more like this?

<soapenv:Body> <MyMethod/> </soapenv:Body>

No good deed goes unpunished. -- (attributed to) Oscar Wilde

In reply to Suppressing nil attribute in empty SOAP tag by ptum

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.