Rnet
Rnet

Reputation: 5040

RPC/Document Encoded real examples

Having gone through various tutorials on the differences between encoded vs literal, I have found that literal is the recommended option; the tutorials also give various examples of simple services where literal is the logical choice; but I have begun to wonder why the encoded option is there in the first place? Is it something which was added initially to the spec and became deprecated later, is it there only for backward compatibility?

Are there any real world examples where you would choose encoded over literal?

Upvotes: 1

Views: 614

Answers (1)

Piotr
Piotr

Reputation: 331

I think the encoded style was created to reflect data structures which are common in modern programming languages, like arrays, maps etc. It works nice until you try to manually create your WSDL file where you have to apply all these SOAP-ENC rules. It was important to me because I made some validation functions based on the XML Schema. Moreover, it's a lot easier to debug raw XML messages as document/literal.

I can recommend you comparing two versions of the Polish Allegro WebAPI. The first one uses RPC and encoded style: https://webapi.allegro.pl/uploader.php?wsdl

To see the other one, just replace "uploader" with "service" in the URL.

Here, you've got document/literal described at Allegro: http://allegro.pl/webapi/tutorials.php/tutorial/id,261

I am using document/literal now in my SOAP services and it is much easier for me to create WSDL precisely. Handling SOAP requests in PHP is a little bit more complex, but I've got used to it quickly.

Upvotes: 2

Related Questions