I am trying to get started writing a SOAP client, and it is proving difficult for two reasons. 1) The only working example I have for the SOAP sever I need to use is written in PHP, and it uses complex data types. 2) I don't have a SOAP server that I can use to test the Perl code I need to write.

I am having trouble finding the perl equivalent of the following PHP code

$soap = new SoapClient("https://the.soap.url/api/service?wsdl", array("classmap"=>array("Type1"=>"Type1", "Type2"=>"Type2")));

The class definitions look similar to the following:

class Type1 { var $f11 = null; var $f12 = null; } class Type2 { var $f21 = null; var $f22 = null; var $f23 = null; }

The following perl code fails, I assume because it contains no information about the expected classes

my $soap = SOAP::Lite->service('https://the.soap.url/api/service/?wsdl');

And to make it more challenging, I have not had the need to write my own Perl classes (though I write Java and C++ classes all the time, so the main ideas are not new to me).

I can read PHP well enough to understand what it is doing, but I have not written any of my own PHP code.

Far be it from me to recommend anything MS, but I found that the documentation they provid for their Visual Studio has a neat educational feature. For .NET, they have extensive examples, and you can select the langauge (VB, C#, &c.) at the top of the examples, so you can see how to do a given task in each fo the supported languages. This is a great help if you want to learn the langages well enough to translate code from one language to another. Can anyone recommend a site that facilitates seeing how PHP and Perl relate to each other (not so much an ontological relation, but rather how each does any given task).

As always, any guidance would be greatly appreciated.


In reply to Trouble getting started with SOAP (SOAP::Lite, SOAP::WSDL), translating from PHP to Perl by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.