SOAP WSDL

BlitzMax Forums/BlitzMax Programming/SOAP WSDL

Banshee(Posted 2012) [#1]
I am thinking about a problem I will need to solve soon and the obvious solution is to use SOAP / WSDL - but a search of the forums turned up no results for WSDL.

Has anybody tackled using this technology with BlitzMax before?


Yan(Posted 2012) [#2]
WSDL is just XML, is it not?


Banshee(Posted 2012) [#3]
Essentially yes, although various working groups have found ways to make the whole thing more complicated in order to make it easy and accessible to everyone - but it's basically a form of xml communication between applications.

It's like an internet version of Arexx to those of us who first encountered Blitz on the Amiga.

I have to use it quite often in my day job, so when I started thinking about website/database/application data interchange for my hobby project I started wondering if there was a soap library already in existence.


Htbaa(Posted 2012) [#4]
Not sure if this would help but my htbaapub.xmlrpc module uses xmlrpc-epi which is supposed to have a basic interface for SOAP. I've never used it and neither have implemented it, as SOAP is something I'm happy to stay away from.


Banshee(Posted 2012) [#5]
I just sat through the presentation video on ZMQ it looks quite interesting, and now i'm reading up on Mongrel 2. There's some fascinating stuff I wish I had more time for. Thanks for indirectly pointing me to my hobby after this one ;P


Htbaa(Posted 2012) [#6]
Well... if you're interested in ZMQ, there's htbaapub.zmq for just that :-P. It's an early release still, but functional. You could use ZMQ handler in BlitzMax for Mongrel 2 :-).


Banshee(Posted 2012) [#7]
Yeah that's what I was piecing together, coding web pages in BMax on a Mongrel 2 hosted server? That sounds like it has the potential for a far more integrated web product, although php does do the job very well and I am quite expert at it already so i'm not sure it's worth me working in BMax which isn't designed for that purpose just to achieve the same thing, but...

The possibility to do an aweful lot more than just web pages, with the power and versality of BMax, directly into dynamicly delivered content, that could be cool.

Although I couldn't see anyone offering Mongrel 2 servers.

Having said that going an extra step and hosting web pages directly from Blitz isn't that hard either, I did years ago with Blitz3D just for kicks and even had it handling concurrent downloads. After all it's just a TCP port 80 socket. With BMax's multi-threading one has to ask the question if you're going to do web pages in BlitzMax then why not write the server hosting application in BlitzMax too?

I suppose really it wouldnt make that much difference what it was hosted in or how the various issues are tackled - but this is a hobby, and doing things the hard way just because you can is a lot of fun :)


Glenn Dodd(Posted 2012) [#8]
Here is a piece of code Brucey helped me with in 2010.
It uses one of my soap web services from work.
Everything below here is from Brucey.
__________________________

The following is the example 8 program modified to get addresses beginning with "Bell" using the api... (you might have to fix the long strings when you copy it from the email)

-------------------------------------

SuperStrict

' Connect to a website via HTTPS, using a certificate bundle.
'
'

Framework BaH.libcurlssl
Import BRL.StandardIO
Import BRL.FileSystem
Import BaH.Libxml

Local curl:TCurlEasy = TCurlEasy.Create()

curl.setWriteString()
'curl.setOptInt(CURLOPT_VERBOSE, 1)
curl.setOptInt(CURLOPT_FOLLOWLOCATION, 1)

curl.setOptString(CURLOPT_CAINFO, "../certificates/cacert.pem") ' the cert bundle

curl.httpHeader(["Content-Type: application/soap+xml; charset=utf-8"])


Local s:String = "<?xml version=~q1.0~q encoding=~qutf-8~q?>" + ..
"<soap12:Envelope xmlns:xsi=~qhttp://www.w3.org/2001/XMLSchema-instance~q xmlns:xsd=~qhttp://www.w3.org/2001/XMLSchema~q xmlns:soap12=~qhttp://www.w3.org/2003/05/soap-envelope~q>" + ..
"<soap12:Body>" + ..
"<StreetLookup xmlns=~qhttp://www.datacom.co.nz~q>" + ..
"<prefixText>Bell</prefixText>" + ..
"<count>10</count>" + ..
"</StreetLookup>" + ..
"</soap12:Body>" + ..
"</soap12:Envelope>"

Local b:Byte Ptr = s.ToUTF8String()

' post binary data
curl.setOptBytePtr(CURLOPT_POSTFIELDS, b)

' set the size of the postfields data
curl.setOptInt(CURLOPT_POSTFIELDSIZE, s.length)


curl.setOptString(CURLOPT_USERPWD, "UAT-WS.Lookup:P@ssw0rd")
curl.setOptString(CURLOPT_URL, "https://servicesuat.courierpost.co.nz/ECL.AddressLookup/AddressLookup.asmx?op=StreetLookupStreetOnly")

Local res:Int = curl.perform()

If res Then
Print CurlError(res)
End
End If

curl.cleanup()

Print curl.toString()

---------------------------------------


I found I had to use the .pem certificates file, which is newer (as mentioned in the docs

And using s.length probably isn't such a good idea... but maybe for your stuff it'll do. And of course the byte ptr needs to be freed later at some point. I also think curl.freelists() needs to be called to free the headers list.

Otherwise, it seems to be okay.


Banshee(Posted 2012) [#9]
Oh Glenn that's awesome things. I can see how knocking up a SOAP class would be pretty easy based off that. I do also like the look of the ZMQ that htbaa did a module for too, so I am drawn now - but I think the SOAP interface would give me the ability to open up interfaces to the public for some cool stuff too and is more widely known.