Loading ...
Sorry, an error occurred while loading the content.

4406translating soap call to perl::lite

Expand Messages
  • psaleh2000
    Feb 9, 2005
      I have the XML format of a soap call that I need to include in a
      perl script. But reverse engineering doesn't seem to lead me to the
      same format message. Are there any tools that could do this??

      In case anyone is feeling helpful, I'll include the XML that I'm
      trying to recreate, and the perl script I'm atempting to write to do
      it. The tags with **<>** around them shouldn't be there and I can't
      figure out why they are!! (very frustrating)

      <?xml version="1.0" encoding="UTF-8" ?>
      - <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-
      instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-
      ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      - <SOAP-ENV:Body>
      - <ImportDocument
      xmlns="http://www.proactis.com/proactis/webservice">
      - <DocumentXML>
      - <pro:Import
      xmlns:pro="http://www.proactis.com/proactis/webservice">
      <pro:Control UserName="blah" Version="1.0.0" Password="blah"
      Database="PROACTIS_TEST" Company="KBCFP"
      xmlns:pro="http://www.proactis.com/xml/xml-ns" />
      **</pro:Import>**
      - **<pro:Import
      xmlns:pro="http://www.proactis.com/proactis/webservice">**
      - <pro:Items xmlns:pro="http://www.proactis.com/xml/xml-ns">
      - <pro:Item UnitOfMeasure="EACH" ItemCurrency="USD"
      CanChangePrice="YES" CanChangeDescription="YES" ACTION="STORE"
      DefaultPrice="20.00" Active="YES" SingleSupplierItem="NO"
      PROACTISCode="SALEHABC" Description="Some Stuff" RowNumber="4">
      - <pro:ItemCompanyGroups>
      <pro:ItemCompanyGroup ItemGroup="HW\HPST" SequenceNo="4" />
      </pro:ItemCompanyGroups>
      </pro:Item>
      - <pro:ItemNominals>
      <pro:ItemNominal AccountingElement2="3600"
      AccountingElement1="ABC" DefaultNominal="YES" IsExpenseAccount="YES"
      ACTION="STORE" Description="Local" />
      </pro:ItemNominals>
      </pro:Items>
      </pro:Import>
      </DocumentXML>
      </ImportDocument>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      and here's the script:

      use SOAP::Lite +trace => all;

      my $soap = SOAP::Lite
      -> uri('http://www.proactis.com/proactis/webservice')
      -> on_action( sub {
      join '/', 'http://www.proactis.com/proactis/webservice', $_[1] } )
      -> proxy('http://blah/PROACTIS/XMLGateway.asmx');

      #Create the item

      my @params = (
      SOAP::Data->name('DocumentXML' =>
      \SOAP::Data->name('pro:Import' =>
      \SOAP::Data->name('pro:Control')
      ->attr({'xmlns:pro' => 'http://www.proactis.com/xml/xml-
      ns','Database' => 'PROACTIS_TEST','Password' => 'blah','UserName'
      => 'blah','Version' => '1.0.0','Company' => 'KBCFP'}),
      \SOAP::Data->name('pro:Items' =>
      \SOAP::Data->name('pro:Item' =>
      \SOAP::Data->name('pro:ItemCompanyGroups' =>
      \SOAP::Data->name('pro:ItemCompanyGroup')
      ->attr({SequenceNo => '4',ItemGroup
      => 'HW\HPST'})),
      SOAP::Data->name('pro:ItemNominals' =>
      \SOAP::Data->name('pro:ItemNominal')
      ->attr({IsExpenseAccount
      => 'YES',DefaultNominal => 'YES',Description
      => 'Local',AccountingElement1 => 'ABC',AccountingElement2
      => '3600',ACTION => 'STORE'})))
      ->attr({RowNumber => '4',Active
      => 'YES',CanChangeDescription => 'YES',SingleSupplierItem
      => 'NO',CanChangePrice => 'YES',ItemCurrency => 'USD',ACTION
      => 'STORE',PROACTISCode => 'SALEHABC',Description => 'Some
      Stuff',UnitOfMeasure => 'EACH',DefaultPrice => '20.00'}))
      ->attr({'xmlns:pro' => 'http://www.proactis.com/xml/xml-
      ns'})
      )
      ->attr({'xmlns:pro'
      => 'http://www.proactis.com/proactis/webservice'})));

      my $method = SOAP::Data->name('ImportDocument')
      ->attr({xmlns => 'http://www.proactis.com/proactis/webservice'});

      print $soap->call($method => @params)->result;


      cheers

      Paul.
    • Show all 2 messages in this topic