http://www.perlmonks.org?node_id=335732

rob_au has asked for the wisdom of the Perl Monks concerning the following question:

I have come across a problem with SOAP::Lite and the employ of request headers which after much searching with Google, I now turn to the Monastery - Recently in my professional capacity I have had to create a SOAP interface for some web services which the company which I work for seeks to provide. This has been successfully implemented using Apache/mod_perl and SOAP::Lite and as part of the solution, ticket-based authentication, similar to that described in the SOAP::Lite guide (http://guide.soaplite.com), was employed to restrict access to particular methods. Using SOAP::Lite, a sample test client was developed in the following fashion:

use SOAP::Lite; my $client = SOAP::Lite ->uri('http://localhost/Service') ->proxy('http://localhost/web-service'); my $auth = $client->login( 'username', 'password' ); exit 1 if $auth->fault != 0; my $header = SOAP::Header->name( 'auth' => $auth->result ); my $response = $client->private_method( $header );

So far, everything is working fine - The requirements for this project called for access from other languages and to this end a web services definition language (WSDL) file was generated. Using this WSDL file, a client has successfully been generated using PHP that can access the web service without issue. However an issue was presented when the perl test client was updated to employ the WSDL - The updated client is thus:

use SOAP::Lite; my $client = SOAP::Lite ->service('http://localhost/Service.wsdl'); my $auth = $client->login( 'username', 'password' ); exit 1 if $auth->fault != 0; my $header = SOAP::Header->name( 'auth' => $auth->result ); my $response = $client->private_method( $header );

The problem with this updated client is that the added authentication header is encoded within the SOAP body rather than the SOAP header within the SOAP envelope. For example:

<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/enc +oding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encod +ing/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmln +s:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://w +ww.w3.org/1999/XMLSchema"> <SOAP-ENV:Body> <namesp3:private_method xmlns:namesp3="Service"> <auth xsi:type="xsd:string">aeee24d36fc6107947b0d7b5af8aff41</au +th> </namesp3:private_method> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

At this stage however, I am unsure whether this is an issue with my WSDL file or the limited WSDL 1.1 support offered by SOAP::Lite - Have any others come across any similar issues with WSDL support under SOAP::Lite? I would note that this problem is not present with the PHP version of the client which employs the same WSDL file.

(If there is sufficient interest, I can post the WSDL and the authentic service interfaces, however at this stage I am more interested in determining whether this is a known issue with regard to the WSDL implementation in SOAP::Lite)

 

perl -le "print unpack'N', pack'B32', '00000000000000000000001011001000'"