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

Hi

I am trying to convert some VB code into Perl Lite. It is simply taking some XML (within the strPayload) for processing.

My VB Code is ..
Dim Serializer As SoapSerializer30 Dim reader As SoapReader30 Dim Connector As SoapConnector30
'Target for soap message Const END_POINT_URL = "http://wdb_sqltest:8080/ssc/servlet/SUGSoap" Set Connector = CreateObject("MSSOAP.HttpConnector30") Set Serializer = CreateObject("MSSOAP.SoapSerializer30") Set reader = CreateObject("MSSOAP.SoapReader30") Connector.Property("EndPointURL") = END_POINT_URL Connector.Connect Connector.Property("SoapAction") = "uri:SystemUnion-Journal" Connector.BeginMessage Serializer.Init Connector.InputStream Serializer.StartEnvelope Serializer.SoapNamespace "xsi", "http://www.w3.org/1999/XMLSchema- +instance" Serializer.StartBody Serializer.startElement "Import","SystemUnion-Journal", , "m" Serializer.startElement "strPayload" Serializer.SoapAttribute "xsi:type", "", "xsd:string" Serializer.WriteString strPayload Serializer.endElement Serializer.endElement Serializer.EndBody Serializer.EndEnvelope Connector.EndMessage

I have got as far as the following, but cannot see how I pass in the XML and call a method to run it !!!

use SOAP::Lite; my ($soap); $soap = new SOAP::Lite; $soap->transport->proxy('http://wdb_sqltest:8080/ssc/servlet/SUGSoap') +; $soap->serializer->uri('http://www.w3.org/1999/XMLSchema-instance'); $soap->serializer->envprefix('xsi'); $soap->call(SOAP::Data->name('Import') ->attr({xmlns=>'xsi'}) => 'uri: +SystemUnion-Journal');

In total confusion
Dave

janitored by ybiC: Retitle from "SOAP::Lite" because one-word nodetitles hinder site search

Replies are listed 'Best First'.
Re: Convert VB code to perl and SOAP::Lite
by gellyfish (Monsignor) on Aug 23, 2004 at 12:13 UTC

    It might be useful to see an example of the actual SOAP envelope the server is expecting (or the WSDL file if that is appropriate.) However looking at your code (and then at the MSSOAP docs as I have mercifully avoided using it,) I would guess that the envelope is going to be something like (I exclude the SOAP namespace stuff for clarity):

    <Envelope> <Header /> <Body xmlns:m="urn:SystemUnion-Journal"> <m:Import> <m:strPayload> $strPayload </m:strPayload> </m:Import> </Body> </Envelope>
    And code that will generate this kind of envelope is:
    use SOAP::Lite +trace => 'all'; + my $uri = 'urn:SystemUnion-Journal'; + my $soap = SOAP::Lite->proxy('http://wdb_sqltest:8080/ssc/servlet/SUGS +oap'); $soap->uri('urn:SystemUnion-Journal'); $soap->autotype(0); + $soap->soapversion('1.1'); + $soap->serializer()->attr({}); + $soap->serializer()->namespaces({'http://schemas.xmlsoap.org/soap/enve +lope/' => undef}); + $soap->call(SOAP::Data->name('Import')->encodingStyle(undef)->attr({xm +lns => $uri}), SOAP::Data->name(strPayload => $strPayload));

    Hope that helps

    /J\