Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

One thing to understand is that SOAP is a very flexible protocol that stablishes a set of possible scenarios, being RPC or not.

The common scenarios are:

  • RPC/Encoded
  • RPC/Literal
  • Document/Literal Wrapped (used by MS .Net)
  • Document/Literal

RPC and Document style services.

So what defines RPC? RPC is when you have a service endpoint that provides several operations, or "procedures" to be called with a set of parameters. This means that the first and only child of the "body" element of the SOAP message will be the name of the operation to be invoked.

This way, the "Document/Literal Wrapped" pattern used by MS .Net *is* a RPC style service, even if it uses the "document/literal" SOAP style, it in fact is a mess confusion, and in the end is completely similar to the RPC style.

The other aspect of the RPC style is how the parameters are encoded. The most standard way is using the "SOAP Encoding", which then results in the "RPC/Encoded" pattern. This encoding standard is fairly simple and usefull for most cases.

The "literal" encoding is supposed to handle an arbitrary XML document, that would be delivered as-is to the service. What is wrong in the "wrapped" implementation is that, in fact the encoding is not "literal", but it is an encoding defined by the .Net framework. It is just not documented, so they call it "literal", where it probably needed to be called ".Net encoding" which would make a more reasonable name "RPC/.Net".

The idea behind the literal is the possibility of having arbitrary XML documents as parameters. But what is most important to realise is that SOAP allows you to define a custom encoding, for instance, let's suppose your RPC method receives an RDF information. You can just declare it as "RPC/RDF", and your framework would be able to automatically serialize and desserialize between some RDF high-level object and the RDF document.

The Document style services, on the other hand are a kind of service which do not implement the semantics of a remote procedure call, this means that the message don't contain an "operation name". It simply will contain an arbitrary XML document inside the body, you may even have several elements below body.

This is important to implement services that would, for instance, register your Europass CV (which have a known XML schema), in a system. You don't need any RPC on that, you just need a SOAP service endpoint where the EuroPass CV may be published and that's all.

The encoding is also meaningfull in the Document style. While Document/Encoded is a standard that simply doesn't seem to make sense (as SOAP encoding is RPC related) you may implement several variations beyound the Document/Literal pattern, which is simply a way to implement a non-declarative arbitrary encoding. The more sane would be, in the above case, to declare it as "Document/EuroPass", as the framework implementations would then be able to automatically provide a higher-level representation of the europass cv instead of a plain XML document to the service

Toolkits

Here, the more important question is: are you going to serve or consume SOAP?

To consume SOAP you can use SOAP::Lite, SOAP::WSDL and XML::Compile::SOAP. SOAP::Lite is very efficient with "RPC/Encoded" services, althought SOAP::Lite code is very weird, the module just work. On the other hand, if you need to deal with Document style services and encoding different from "SOAP Encoding" SOAP::Lite will start to be a problem (I will refer "Document/Literal Wrapped" as "RPC/.Net" from now on).

SOAP::WSDL and XML::Compile::SOAP seems to be more smart to deal with different encodings. I didn't stressed any of the both, but they seem to solve your problems in most cases.

On the other hand, if you're going to serve SOAP, then you have only SOAP::Lite and Gantry at the moment, I'm working on Catalyst::Controller::SOAP to provide that in Catalyst as well, and I should release the first early version this week. The good part is that this module I'm working on will be oriented to the SOAP concepts as I presented earlier. It will be easier to implement different types of encodings.

But again, if you're going to serve anything different from "RPC/Encoded" SOAP::Lite will not be very helpfull.

Important Disclaimer

Even when there are a lot of articles saying that RPC/Encoded is bad, these articles are promoting the "just plain broken" "Document/Literal Wrapped" pattern. So, be a good guy and declare your style and encoding accordingly. If you're going to do RPC, use RPC style, if you're going to encode parameters to the procedures, declare your encoding. The easy path is: "stick to RPC/Encoded".

daniel

In reply to Re: Starting on SOAP by ruoso
in thread Starting on SOAP by meraxes

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, 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, 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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (3)
    As of 2020-01-22 01:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      Notices?