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

I'm new to SOAP::Lite and could use some help. I want to create a soap message containing an xml-file like this.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wkpb-stuf="http://www.vrom.nl/wkpb/stuf" xmlns:StUF="http://www.egem.nl/StUF/StUF0205" xmlns:wkpb="http://www.vrom.nl/wkpb0102" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> ..................content of xml file................... </soapenv:Body> </soapenv:Envelope>
The code I have thus far is:
use SOAP::Lite +trace => "all"; my $ser = SOAP::Serializer->new(); $ser-> register_ns ("http://www.egem.nl/StUF/StUF0205", "StUF"); $ser-> register_ns ("http://www.vrom.nl/wkpb0102", "wkpb"); $ser-> register_ns ("http://www.vrom.nl/wkpb/stuf", "wkpb-stuf"); my $method = SOAP::Data -> prefix ('wkpb-stuf') ; my $soap = SOAP::Lite -> serializer ($ser) -> readable (1) -> proxy ($ep) -> call ($method => SOAP::Data->type('xml' => $aanvraag)) ;
Resulting in the following:
<soap:Envelope xmlns:wkpb-stuf="http://www.vrom.nl/wkpb/stuf" xmlns:StUF="http://www.egem.nl/StUF/StUF0205" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wkpb="http://www.vrom.nl/wkpb0102" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <wkpb-stuf:c-gensym2> ..................content of xml file................... </wkpb-stuf:c-gensym2> </soap:Body> </soap:Envelope>
So I'm almost there but how can I get rid of the c-gensym2 elements? -- Henry

Replies are listed 'Best First'.
Re: SOAP::Lite and raw xml
by rhesa (Vicar) on Jun 29, 2007 at 19:23 UTC
    the c-gensym2 comes from your $method. There are a couple of ways to get rid of them. Choose the one that suits your needs.

    1. Give your method a name:
      my $method = SOAP::Data -> prefix ('wkpb-stuf') -> name( 'potato' ) ;
      This will generate a SOAPAction: "http://www.vrom.nl/wkpb/stuf#potato" header and the following soap body: <wkpb-stuf:potato>      aanvraag</wkpb-stuf:potato>
    2. Use a plain string as method name:
      my $soap = SOAP::Lite # ... ->call( potato => SOAP::Data->type( xml => $aanvraag );
      This will make a SOAPAction: "#potato" header and this soap body: <potato>      aanvraag</potato>

    I hope that gives you enough hints to solve your issue.