Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked


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 Accept: text/xml Accept: multipart/* Content-Length: 1210 Content-Type: text/xml; charset=utf-8 SOAPAction: +t <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:xsi=" +e" xmlns:SOAP-ENC="" xmlns:S +OAP-ENV="" xmlns:xsd="http:/ +/" SOAP-ENV:encodingStyle="http://schemas.xm" > <SOAP-ENV:Header > <DataExportHeader xmlns=" +" > <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=" +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: Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: " +st" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="" x +mlns:xsd="" xmlns:soap="http://schema"> <soap:Header> <DataExportHeader xmlns=" +"> <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=" +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 = " +"; my $proxy = "" +; 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' => ' +/' } ) ->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 => '' } ) => @parameter +s )->result;

Replies are listed 'Best First'.
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
    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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://737793]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2017-03-24 18:04 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (305 votes). Check out past polls.