Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

SOAP::Lite and SOAP-ENV

by Gangabass (Vicar)
on Jan 21, 2009 at 10:36 UTC ( #737793=perlquestion: print w/ replies, xml ) Need Help??
Gangabass has asked for the wisdom of the Perl Monks concerning the following question:

I need a way to remove SOAP-ENV from my SOAP request (and change it to just soap). So SOAP-ENV:Header will be soap:Header.

Here is my current request:

POST http://ews.expoexchange.com/RealTimeServices/export.asmx Accept: text/xml Accept: multipart/* Content-Length: 1210 Content-Type: text/xml; charset=utf-8 SOAPAction: http://expoexchange.com/realtimeservices/PullRegistrantLis +t <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instanc +e" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:S +OAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http:/ +/www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xm +lsoap.org/soap/encoding/" > <SOAP-ENV:Header > <DataExportHeader xmlns="http://expoexchange.com/realtimeservices/ +" > <HeaderShowCode >Code</HeaderShowCode> <HeaderUsername >User</HeaderUsername> <HeaderPassword >pass</HeaderPassword> <HeaderSQLEnvironment >PROD</HeaderSQLEnvironment> <PagedResultsPageSize >1</PagedResultsPageSize> <FTPUsername >ExhibInvites</FTPUsername> <FTPFileExportType >CSV</FTPFileExportType></DataExportHeader></SOAP-ENV:Header> <SOAP-ENV:Body > <PullRegistrantList xmlns="http://expoexchange.com/realtimeservice +s/" > <BeginDate >2007-01-12</BeginDate> <EndDate >2009-01-12</EndDate> <pageToken >10</pageToken> <currentPage >1</currentPage></PullRegistrantList></SOAP-ENV:Body></SOAP-ENV: +Envelope>

But i need this form:

POST /RealTimeServices/export.asmx HTTP/1.1 Host: ews.expoexchange.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://expoexchange.com/realtimeservices/PullRegistrantLi +st" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x +mlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schema +s.xmlsoap.org/soap/envelope/"> <soap:Header> <DataExportHeader xmlns="http://expoexchange.com/realtimeservices/ +"> <HeaderShowCode>string</HeaderShowCode> <HeaderUsername>string</HeaderUsername> <HeaderPassword>string</HeaderPassword> <HeaderSQLEnvironment>PROD or QA or DEV or RD</HeaderSQLEnvironm +ent> <PagedResultsPageSize>int</PagedResultsPageSize> <FTPUsername>string</FTPUsername> <FTPFileExportType>None or CSV</FTPFileExportType> </DataExportHeader> </soap:Header> <soap:Body> <PullRegistrantList xmlns="http://expoexchange.com/realtimeservice +s/"> <BeginDate>dateTime</BeginDate> <EndDate>dateTime</EndDate> <pageToken>string</pageToken> <currentPage>int</currentPage> </PullRegistrantList> </soap:Body> </soap:Envelope>

And here is my code:

#!/usr/bin/perl -w use strict; use SOAP::Lite +"trace"; my $uri = "http://expoexchange.com/realtimeservices/PullRegistrantList +"; my $proxy = "http://ews.expoexchange.com/RealTimeServices/export.asmx" +; my %info = ( HeaderShowCode => "Code", HeaderUsername => "User", HeaderPassword => "pass", HeaderSQLEnvironment => "PROD", PagedResultsPageSize => 1, FTPUsername => "User", FTPFileExportType => "CSV" ); my $client = SOAP::Lite ->on_action( sub { join '', @_; } ) ->readable(1) ->uri($uri) ->proxy($proxy); $client->autotype(0); my $HeaderShowCode = SOAP::Header->name( HeaderShowCode => $info{Heade +rShowCode} ); my $HeaderUsername = SOAP::Header->name( HeaderUsername => $info{Heade +rUsername} ); my $HeaderPassword = SOAP::Header->name( HeaderPassword => $info{Heade +rPassword} ); my $HeaderSQLEnvironment = SOAP::Header->name( HeaderSQLEnvironment => + $info{HeaderSQLEnvironment} ); my $PagedResultsPageSize = SOAP::Header->name( PagedResultsPageSize => + $info{PagedResultsPageSize} ); my $FTPUsername = SOAP::Header->name( FTPUsername => $info{FTPUsername +} ); my $FTPFileExportType = SOAP::Header->name( FTPFileExportType => $info +{FTPFileExportType} ); my $DataExportHeader = SOAP::Header->name('DataExportHeader') ->attr( { 'xmlns' => 'http://expoexchange.com/realtimeservices +/' } ) ->value(\SOAP::Header->value( $HeaderShowCode, $HeaderUsername +, $HeaderPassword, $HeaderSQLEnvironment, $PagedResultsPageSize, $FTP +Username, $FTPFileExportType )); my $BeginDate = SOAP::Data->name( BeginDate => "2007-01-12" ); my $EndDate = SOAP::Data->name( EndDate => "2009-01-12" ); my $pageToken = SOAP::Data->name( pageToken => "10" ); my $currentPage = SOAP::Data->name( currentPage => "1" ); my @parameters = ( $BeginDate, $EndDate, $pageToken, $currentPage, $Da +taExportHeader ); print $client->call( SOAP::Data->name('PullRegistrantList')->attr( { x +mlns => 'http://expoexchange.com/realtimeservices/' } ) => @parameter +s )->result;

Comment on SOAP::Lite and SOAP-ENV
Select or Download Code
Re: SOAP::Lite and SOAP-ENV
by Anonymous Monk on Jan 21, 2009 at 11:37 UTC
    I think you just need to upgrade SOAP::Lite.
Re: SOAP::Lite and SOAP-ENV
by Anonymous Monk on Apr 17, 2009 at 11:09 UTC
    I've had the same problem, and this was my solution:
        # It turns out that the SOAP-ENV and SOAP-ENC tags used by default
        # by SOAP::Lite are not agreeing with the customer's
        # API. That needs soapenv and soapenc tags. Therefore, we now will
        # fiddle with SOAP::Lite's constants. Isn't life great?
        $SOAP::Constants::PREFIX_ENV = "soapenv";
        $SOAP::Constants::PREFIX_ENC = "soapenc";
    
        my $soap = SOAP::Lite
          ->uri(SOAP_URL)
        ....
    
    and later on:
        # We've fiddled with SOAP::Lite's constants. As mod_perl might
        # keep these constants, we'd better be sure and change them back
        # before anyone else notices the changes... I've got a t-shirt at
        # home which says "I love SOAP::Lite", but I'm afraid to wear it.
        $SOAP::Constants::PREFIX_ENV = "SOAP-ENV";
        $SOAP::Constants::PREFIX_ENC = "SOAP-ENC";
    
    Cheers, Eelko de Vos

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://737793]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2015-07-03 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (51 votes), past polls