Connect with WCF?

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dharry
Posts: 1
Joined: Mon Dec 26, 2011 1:34 am

Connect with WCF?

Post by dharry » Mon Dec 26, 2011 1:36 am

Hi All,

I'm new to LivcCode and wanted to convert one of my iOS apps to Android using LiveCode.

My app talks to a web service published with WCF, can anyone tell me fi LiveCode is able to communicate with a WCF web service?

Thanks
Dean

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Connect with WCF?

Post by Mark » Wed Dec 28, 2011 2:59 am

Dean,

Only the documentation of the service can tell you. If you are the developer of the service software, then the answer is probably yes. How? You have to figure this out yourself, but you can probably use sockets and maybe you can even use a simpke put/get url command.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Connect with WCF?

Post by mwieder » Wed Dec 28, 2011 8:08 pm

Dean-

Web services are typically xml over http post or get connections. There's no problem doing that with LiveCode on any platform.

Rafal
Posts: 1
Joined: Tue Jul 10, 2012 12:19 pm

Re: Connect with WCF?

Post by Rafal » Tue Jul 10, 2012 12:22 pm

Hi dharry,

did you manage to use LC with WCF at the end?

Regards,
Raf

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Connect with WCF?

Post by mwieder » Wed Jul 11, 2012 5:13 pm

I finally looked at WCF. Sheesh - trust Microsoft to make anything complicated. But the heart of it is that WCF allows you to publish either SOAP or RESTful web services. And either of these are easy to consume from the client end with LiveCode. A proper wsdl document is essential for figuring out what needs to be done.

userintl2012
Posts: 9
Joined: Fri Apr 13, 2012 8:44 pm

Re: Connect with WCF?

Post by userintl2012 » Fri Nov 08, 2013 4:59 am

Hi mwieder,

I'm curious how the problem was fixed because I have a similar one: I have to access from Livecode a .NET Soap web service ( it is not WCF ) that exposes several methods returning lists of data, single values, etc, all XML. Also some methods accept arguments. I have the WSDL definition file available.

I can connect and access the methods but I always receive back the web service definition, instead of the data. I tried a lot of different sintax with the put URL command and the POST command, with no success, always getting the XML definition of the service with the names of all methods.

Obvious statements like

put the URL"http://webservice_URL/n_ezgwebservice.asmx?op=GetMatchInfo" into tPreferencesFile
put the URL"http://webservice_URL/n_ezgwebservice.asmx?f=GetMatchInfo" into tPreferencesFile
put the URL"http://webservice_URL/n_ezgwebservice.asmx?f=GetMatchList&club=2098" into tPreferencesFile

POST "GetMatchInfo" to URL"http://webservice_URL/n_ezgwebservice.asmx"
put it into myWebResult

return the service definition, not the data associated.

I already wrote small apps in Power Builder and CSharp to access the service and the data returned is OK. The problem, I guess, is the sintax of the commands I'm using within Livecode.

So do you have an example in Livecode to access the WCF web service?

Thanks,
Paulo

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Connect with WCF?

Post by Simon » Fri Nov 08, 2013 6:32 am

Hi Paulo,
if you can display the correct infomation from url in a browser then you can:
put url "your_url" into tVar
using the same url.
put the URL"http://webservice_URL/n_ezgwebservice.asmx?op=GetMatchInfo" into tPreferencesFile
drop the "the".

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

userintl2012
Posts: 9
Joined: Fri Apr 13, 2012 8:44 pm

Re: Connect with WCF?

Post by userintl2012 » Mon Nov 11, 2013 5:11 am

Hi Simon,

Thank you for your reply.

Unfortunately the command removing the "the" as below

put URL"http://webservice_URL/n_ezgwebservice.asmx?op=GetMatchInfo" into tPreferencesFile

and all variations change "op" by "f", "function", "run" and etc did not work: I keep receiving copy of the WSDL service definition instead of the data.

To discard errors in the external web service (it could be returning JSON instead of XML, I don't know... ) I proceed as follows:

1. I created a web service in Visual Basic, NOT WCF, to return always a string: no input arguments, no output lists, just the same string always returned. The service I named it ezg_ws_test.

ezg_ws_test service has NO methods to expose, just always return a string.

I tested it using the Visual Studio generated testPage.html and IIS opened it: it returns the string OK, so the service is OK.

2. Now I wrote a Client in Power Builder, Visual Basic and CSharp to access the service in my local equipment. From the WSDL file I got the address "http://localhost/wwwroot/webservice/ezg_ws_test.asmx".
I ran all three (03) applications to display the returned value and the string is returned properly.

3. In LIVECODE I use the commands

put URL"http://localhost/wwwroot/webservice/ezg_ws_test.asmx" into tPreferencesFile or
put URL"http://localhost/wwwroot/webservice/ezg_ws_test.asmx" into tPreferencesFile?

receiving AGAIN the WSDL contents instead of the string returned.

I'm starting to believe that LiveCode cannot access web services via SOAP protocol, maybe only HTML sites that return only one type of data, like the Amazon web service... :roll:

Any clue will be highly appreciated !

Best,
Paulo

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Connect with WCF?

Post by Mark » Mon Nov 11, 2013 3:20 pm

Hi Paulo,

Does the server expect a specific HTTP header to know that it is expected to use the SOAP protocol?

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

userintl2012
Posts: 9
Joined: Fri Apr 13, 2012 8:44 pm

Re: Connect with WCF?

Post by userintl2012 » Mon Nov 11, 2013 6:44 pm

Hi Mark,

Thank you for the reply.

It is possible that the server expects a HTTP header to identify that is a SOAP protocol, but I don't know.

In a try clarify if the external ws has a problem, I developed a test web_service similar to the one I have to access. I wrote it with Visual Studio 2010 Ultimate and there is only one method that returns always a string, no arguments to be passed. However, VSudio generated a WSDL for me. It is NOT a WCF web service.

Looking the WSDL file will I be able to find if it needs a HTTP header?

I dont know much about the web service internals neither about the SOAP protocol. The tests were done in my local equipment and below are the lines of code extracted from the WSDL file:

<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempurl.org" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempurl.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
- <wsdl:types>

- <s:element name="of_get_single_value">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="ai_number" type="s:short" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="of_get_single_valueResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="of_get_single_valueResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="of_get_time_now">
<s:complexType />
</s:element>
- <s:element name="of_get_time_nowResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="of_get_time_nowResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>

As you can see there are two (02) methods that I created in order to test the service from a Client VB, Power Builder and Livecode. All worked fine, but Livecode.

Can you tell if it needs a header saying that is SOAP? If yes, how can I generate the header?

Thank you in advance for the help.
Paulo

Can you read the

Post Reply