Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^2: SOAP Server and XML

by Anonymous Monk
on Nov 28, 2007 at 02:06 UTC ( #653449=note: print w/replies, xml ) Need Help??

in reply to Re: SOAP Server and XML
in thread SOAP Server and XML

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 => [""], 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('') -> 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=" +e" xmlns:SOAP-ENC="" xmlns:S +OAP-ENV="" xmlns:xsd="http:/ +/" SOAP-ENV:encodingStyle="http://schemas.xm"> <SOAP-ENV:Body> <namesp1:getServerInfoResponse xmlns:namesp1="http://www.perlmonks"> <info> <statistics> <documentsProcessed>0</documentsProcessed> </statistics> <validTypes> <filetype>html</filetype> <filetype>txt</filetype> </validTypes> <version></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=" +e" xmlns:SOAP-ENC="" xmlns:S +OAP-ENV="" xmlns:xsd="http:/ +/" xmlns:pmq=" +ueue"> <SOAP-ENV:Body> <pmq:getServerInfoResponse> <info> <version></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="" and the envelope headers.

Replies are listed 'Best First'.
Re^3: SOAP Server and XML
by rppowell (Novice) on Nov 28, 2007 at 02:18 UTC
    Ugh, the message was posted when I wasn't logged in.
      It's kind pointless to use SOAP::Lite if you're going to inject raw XML :-)

      As I said, I don't have enough experience writing SOAP::Lite-based services with that level of control over serialisation, but I'd be quite sure it's possible.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://653449]
NodeReaper writes the same droll phrase again

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-04-20 01:27 GMT
Find Nodes?
    Voting Booth?