Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
good chemistry is complicated,
and a little bit messy-LW
 
PerlMonks

Implementing WSDL-oriented SOAP applications in Perl

by ruoso (Deacon)
 | Log in | Create a new user | The Monastery Gates | Super Search | 
 | Seekers of Perl Wisdom | Meditations | PerlMonks Discussion | 
 | Obfuscation | Reviews | Cool Uses For Perl | Perl News | Q&A | Tutorials | 
 | Poetry | Recent Threads | Newest Nodes | Donate | What's New | 

on Apr 02, 2008 at 17:18 UTC ( #678009=CUFP: print w/ replies, xml ) Need Help??

This post is mostly an update of the features of the Catalyst::Controller::SOAP module, but since this is a groundbreaking release and that you now can deploy easily WSDL oriented services, I thought it is worth a post here.

Usage

RPC/Literal

RPC Literal is an alternative to RPC/Encoded, as many people don't like SOAP-Encoding. You still have the RPC semantics and the input and output are parsed according to the WSDL

package MyApp::Controller::Service; use strict; use warnings; use base qw(Catalyst::Controller::SOAP::RPC); __PACKAGE__->config->{wsdl} = 'foo.wsdl'; sub operation : SOAP(RPCLiteral) { my ($self, $c, $in) = @_; # where $in is a hashref with the result of the # XML::Compile::Schema # parse for the type of each of the message parts, # the key is the name of the part, the value is the # result of the parse. ... # to return a value, you can also use XML::Compile # features, according to the WSDL types. $c->stash->{soap}->compile_return({ ... }); }

Document/Literal

Also known as Document/Literal-Bare, this is a usage where each endpoint has only one operation. This way, your operation look like

sub other_operation : Local SOAP('DocumentLiteral') { # the body is parsed the same way as RPC literal, # except that RPC Literal starts the parsing inside # the operation element, while Document Literal parses # the whole body. # The return can be set in the exact same way. }

Document/Literal Wrapped

THIS IS IMPLEMENTED FOR COMPATIBILITY REASONS ONLY, and provides an endpoint that delays the dispatch based on the SOAPAction header. Please see Catalyst::Controller::SOAP::DocumentLiteralWrapped documentation for a detailed explanation of why this usage SUCKS

Here the programming semantics are the same of RPC/Literal, but the parsing semantics are the same of Document/Literal.

package MyApp::Controller::Service; use strict; use warnings; use base qw(Catalyst::Controller::SOAP::DocumentLiteralWrapped); __PACKAGE__->config->{wsdl} = 'foo.wsdl'; __PACKAGE__->config->{soap_action_prefix} = 'http://example.com/'; sub operation : SOAP('DocumentLiteral') { # The final operation is still DocumentLiteral, but # the superclass registers a dispatcher that will # forward to this action based on the SOAPAction # header. }

BUT I, AGAIN, WARN YOU THAT THIS IS A PSEUDO-STANDARD DEFINED BY MICROSOFT THAT IS HTTP-SPECIFIC, AND SHOULD BE DISCOURAGED. RPC/Literal CAN IMPLEMENT THE EXACT SAME MESSAGES THAN Document/Literal-Wrapped AND KEEPS THE DISPATCHING SEMANTICS SANE.

And what about client use?

Catalyst::Controller::SOAP have the companion Catalyst::Model::SOAP that maps stub methods for every operation as described by XML::Compile::WSDL11.

So, happy hacking...

daniel

Comment on Implementing WSDL-oriented SOAP applications in Perl
Select or Download Code

Back to Cool Uses For Perl

Login:
Password
remember me
What's my password?
Create A New User

Node Status
node history
Node Type: CUFP [id://678009]
Approved by Erez
Front-paged by Arunbear
help
Community Ads
Chatterbox
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users
Others exploiting the Monastery: (10)
GrandFather
atcroft
herveus
Eyck
biohisham
Haarg
matze77
lamprecht
gnosti
im2
As of 2009-11-21 09:02 GMT
Sections
The Monastery Gates
Seekers of Perl Wisdom
Meditations
PerlMonks Discussion
Categorized Q&A
Tutorials
Obfuscated Code
Perl Poetry
Cool Uses for Perl
Perl News
Information
PerlMonks FAQ
Guide to the Monastery
What's New at PerlMonks
Voting/Experience System
Tutorials
Reviews
Library
Perl FAQs
Other Info Sources
Find Nodes
Nodes You Wrote
Super Search
List Nodes By Users
Newest Nodes
Recently Active Threads
Selected Best Nodes
Best Nodes
Worst Nodes
Saints in our Book
Leftovers
The St. Larry Wall Shrine
Offering Plate
Awards
Craft
Snippets Section
Code Catacombs
Quests
Editor Requests
Buy PerlMonks Gear
PerlMonks Merchandise
Planet Perl
Perlsphere
Use Perl
Perl.com
Perl 5 Wiki
Perl Jobs
Perl Mongers
Perl Directory
Perl documentation
CPAN
Random Node
Voting Booth

Future historians will find that the material characteristic of the current era is...

Aluminium
Plastic
Oil
Water
Carbon dioxide
Copper
Iron
Silicon
Salt
Uranium
Hydrogen
Other

Results (729 votes), past polls