From: Tom S. <acc...@ze...> - 2007-04-27 09:46:44
|
Hi All, I posted a question to the mod_perl mailing list but it would be better served here. 8<-- snip -------------------- Im having some mod_perl2 wierdness. Im trying to run some SOAP requests and Im getting odd things happening. Is there any reason that I should be experiencing intermittant issues dispatching SOAP methods to my class? Sometimes the methods work fine and sometimes they don't. When they don't I get the error returned in a fault string: Failed to locate method (getSession) in class (TestSpace) at /usr/local/lib/perl5/site_perl/5.8.8/SOAP/Lite.pm line 2586. And then sometimes it all works perfectly. Ive tried boiling all this down to a simple test case. TestSpace.pm ------------ package MediaSpace; sub getSession { return 1; } 1; I would estimate that 50% of the requests fail. Im using Apache-2.2.4 PreforkMPM/Perl 5.8.8 with no threads support, and mod_perl-2.0.3. Any ideas would be welcomed at this point in time as Im out of ideas. Cheers, Tom 8<-- snip -------------------- I did some testing and found that the reason some of the requests and some didn't failed was because of the number of httpd processes. I cut those down and found that the problem was there all the time. After some more testing I found the solution by accident. I should probably explain what my setup is doing. /viewspace generates some HTML, which in turn loads a piece of Flash into the browser. This flash content once loaded, sends some SOAP calls to the server. It seems that the combination of running the handler to generate the HTML, followed quickly by the hander for the soap calls generates the conditions for this error. A little bit more testing and I found that slightly loading The webserver triggered this condition and once it was triggered any request to the soap handler failed. If I rename my MediaSpace folder, update the /viewspace handler and httpd.conf to reflect the change my /soap handler works perfectly. Is the /soap handler having some troubles processing the call dispatch if a folder of the same name exists in the same location? It certainly looks that way. Anyone else care to verify? My actual filestructure is like so: /webhome/MediaSpace.pm -> used to handle SOAP requests /webhome/MediaSpace/ViewSpace.pm -> mod_perl handler to generate HTML /webhome/MediaSpace/Media.pm -> media functions Some other files... . etc MediaSpace.pm ------------- package MediaSpace; sub getSession { return 1; } 1; My httpd.conf SOAP entry and mod_perl handler for the HTML generation: <Location /soap> SetHandler perl-script PerlResponseHandler Apache2::SOAP PerlSetVar dispatch_to '/webhome/' PerlSetVar options "compress_threshold => 1000" </Location> Debian on a 2.6 kernel Apache 2.2.4 (Prefork MPM) / Perl 5.8.8 (NO threads support) / mod_perl 2.03 SOAP::Lite v0.69 Apache2::SOAP v0.72 Cheers, Tom |
From: Tom S. <acc...@ze...> - 2007-05-08 10:26:03
|
Thanks for the reply. I am using SOAP::Lite under mod_perl, not CGI. Ive tried altering my SOAP requests but I still get this intermittant problem. I have used your SOAP requests as models and the problem continues. I have further updated my SOAP requests to include a full = URI as per the SOAP spec. I just tried it now and made two requests. The first failed...the = second worked. As you suggested I set 'MaxClients 1' in my httpd.conf. =20 Heres the trace... ------------------ HTTP-Trace-Version: 1.0 Generator: Charles/3.0.2 Method: POST Protocol-Version: HTTP/1.1 Protocol: http Host: echo.localhost File: /soap Remote-Address: 172.30.6.60 Client-Address: 127.0.0.1 Start-Time: 2007-05-08T10:46:56.250+01:00 Response-Time: 2007-05-08T10:46:56.471+01:00 End-Time: 2007-05-08T10:46:56.481+01:00 Request-Header-Size: 668 Response-Header-Size: 248 Request-Body-Size: 454 Response-Body-Size: 576 Request-Body-Decoded: false Response-Body-Decoded: false Request-Header:<<--EOF-1178618598002- POST /soap HTTP/1.1 Host: echo.localhost User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 Accept: application/x-shockwave-flash,text/xml,application/xml,application/xhtml+= xml ,text/html;q=3D0.9,text/plain;q=3D0.8,image/png,*/*;q=3D0.5 Accept-Language: en-us,en;q=3D0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=3D0.7,*;q=3D0.7 Keep-Alive: 300 Referer: http://echo.localhost/interface/interface.swf?spaceid=3D Content-type: text/xml; charset=3Dutf-8 SOAPAction: "http://echo.localhost/echo/getSession" Content-length: 454 Pragma: no-cache Cache-Control: no-cache --EOF-1178618598002- Response-Header:<<--EOF-1178618598002- HTTP/1.1 200 OK Date: Tue, 08 May 2007 09:45:42 GMT Server: Apache/2.2.4 (Unix) DAV/2 PHP/5.2.1 mod_apreq2-20051231/2.6.0 mod_perl/2.0.3 Perl/v5.8.8 Content-Length: 576 Content-Type: text/xml; charset=3Dutf-8 SOAPServer: SOAP::Lite/Perl/0.69 Expires: 0 Cache-Control: no-cache --EOF-1178618598002- Request-Body:<<--EOF-1178618598002- <?xml version=3D"1.0" encoding=3D"utf-8"?> <SOAP-ENV:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Bo= dy xmlns:ns1=3D"http://echo.localhost/echo"><ns1:getSession SOAP-ENV:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/"><cli= entid xsi:type=3D"xsd:string" /></ns1:getSession></SOAP-ENV:Body></SOAP-ENV:Envelope> --EOF-1178618598002- Response-Body:<<--EOF-1178618598002- <?xml version=3D"1.0" encoding=3D"UTF-8"?><soap:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" soap:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap=3D"http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap= :Faul t><faultcode>soap:Client</faultcode><faultstring>Failed to locate method (getSession) in class (echo) at /usr/local/lib/perl5/site_perl/5.8.8/SOAP/Lite.pm line 2587. </faultstring></soap:Fault></soap:Body></soap:Envelope> --EOF-1178618598002- << SECOND REQUEST A FEW MINS LATER Method: POST Protocol-Version: HTTP/1.1 Protocol: http Host: echo.localhost File: /soap Remote-Address: 172.30.6.60 Client-Address: 127.0.0.1 Start-Time: 2007-05-08T10:52:43.420+01:00 Response-Time: 2007-05-08T10:52:43.910+01:00 End-Time: 2007-05-08T10:52:43.910+01:00 Request-Header-Size: 668 Response-Header-Size: 248 Request-Body-Size: 454 Response-Body-Size: 889 Request-Body-Decoded: false Response-Body-Decoded: false Request-Header:<<--EOF-1178618598002- POST /soap HTTP/1.1 Host: echo.localhost User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3 Accept: application/x-shockwave-flash,text/xml,application/xml,application/xhtml+= xml ,text/html;q=3D0.9,text/plain;q=3D0.8,image/png,*/*;q=3D0.5 Accept-Language: en-us,en;q=3D0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=3D0.7,*;q=3D0.7 Keep-Alive: 300 Referer: http://echo.localhost/interface/interface.swf?spaceid=3D Content-type: text/xml; charset=3Dutf-8 SOAPAction: "http://echo.localhost/echo/getSession" Content-length: 454 Pragma: no-cache Cache-Control: no-cache --EOF-1178618598002- Response-Header:<<--EOF-1178618598002- HTTP/1.1 200 OK Date: Tue, 08 May 2007 09:51:29 GMT Server: Apache/2.2.4 (Unix) DAV/2 PHP/5.2.1 mod_apreq2-20051231/2.6.0 mod_perl/2.0.3 Perl/v5.8.8 Content-Length: 889 Content-Type: text/xml; charset=3Dutf-8 SOAPServer: SOAP::Lite/Perl/0.69 Expires: 0 Cache-Control: no-cache --EOF-1178618598002- Request-Body:<<--EOF-1178618598002- <?xml version=3D"1.0" encoding=3D"utf-8"?> <SOAP-ENV:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV=3D"http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Bo= dy xmlns:ns1=3D"http://echo.localhost/echo"><ns1:getSession SOAP-ENV:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/"><cli= entid xsi:type=3D"xsd:string" /></ns1:getSession></SOAP-ENV:Body></SOAP-ENV:Envelope> --EOF-1178618598002- Response-Body:<<--EOF-1178618598002- <?xml version=3D"1.0" encoding=3D"UTF-8"?><soap:Envelope xmlns:namesp1=3D"http://namespaces.soaplite.com/perl" xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" soap:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap=3D"http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><getS= essio nResponse xmlns=3D"http://echo.localhost/echo"><getSessionObject xsi:type=3D"namesp1:getSessionObject"><SessionMeta xsi:type=3D"namesp1:SessionMeta"><hash xsi:type=3D"xsd:string">2710c1b6d0001d394af973a96cb8252d</hash><uid xsi:type=3D"xsd:string">guest</uid><created xsi:type=3D"xsd:epoch">1178617889</created><poll xsi:type=3D"xsd:epoch">1178617889</poll><timeout xsi:type=3D"xsd:epoch">1178618489</timeout></SessionMeta></getSessionObje= ct></ getSessionResponse></soap:Body></soap:Envelope> --EOF-1178618598002- As you can see the SOAP request does not change. As I said before if I rename the folder (echo) to sometehing else = everything works perfectly. Cheers, Tom -----Original Message----- From: J=F6rg Prante [mailto:joe...@ne...]=20 Sent: 27 April 2007 21:26 To: Tom Shaw Subject: Re: [Soaplite-devel] bug: SOAP calls fail when folder with = thesame name as the dispatch_to location exists Hello, > When they don't I get the error returned in a fault string: > Failed to locate method (getSession) in class (TestSpace) at > /usr/local/lib/perl5/site_perl/5.8.8/SOAP/Lite.pm line 2586. This is typically an misconfigured SOAP client call, without namespace and incorrect or empty URI in SOAPAction. > Im using Apache-2.2.4 PreforkMPM/Perl 5.8.8 with no threads support, = and > mod_perl-2.0.3. Same here. > /viewspace generates some HTML, which in turn loads a piece of Flash = into > the browser. This flash content once loaded, sends some SOAP calls to = the > server. Do you really store your Perl modules right on your web server directory where your HTML is generated? This is a bad idea. > It seems that the combination of running the handler to generate the = HTML, > followed quickly by the hander for the soap calls generates the = conditions > for this error. A little bit more testing and I found that slightly loading > The webserver triggered this condition and once it was triggered any request > to the soap handler failed. Test with "MaxClients 1" in your httpd.conf and it will fail straight. You see the Apache children loading mod_perl resources during their lifecycles. > If I rename my MediaSpace folder, update the /viewspace handler and > httpd.conf to reflect the change my /soap handler works perfectly. Is = the > /soap handler having some troubles processing the call dispatch if a folder > of the same name exists in the same location? It certainly looks that = way. > > Anyone else care to verify? Please provide your SOAP client calls and/or SOMs. In particular, the SOAPAction header. It is impossible to verify without being able to reproduce. Here is my test scenario from what I could understand from your description. ll /var/www/cgi-bin/ drwxr-xr-x 2 apache apache 4096 27. Apr 21:41 Echo -rwx------ 1 apache apache 87 27. Apr 21:27 Echo.pm httpd.conf: ------------------- <Location /soaptest> SetHandler perl-script PerlResponseHandler Apache2::SOAP PerlSetVar dispatch_to '/var/www/cgi-bin/' PerlSetVar options "compress_threshold =3D> 1000" </Location> ------------------- Echo.pm: ------------------- package Echo; sub echo { my ($self, @args) =3D @_; return join(",", @args); } 1; ------------------- echoclient.pl: ------------------- #!/usr/bin/perl use SOAP::Lite +trace =3D> 'debug'; my $soap =3D SOAP::Lite ->readable(1) ->uri("urn:Echo") ->proxy("http://localhost/soaptest"); my $som =3D $soap->echo(SOAP::Data->name("whatToEcho"=3D>"Hello = World")); print "The response from the server was:\n".$som->result."\n"; ------------------- Invoking the SOAP client echoclient.pl gives: SOAP::Transport::HTTP::Client::send_receive: POST http://localhost/soaptest HTTP/1.1 Accept: text/xml Accept: multipart/* Accept: application/soap Content-Length: 506 Content-Type: text/xml SOAPAction: "urn:Echo#echo" <?xml version=3D"1.0" encoding=3D"UTF-8"?> <soap:Envelope=20 xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"=20 xmlns:soapenc=3D"http://schemas.xmlsoap.org/soap/encoding/"=20 xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"=20 soap:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/"=20 xmlns:soap=3D"http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <echo xmlns=3D"urn:Echo"> <whatToEcho xsi:type=3D"xsd:string">Hello World</whatToEcho> </echo> </soap:Body> </soap:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK Connection: close Date: Fri, 27 Apr 2007 20:14:28 GMT Server: Apache/2.2.4 (Fedora) Content-Length: 469 Content-Type: text/xml; charset=3Dutf-8 Client-Date: Fri, 27 Apr 2007 20:14:28 GMT Client-Peer: 127.0.0.1:80 Client-Response-Num: 1 SOAPServer: SOAP::Lite/Perl/0.69 <?xml version=3D"1.0" encoding=3D"UTF-8"?><soap:Envelope xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema" soap:encodingStyle=3D"http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap=3D"http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><echo= Respo nse xmlns=3D"urn:Echo"><s-gensym3 xsi:type=3D"xsd:string">Hello World</s-gensym3></echoResponse></soap:Body></soap:Envelope> The response from the server was: Hello World Fedora Core 6 Perl 5.8.8 SOAP::Lite 0.69 httpd 2.2.4 (prefork) mod_perl 2.0.3 Apache2::SOAP 0.72 |