demo for xsd:long, how soap::lite guesses and how to overcome with strings
#!/usr/bin/perl -- #~ 2013-07-29-04:13:45PDT by Anonymous Monk #~ perltidy -csc -otr -opr -ce -nibc -i=4 use strict; use warnings; use SOAP::Lite; Main( @ARGV ); exit( 0 ); sub Main { my $soap = SOAP::Lite -> uri('http://127.0.0.1/MyModule') -> proxy('http://127.0.0.1:1203'); $soap->transport->add_handler("request_send", \&pp_dump ); $soap->transport->add_handler("response_done", \&pp_dump ); my @data = SOAP::Data -> name(identifier => 24 ); push @data, SOAP::Data -> name(identifier => 2 ** 65 ); push @data, SOAP::Data -> name(identifier => 2 ** 84 )->type('xsd: +long'); push @data, SOAP::Data -> name(identifier => '9223372036854775807' + ); ## LONG! push @data, SOAP::Data -> name(identifier => do { use bigint; "".9 +223372036854775807;}, ); $soap->call( theMethod => \@data ); } sub pp_twig { use XML::Twig; open my($fh), '>', \my $str; no warnings 'newline'; XML::Twig->new(qw! pretty_print record !)->xparse(@_)->print( $fh +); return $str; } sub pp_dump { my $content = $_[0]->content(''); $_[0]->content( pp_twig($content) ); print $_[0]->as_string,"\n"; return; } __END__ POST http://127.0.0.1:1203 HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap User-Agent: SOAP::Lite/Perl/0.716 Content-Length: 822 Content-Type: text/xml; charset=utf-8 SOAPAction: "http://127.0.0.1/MyModule#theMethod" <?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> <theMethod xmlns="http://127.0.0.1/MyModule"> <soapenc:Array soapenc:arrayType="xsd:anyType[5]" xsi:type="soap +enc:Array"> <identifier xsi:type="xsd:int">24</identifier> <identifier xsi:type="xsd:float">3.68934881474191e+019</identi +fier> <identifier xsi:type="xsd:long">1.93428131138341e+025</identif +ier> <identifier xsi:type="xsd:long">9223372036854775807</identifie +r> <identifier xsi:type="xsd:long">9223372036854775807</identifie +r> </soapenc:Array> </theMethod> </soap:Body> </soap:Envelope>
My soap tips (I hate soap), SOAP::Lite is too much work, SOAP::Simple is less work (but its simple, when stuck go to XML::Compile::SOAP, more verbose, but you want verbose with SOAP ) ... its built on XML::Compile::SOAP/http://perl.overmeer.net/xml-compile/#doc , see my treasure trove of soap examples and lost knowledge,$soap->transport->add_handler("request_send", \&pp_dump );, http://cookbook.soaplite.com/, SOAP endpoint , Re^3: SOAP::Lite login setup, Re: I do not understand how to write a SOAP server., An XML Overview Towards Understanding SOAP, Re^3: SOAP::Lite and custom envelopes, The XML FIles: Understanding XML Namespaces, How to Call a .NET-based Web Service Using the SOAP::Lite Perl Library (don't use XML::Compile )
In reply to Re^3: Force integer to occupy 64 bits (bytes)
by Anonymous Monk
in thread Force integer to occupy 64 bits
by yuhang91
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |