in reply to Re: Adding namespace in Method Response
in thread Adding namespace in Method Response
I had probably looked at that piece of code 4-5 times yet it didn't strike me as the relevant.
So I reviewed what POE is doing in the sub TransactionDone section in http://cpansearch.perl.org/src/APOCAL/POE-Component-Server-SOAP-1.14/lib/POE/Component/Server/SOAP.pm. I also looked at http://cookbook.soaplite.com/#changing%20method%20name%20in%20response including the discussion section and came up with the following cgi which worked perfectly.
use SOAP::Transport::HTTP; my $server = new SOAP::Transport::HTTP::CGI ->serializer(MySerializer->new) ->dispatch_to('Demo') ->handle(); BEGIN { package MySerializer; @MySerializer::ISA = qw/SOAP::Serializer/; sub envelope { $_[2] = SOAP::Data->name($_[2])->uri($_[0]->uri()) if +$_[1] =~ /^(?:method|response)$/; shift->SUPER::envelope(@_); } } package Demo; use SOAP::Lite; sub hi { return 'Hello'; }
After that got working perfectly I had to do the following to get it all working under mod_perl
1. Added a Location section as follows
2. Added the following in my startup handler<Location /session> Order Deny,Allow SetHandler perl-script PerlHandler SOAP::Apache </Location>
Currently the XML looks great under SOAP::Trace - will have more feedback tomorrow after the .Net client gives it a shot.package MySerializer; @MySerializer::ISA = qw/SOAP::Serializer/; sub envelope { $_[2] = SOAP::Data->name($_[2])->uri($_[0]->uri()) if $_[1] =~ + /^(?:method|response)$/; shift->SUPER::envelope(@_); } package SOAP::Apache; use SOAP::Transport::HTTP; my $server = SOAP::Transport::HTTP::Apache ->serializer(MySerializer->new) -> dispatch_to(... ... ...); sub handler { $server->handler(@_) } 1;
Again thanks a lot for guiding me.
|
|---|