Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

See Re: Suppressing nil attribute in empty SOAP tag and Re: I do not understand how to write a SOAP server. and switch away from SOAP::Lite :) because this is eew

#!/usr/bin/perl -- use strict; use warnings; use SOAP::Lite; my $param = SOAP::Data->type("xsd:string")->name( "EmptyEmptorIsEmpty" )->value( '' ); ## track down sub tag #~ use Devel::TraceCalls { Package => 'SOAP::Serializer' }; #~ SOAP::Serializer->envelope( method => 'DoThis', $param ); exit; my $soap = SOAP::Lite ->proxy( 'http://localhost/blah/DummyService', timeout => 0.00001, ); $soap->transport->add_handler("request_send", \&pp_dump ); $soap->serializer( MySerializer->new ); print pp( $soap->serializer()->envelope( method => 'DoThis', $param ), ), "\n\n"; $soap->call( 'DoThis', $param ); sub pp { use XML::Twig; open my($fh), '>', \my $str; no warnings 'newline'; XML::Twig->new( qw! pretty_print record ! )->parse( @_ )->print( $fh ); return $str; } sub pp_dump { { my $content = $_[0]->content(''); $_[0]->content( pp($content) ); } print $_[0]->as_string,"\n"; return; } BEGIN { package MySerializer; @MySerializer::ISA = 'SOAP::Serializer'; BEGIN { $INC{'MySerializer.pm'} = __FILE__; } my $closer = 'EmptyEmptorIsEmpty'; sub tag { my $self = shift; my $tag = shift; my $ret = $self->SUPER::tag( $tag, @_ ); if( $tag eq $closer and not $ret =~ m{</\Q$closer\E>$} ){ chop $ret; chop $ret; return "$ret></$closer>"; } return $ret; } 1; } __END__ POST http://localhost/blah/DummyService HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.714 Content-Length: 448 Content-Type: text/xml; charset=utf-8 SOAPAction: "#DoThis" <?xml version="1.0" encoding="UTF-8"?> <soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/enc +oding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns: +soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http:/ +/www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSche +ma-instance"> <soap:Body> <DoThis> <EmptyEmptorIsEmpty xsi:type="xsd:string"> </EmptyEmptorIsEmpty> </DoThis> </soap:Body> </soap:Envelope>

In reply to Re: SOAP-Lite Empty Strings by Anonymous Monk
in thread SOAP-Lite Empty Strings by JamesBrown

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others rifling through the Monastery: (4)
    As of 2014-11-29 10:11 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My preferred Perl binaries come from:














      Results (204 votes), past polls