Call webservice form BlitzMax

BlitzMax Forums/BlitzMax Programming/Call webservice form BlitzMax

Keith Gilbert(Posted 2009) [#1]
hi

I would like to call a web service(c#,.net) from BlitzMax. I need to be able to pass parameters and read the response from the web service

Any ideas to start with?


plash(Posted 2009) [#2]
Like sending a POST request?

You can probably use curl for that.


Jim Teeuwen(Posted 2009) [#3]
Sending the HTTP request is the easy part. The difficult part comes when you need to interpret the SOAP message that is returned by a .NET webservice.

As far as I know, blitzmax does not have a SOAP module yet. With the reflection stuff in bmax nowadays, this may actually be doable to some degree, but it's gonna take some work.


Htbaa(Posted 2009) [#4]
My xmlrpc.mod uses xmlrpc-epi which also has some support for SOAP. You could give it a try but I think you do need to hack a bit into the source for it to work correctly.


Reda Borchardt(Posted 2009) [#5]
The easiest thing would be to build a very small ASP wrapper that passes the request to the web service and replies in a friendly format.

We do it all the time where I work and there are a lot of tutorials on this.


Glenn Dodd(Posted 2009) [#6]
If someone gets this working i would like to see the code or use it myself.
Unfortunately it is way over my head at the moment so i couldn't even attempt it.

Cheers
Glenn


Keith Gilbert(Posted 2009) [#7]
The easiest thing would be to build a very small ASP wrapper that passes the request to the web service and replies in a friendly format.

We do it all the time where I work and there are a lot of tutorials on this.


Is there any sample code or forum links which you can give me for this approach?

Any help would be appreciated


Blueapples(Posted 2009) [#8]
I do not believe that reflection is relevant to your need here.

I would recommend using two of Brucey's modules to accomplish this, both of which are well documented.

- libcurl to make the POST request and get the response (Brucey, I cannot find a download for libcurl - search on google code turns up nothing, does anyone have a copy of this locally to get him started?) - using libcurl is superior to shelling out to call an external curl binary because it will allow you to directly read the result and does not depend on a system having curl installed (many do not), and does not create a separate process which is very expensive on many architectures
- libxml to create the SOAP request packet and to parse the response packet.

I do not currently have an interest in gluing these together myself but it should be a relatively simple exercise, particularly if you are targeting a single SOAP call or only a few. Writing something very generic would be a bit more complicated.


Brucey(Posted 2009) [#9]
I cannot find a download for libcurl

It's on the Downloads page :-)


Reda Borchardt(Posted 2009) [#10]
Here is a simple example on how to wrap a service:
http://www.codeproject.com/KB/webservices/WebServiceConsumer.aspx


Blueapples(Posted 2009) [#11]
I can't for the life of me figure out why someone would want to wrap a web service in a non-standard interface. Do yourself a favor and take the time to make your app call SOAP services directly. It's barely any more work - actually less because you don't have to host your glue code on a website anywhere.


It's on the Downloads page :-)

Hmm indeed it is. Odd, the search linked to from the home page turns up nothing.


Reda Borchardt(Posted 2009) [#12]
You might also be interested in this.

It's a web service proxy wizard offered by Microsoft that allows you to bind a web service through a DLL. The tool is pretty awesome.

http://msdn.microsoft.com/en-us/library/aa239611(VS.60).aspx