Thread

Posted on Tue Jan 16 01:14:22 2007 by rohant
c-Gensym and s-gensym symbols in soap envelope
Hi All, I have a web service developed in perl-cgi using apache as web server. this web service is consumed with a manually generated wsdl file. the soap envelope that i receive when i tested it with one of the functions from web service contains c-gensym symbol in client request and s-gensym symbol in server response. i am stuck at this point and dont know what this symbol means and how to get over it. I tried with some things but no success yet.i am a new bee to perl as well as wsdl concept. one more thing if i modify the wsdl type element i.e the parameter of the method with s-gensym{\d} received in soap envelope the web service executed fine.but this wont be a solution i guess. can anyone help me out what i moght be doing wrong in wsdl file or in web service? your quick response would be highly appreciated as i already have consumed a lot of time on this. thanks in advance. Rohant
Direct Responses: 4040 | Write a response
Posted on Tue Jan 16 07:47:24 2007 by saramic in response to 4035
Re: c-Gensym and s-gensym symbols in soap envelope
I am no super user but as I understand SOAP::Lite has very little dependence on WSDL, ie there is no validation etc. I can only see it being used in a client to get an endpoint (the url of where to find the web service) and the names of the operations. This means that what you code in your server needs to be again hand crafted into the WSDL. That said, the WSDL is only handy for using code constructing tools to convert the WSDL into a code stub to consume the web service. These are available in Java and .NET and are very handy but I do not know of anything in PERL to do the same so again for all but the simplest of web services (ie where you just call a web service operation and get a response) you will need to hand code the client to match the WSDL and hopefully match the server. As for the "gensym" xml tags they are used whenever you do not provide a named tag using SOAP::Data. Here is an example
<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope ...> <soap:Body> <performOperation> <authentication> <username>fred</username> <password>pass</password> <authentication> <performOperation> </soap:Body> </soap:Envelope>
so you have a webservice with an operation "performOperation" that requires a username and password in an authentication tag. This would be generated as follows in a client (or server if that was the response)
return SOAP::Data->name(authentication => \SOAP::Data->value( SOAP::Data->name(username => 'fred')->type('string'), SOAP::Data->name(password => 'pass')->type('string'), ));
actually I lie a bit as the type directive will add an attribute to the appropriate tag along the lines of xsi:type="xsd:string". All the other things like operation name, envelope and body are handled by SOAP::Lite. Also to read in named parameters you need to do the following
package MyWebService # have to inherit from following to get SOAP envelope use base qw(SOAP::Server::Parameters); sub performOperation { my $envelope = pop; # the SOAP::SOM object is tacked onto the end # can get at the named parameters this way my $authentication = $envelope->dataof('/Enveloope/Body/[1]/authentication'); # or this way my $username = $envelope->dataof('/Enveloope/Body/[1]/authentication/username'); my $password = $envelope->dataof('/Enveloope/Body/[1]/authentication/password'); # and this is nonsensical but should be true soSomethingNow() if $username eq $authentication->value->{'username'} && $password eq $authentication->value->{'password'} }
Ok just another note, I have not tested the code but have pretty much copied it exactly from an application I have written. cheers Saramic
Direct Responses: 4076 | 4078 | Write a response
Posted on Thu Jan 18 07:40:45 2007 by rohant in response to 4040
Re: c-Gensym and s-gensym symbols in soap envelope
Thanks a ton Saramic, i got the error and fixed it thanks alot
Write a response
Posted on Thu Jan 18 09:34:14 2007 by rohant in response to 4040
Re: c-Gensym and s-gensym symbols in soap envelope
Hi All, once again troubling you all, if anyone could answer my query. i am catching errors on client side with response->fault i get the faultcode and faultstring correctly as in soap message and is logged but the faultdetail is not getting retrieved. the tcpdump of the application run shows the faultdetail as follows <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Application error</faultstring> <detail> <c-gensym5> <c-gensym6 xsi:type="xsd:string"> CONNECT ERROR FATAL: Password authentication failed for user "test". </c-gensym6> </c-gensym5> </detail> </soap:Fault> now the problem is how can i retreive the value of detail element i.e string "CONNECT ERROR FATAL: Password authentication failed for user 'test'. " as i want that also to be logged to error log but faultdetail returns undef/empty (i guess!) as its not a ref, i checked for ref. can any soap guru tell me the way to get it work Rohant
Write a response