I've figured out how to output raw XML into the SOAP envelope:
use strict;
use SOAP::Lite + "trace";
use SOAP::Transport::HTTP;
use Data::Dumper;
use XML::Simple;
my $serverinfo = {
version => ["0.1.dev"],
validTypes => [ filetype => "txt", filetype => "html", ],
statistics => {
documentsProcessed => [0],
},
};
sub FileQueue::getServerInfo {
return SOAP::Data->type(
'xml' => XML::Simple->new(RootName => 'info')->XMLout($ser
+verinfo)
)
;
}
my $daemon = SOAP::Transport::HTTP::Daemon
->new (LocalPort => 88)
->dispatch_to('FileQueue')
;
print "Contact to SOAP server at ", $daemon->url, "\n";
$daemon->handle;
Using the same client as before:
use strict;
use Data::Dumper;
use SOAP::Lite + "trace";
my $soap = SOAP::Lite
-> uri('http://www.perlmonks.org/FileQueue')
-> proxy('http://localhost:88')
;
$soap->readable(1);
print $soap->getServerInfo()->result;
It produces the following SOAP response:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instanc
+e" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:S
+OAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http:/
+/www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xm
+lsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<namesp1:getServerInfoResponse xmlns:namesp1="http://www.perlmonks
+.org/FileQueue">
<info>
<statistics>
<documentsProcessed>0</documentsProcessed>
</statistics>
<validTypes>
<filetype>html</filetype>
<filetype>txt</filetype>
</validTypes>
<version>0.1.dev</version>
</info>
</namesp1:getServerInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
This is closer to the real SOAP server response:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instanc
+e" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:S
+OAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http:/
+/www.w3.org/1999/XMLSchema" xmlns:pmq="http://www.perlmonks.org/FileQ
+ueue">
<SOAP-ENV:Body>
<pmq:getServerInfoResponse>
<info>
<version>0.1.dev</version>
<statistics>
<documentsProcessed>0</documentsProcessed>
</statistics>
<validTypes>
<filetype>txt</filetype>
<filetype>html</filetype>
</validTypes>
</info>
</pmq:getServerInfoResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
I am still trying to figure out how to get rid of the xmlns:namesp1="http://www.perlmonk.org/FileQueue" and the envelope headers.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|