Re: SOAP in Pike?

Pontus Östlund <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <[email protected]>
9 nov. 2016 kl. 16:53 skrev Stephen R. van den Berg <[email protected]>:
> 
> Stephen R. van den Berg wrote:
>> It helped.  Even though I originally didn't intend to, I got sidetracked and
>> implemented something close to a full SOAP-wdsl parser.
>> I'm currently determining what the most appropriate sync and/or async interface
>> to Pike would be.
> 
>> Suggestions are welcome.
> 
> Maybe nobody cares, then again, maybe lyskom still has a treasuretrove of
> messages on this SOAP-thread...
> 
> In any case, lo and behold, there now is usable SOAP in Pike 8.1:
> - The wsdl parser works for a lot of types, but probably not all (yet).
>  The parser is not a fullblown-faithful implementation according to the RFC,
>  it's more like a minimal version that still allows meaningful communication.
>  The RFC spec on SOAP is unwieldy, to say the least.

SOAP is a dirty beast indeed (pun very intended ;)

> - It uses the fashionable Promise interface.
> 
> Sample code:
> 
> Web.SOAP.Promise("https://foo.bar/Logon.svc?wsdl")
>  .on_success(lambda(Web.SOAP.Client soap) {
>   Web.SOAP.Arguments args, sh;
>   args               = soap->getarguments("Logon");
>   sh                 = args->LogonRequestMsg;
>   sh->Username       = "foo";
>   sh->Password       = "bar";
>   sh->WebServiceType = "Publisher";
> 
>   soap->call(args)
>    .on_success(lambda(mixed resp) {
>     string token = resp->CredentialToken;
>   });
> });

Looks nice! :)

The only thing that sticks out to me is that "getarguments()" should be "get_arguments()" to conform to the Pike naming conventions.

> This was about as clean as I could get SOAP (pun intended).

A pun is never boring :D

# Pontus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.