document/literal style SOAP:Lite service

Discussion in 'Perl Misc' started by Fima Furman, May 9, 2007.

  1. Fima  Furman

    Fima Furman Guest

    Folks, this seems like a pretty basic question, but I couldn't find a
    direct answer, only hints in documentation and other people's article.
    Can Soap:Lite implement a service which would work with Document/
    literal requests? In my testing I was only able to get it to work with
    rpc/encoded style. I would very much appreciate if someone could shed
    some light on this.

    If Soap:lite is incompatible with document/literal, are there
    alternatives out there which would allow to implement document/literal
    SOAP service in Pearl? I've asked the same question in Soap:Lite yahoo
    group and total silence was my answer.

    Thanks!
    Fima Furman, May 9, 2007
    #1
    1. Advertising

  2. Fima  Furman

    Ian Wilson Guest

    Fima Furman wrote:
    > Folks, this seems like a pretty basic question, but I couldn't find a
    > direct answer, only hints in documentation and other people's article.
    > Can Soap:Lite implement a service which would work with Document/
    > literal requests? In my testing I was only able to get it to work with
    > rpc/encoded style. I would very much appreciate if someone could shed
    > some light on this.


    SOAP::Lite really only supports RPC/Encoded. The SOAP::Lite
    documentation mentions partial support for Doc/Literal but I believe
    this never advanced beyond some rudimentary and partial support.

    > If Soap:lite is incompatible with document/literal, are there
    > alternatives out there which would allow to implement document/literal
    > SOAP service in Pearl? I've asked the same question in Soap:Lite yahoo
    > group and total silence was my answer.


    AFAIK There are no alternative modules that do what you want.

    I'd love to hear if I am wrong about either of the above!


    The good news is that the following process works beautifully:

    * Create a SOAP::Lite service in the usual way.

    * If you receive or send complex data structures,
    Use Perl objects
    Return references to arrays instead of arrays
    Do not use perl data structures like HoH
    Do not use SOAP::Data to construct params or return values.

    * Mark up your Perl objects following the instructions
    in the POD::WSDL documentation

    * Use POD::WSDL to create WSDL for the service

    * Use that WSDL to create stubs in technologies that
    normally only like Doc/Literal
    e.g. C# .NET
    I downloaded mono and used it's wsdl.exe to create a
    C# stub from the WSDL created by POD::WSDL

    * Use those stubs in the normal way.
    I could write normal C# code, constructing C# objects and passing
    them as params to Perl SOAP::Lite services via methods of a stub
    service object. Perl objects emerge as C# objects and vice-versa.

    * The receiving Perl service receives full Perl objects
    and you can invoke instance methods using those
    objects!

    I have done this with moderately complex parameters such as an array of
    objects where each object contains various fields and an array of
    another type of object.

    Note that the C# programmer does not have to even know about the
    distinction between RPC/Encoded and Doc/Literal. Everything just works.

    I haven't tried this with Perl's inside-out objects, just the original
    traditional hash based objects. The C# classes created in the stub for
    the parameter and return objects obviously lack methods and accessors,
    you just refer to public variables (fields) using object.field notation

    Perl service

    my @things;
    my $thing = new Thing(1,99.9,"aha");
    $thing->addWhatsit("foo", 23.3); # inner array of Whatsit objects
    $thing->addWhatist("bar", 23.3);
    push @things $thing;
    $thing = new Thing(2,34.2,"oho");
    return \@things;

    C# client

    // stub gen from WSDL defines ThingService, Thing and Whatsit.
    ThingService service = new ThingService();
    Thing[] things = service.method(params);
    for (int i = 0; i < things.Length; i++) {
    Whatsit[] whatsits = things.whatsits;
    for (int j = 0; j < whatsits.Length; j++) {
    Console.WriteLine("This Things contains a Whatsit with name "
    + whatsits[j].name);
    }
    }

    No hint of RPC/Encoded or Doc/Literal anywhere in the code you have to
    write.
    Ian Wilson, May 9, 2007
    #2
    1. Advertising

  3. Fima  Furman

    Fima Furman Guest

    Ian,

    Thank you so much for such a detailed reply! It's amazing this
    information isn't really out there. Can you recommend a Soap::Lite
    version I should use? The latest non-experimental version is 0.60a,
    however there are versions up to .69 available.

    Thanks, again

    Fima.

    On May 9, 10:28 am, Ian Wilson <> wrote:
    > SOAP::Lite really only supports RPC/Encoded. The SOAP::Lite
    > documentation mentions partial support for Doc/Literal but I believe
    > this never advanced beyond some rudimentary and partial support.
    Fima Furman, May 9, 2007
    #3
  4. Fima  Furman

    Ian Wilson Guest

    Fima Furman wrote:
    >
    > On May 9, 10:28 am, Ian Wilson <> wrote:
    >
    >> SOAP::Lite really only supports RPC/Encoded. The SOAP::Lite
    >> documentation mentions partial support for Doc/Literal but I
    >> believe this never advanced beyond some rudimentary and partial
    >> support.

    >
    > Thank you so much for such a detailed reply! It's amazing this
    > information isn't really out there.


    Yes, I spent *many* days struggling with this issue and explored many
    dead ends. Useful tools included SOAP::Lite's +trace option, Wireshark
    and an XML prettyprinter/indenter.


    > Can you recommend a Soap::Lite version I should use? The latest
    > non-experimental version is 0.60a, however there are versions up to
    > .69 available.


    Here's what I am using ...

    Unix Server:
    $ perl -MSOAP::Lite -e 'print "$SOAP::Lite::VERSION\n"'
    0.55

    Development PC (WinXP):
    C:\> perl -MSOAP::Lite -e "print qq($SOAP::Lite::VERSION\n)"
    0.55

    Looks like I'm using rather old versions :-o

    I recommend you use whatever comes as standard on your platform. If it
    doesn't work, I'd upgrade to the latest stable version available.
    Ian Wilson, May 9, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    739
    Aaron Brady
    Jan 1, 2009
  2. Replies:
    0
    Views:
    286
  3. Desmond Fitzgerald

    Problem with VS Web Reference to document-literal style web service

    Desmond Fitzgerald, Jan 18, 2006, in forum: ASP .Net Web Services
    Replies:
    4
    Views:
    173
    Desmond Fitzgerald
    Jan 18, 2006
  4. Gary W. Smith

    Web Service randomly hangs when being called from SOAP::Lite

    Gary W. Smith, Aug 4, 2009, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    880
    Gary W. Smith
    Aug 4, 2009
  5. droesler
    Replies:
    2
    Views:
    474
    droesler
    Aug 31, 2010
Loading...

Share This Page