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'"


In reply to SOAP Headers, WSDL and SOAP::Lite by rob_au

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.