Consuming an ADO.NET Data Service from a WIN32 Delphi application. How? - delphi

Simple. I created a LINQ-TO-SQL Entity model, created a website, added a Data Service (*.svc) to this site and made sure it works by writing a simple .NET console application. The service works fine and cannot be modified.
Now I'm going to write a Delphi application (2007) for WIN32 which will have to call this data service. And while Delphi has no major problems importing a SOAP service, it can't import this service since it provides no WSDL...
So, two options. I could figure out how to generate a WSDL based on this data service or I'll have to find another way to consume this service. (Or just give up, but I hate to quit this challenge.) So, any advise?

ADO.NET Data Services are REST services. They are not SOAP WebServices and I don't think REST uses WSDL. You can call REST services from Delphi using HTTP GET/PUT/POST/DELETE. You could use Indy's TIdHTTPClient. See http://msdn.microsoft.com/en-us/library/cc668786.aspx for url examples. The results are in the Atom format, which is a XML format. You could parse it with TXMLDocument. They can also return JSON.

Maybe you can use the project Jedi "url grabber" components to consume the service. I have managed to get live share data using these in the past. I do not know exactly how your setup works, but maybe these can be helpful.
http://www.delphi-jedi.org/

You should also look at synapse, a small easy to use library which works well with REST. The latest version, which can be downloaded via SVN, works well in Delphi 2009.

Related

How to add SOAP interface for Delphi Synapse HTTP Server?

I've got a custom HTTP Server created using Delphi 7 and Ararat Synapse which receives HTTP GET from another application with a simple set of variables.
For example: http://myserver.com/get?Variable1=adsds&Variable2=asdasdasdsa&Variable3=aasdsadasdsad
The application source is similar to this - http://searchco.de/codesearch/view/13374072
Now, my customer needs me provide a SOAP interface. Completely new to SOAP, I did some research and found it to be very complicated. I would like to know what's the easier way to incorporate this interface to my HTTP server. Or should I find ready made SOAP To HTTP Conversion app if there is such a software. Thank you.
Note: I'm not the original developer of the HTTP Server.
There is a Web Service Toolkit for Free Pascal and Delphi which can be used to write SOAP servers.
I have not yet used it myself but it is in active development and might be compatible with Synapse.
Update: the current version seems to include support for Internet Direct (Indy) and Synapse (HTTP server and TCP server).
You need to write a SOAP server, which not only generates SOAP responses from SOAP requests, but which also provides a WSDL document telling the users what requests they can make.
Since your completely new to SOAP here are some 'starter' links:
General:
SOAP, WDSL, HTTP, XSD? What the?
List of publicly available web services (I would start writring a small testapp that consumes SOAP)
With Delphi:
Developing Web Services with Delphi
Web Services Made Easy With Delphi
Web services with Delphi
The fact that you are using Delphi 7 makes things more difficult, since later versions have better support:
Debugging/Testing Win32 SOAP Web Services (D2007). Bob has more SOAP articles
For testing both serving and consuming SOAP you should use SoapUI, a great free tool (What is SOAPUI?).
Once you are up to the WDSL you should know what types of WSDL exist and the whole namespaces mess...

Accessing an external SQL database in iOS

I am writing an iOS application that needs to access data from an external SQL Server 2005 database. I already have a website that accesses the same data.
I usually access the SQL server database using .NET along with stored procedures for security reasons.
I need to populate an array that will itself populate another TableViewController.
As I'm fairly new to the whole iOS thing, kindly let me know how I can do this. If it's possible, please suggest the syntax or Google keywords for this.
I'd recommend making a simple WCF .NET REST Service that queries your database and returns what you need.
I'm pretty sure your iOS app will not be able to connect to it directly.
Check out the following;
http://msdn.microsoft.com/en-us/library/bb412178.aspx
http://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-By-Step-Guide
The code project tutorial is very easy to follow. And you can download the project code.
It sounds like you will want to make an API to access your database and you can access it through web requests. Essentially you will be performing web requests and respond from your site in json or xml where within your iOS client side code you can parse that and do what you need with it.

Blackberry - Consume .Net Soap Service

I am new to blackberry app development and was wondering if someone could point me in the right direction(and may be a sample application) of how to consume web service in native apps. I'm using Blackberry JDE plugin for Eclipse.
I am able to consume a restful webservice, but now I want to consume a SOAP service. I am new to eclipse , so I would require in detail information.
Thanks,
I followed this none-ksoap2 route and it worked well for me:
http://www.johnwargo.com/index.php/blackberry/dbja2.html
This series of articles explains how to utilise the support the BlackBerry Platform has built in for JSR 172, the J2ME Web Services Specification, by creating a java stub class through the use of a utility in the Sun Java Wireless Toolkit for CLDC and the wsdl for your web service.
The articles give a very thorough and detailed explanation of the steps required to achieve the objective, so I would not wish to repeat them here in full, nor paraphrase them at the risk of my debased shorter version being quoted later. I understand the risk of answering in this way, and I realise that my short explanation above will in no way compensate should the original articles disappear from the internet.
Hey thanks for all the help. Figured it out. The problem was wcf service. When I tried with a simple web service(.asmx), it worked like charm and all the stubs were generated correctly. Probably wcf uses Soap 1.2 default and asmx service SOAP 1.1.
I even tried using KSOAP2 for calling wcf service with little success. Again switching back to asmx instead of wcf, solved the issue.
Now I have problem of plenty, which method to use(KSOAP or Stub) :)
I am all for non KSOAP method, but the only thing that is stopping me is I have to generated stub files everytime a introduce a new method.
Anyways +1 for all the help

Rest webserver using webbroker in BDS2006

Could you give me a tip on how can implement a rest webserver using just webbroker?
I know newer versions of delphi has this REST/JSON/DATASNAP features, but i´m stuck with BDS2006.
Basically i need to interact with other application and the guys are asking me to make this webserver application and provide just five methods over the internet/vpn. Don´t need to be running inside IIS or Apache.
I´ve googled a lot but the answers always point to 2010 and up versions. All that readings lead me to use the webappdebug template make some actions and respond to GET/POST/PUT/DELETE with some JSON objects.
The problem is ... I´m not well versed with webbroker, how can i achive this?
THANKS IN ADVANCE, ANY HELP WILL BE WELLCOME.
Our full RESTful Client-Server framework is availble, including an ORM (and much more), named mORMot.
It is an Open Source project, running from Delphi 6 up to XE2 - so it will work with Delphi 2006 (I've tested it with Delphi 7 and 2007 so I do not see any reason why BDS 2006 would fail).
It is able to serve Objects and Services (just like DataSnap) using JSON, in a secured (using per URL authentication) RESTful protocol.
It is able to use any Database engine back-end, with a SQLite3 kernel. You can even use without any database layer at all (that is without SQLite3), if you need only the RESTful services and in-memory objects feature (you can persist the objects with JSON or in binary format, but you won't be able to use advanced features like cross-table search).
More than 700 pages of documentation available.
For HTTP/1.1 communication, it is not based on WebBroker (nor IIS, nor Apache), but it will use directly the high-speed http.sys kernel-mode service.

Access Web Services on BlackBerry

What are the ways of accessing web services on a BlackBerry device?
I've learned about XML for webservices. We use SAX and DOM parsers in Blackberry. Are there any more ideas like this?
I also want to know what KSOAP is and how to use it on BlackBerry.
AFAIK, kSOAP is a library that lets you post soap requests to your web service. If the service accepts a simple POST request, the easiest way would be to use HttpConnection. Here's a good tutorial
I've also used kXML2 for XML parsing, and that has worked out well for me till now.
Additionally, including 3rd party libraries is a pain (kSOAP and kXML), so here's a guide that will hopefully save you some time.
You can try http://wsclient.neurospeech.com/wsclient/java-android-blackberry/ which supports soap code generation for blackberry with additional library that manages everything, it generates native typed soap client and calling them is very easy. Otherwise you will be spending lot of time in xml to your types and types to xml conversions and so on. Plus date and many things are little complex to handle.

Resources