fetch data from web service to dataset in Delphi - web-services

i need to know about how to fetch data (array) from web service to my delphi dataset (db grid or string grid like REST Application),
give me an example please...
best regards

I use web services in Delphi 7(soap 1.1) and Rad Studio XE6(soap 1.2). I recomend to use the WDSL Importer that comes with the IDE to make a .dcu file that represents the WebService(WS). Then you have to include the dcu file in the 'uses' of your .pas file.
Then, define the WS as a global static variable. You have to respect all the names in your dcu WS file.
So,
1- Use wdsl importer to create dcu file of the WS.
2- Include imported file in your 'uses' section.
3- Define the static var of the file.
4- Use the static var to call methods of the WS.
Hope it helps!
Bye

Related

Use WSDL dynamically in Delphi

How can I use dynamic WSDL, it's operations and parameters, which is given in program config file?
For example, we have a config file:
[Section]
WSDL=http://example.com/SomePub/ws/SomeService?wsdl
Username=myuser
Password=mypass
OperationName=MyOperation
ParameterName=MyParameter
I.e. we have to use web-service, which is unknown, but given (by ini-file) only in run-time. So, we cannot use WSDL Import wizard in Delphi.
Can we write in Delphi such a program, which would load these settings from configuration, and then pass data to specified operation in specified parameter on web-service, which specified by given WSDL?
Using SOAPUI, import the service and perform a sample call. Copy the raw request and the raw response into notepad. Modify the real data with 'tags' and include each raw template as a value in your INI. When you need to make the call, open your INI, grab the raw response template and replace tags with real values. Manually send the SOAP request and parse the response in the same way using the raw template.
The Delphi WSDL importer and the Free Pascal Web Service Toolkit do not provide a way to build a SOAP request dynamically based on a WSDL.
The Web Service Toolkit (and the WSDL importer) are only source code generators, so the code first needs to be compiled - this requires to include a compiler with your application.

Magento programmatically appending code to template pages

I am developing a Magento extension and would like to run some jQuery script in the footer of the html template.
I have manually edited page.xml layout file to load my jQuery source and manually edited the footer.phtml template file to test my code, but I now want to package it up into an extension. The question is how to do this within my extension configuration, to tell magento to load the new jQuery source library in the header, and to append code somewhere in the footer (or anywhere) in the magento generated theme html.
Create a custom Magento Module
Use this module to add a customer Package Layout Update XML File
Use this Package Layout Update XML files to add a javascript src link to a (CDN?) jQuery, and add a custom block to the before_body_end block
Use this custom block to output your needed Javascript code
Use Magento Connect System->Magento Connect->Package Extensions to package up your customer Magento Module file, as well as any other files on the system you used (phtml template, jQuery files if not using a CDN, etc) into an Extension.
Wouldn't it be easier to use a static block? This way the client or yourself could update the jQuery right in the admin area without going into code. You could also add logic with multiple blocks if you needed. You can display a static block in a template like so:
<?php echo $this->getChildHtml('staticblockname') ?>
Otherwise you might want to read this tutorial on creating a module (which you call an extension): http://magento4u.wordpress.com/2009/06/08/create-new-module-helloworld-in-magento/

Translate xml content using web service API from Ektron CMS400.Net

First of all: I'm on Ektron CMS v8.1
I'm having a problem with dynamicly adding translated content to the cms via the Webservice API. I can perfectly add xml content by using the following object and method:
ContentSoapClient csc = new ContentSoapClient("ContentSoap");
csc.AddContent3(...);
I specify a language and the xml content gets inserted. But now I want to add a translated version of the xml to the cms. So I want it to have the same contentId!
Anyone has an idea on this? The only method in the csc object that recieves a contentId is 'csc.AddContent2(..)' But that doesn't import anything and just gives me an error saying my xml is incorrect. While my xml is correct..I checked it!
Thanks!
Found the answer..
Ektron apparantly uses alot of asmx files and I only checked the "/workarea/webservices/WebServiceAPI/Content/Content.asmx" webservice. I found the method 'AddTranslatedXMLContent()' I need in the "/Workarea/webservices/ContentWS.asmx" webservice.
I wish they just cleaned up their API... Would save us a lot of trouble.
Firstly, I haven't used the ContentSoapClient class and can't find any documentation on it.
Ektron often takes a language id when you create the API object. See if the ContentSoapClient contructor can take a Language Id.

How can Excel 2007 / 2010 consume a REST web service?

What options exist to consume a REST web service from within Excel 2007 / 2010? I can use XML Maps to consume a basic XML list, but that doesn't let me build a dynamic URL (so I could include parameters).
For example, I can add an XML Map to Excel for http://machine/service/level/5 and display the values in the workbook just fine - no problem there. The real question is, how can I dynamically change the /5 part of the URL to come from another cell in excel?
That way I can have a couple of cells that have the options (what ID, what name, etc.) and whenever those values change (ideally) a new dynamic URL would be constructed and the XML map would be refreshed.
Is such a thing possible? Does anyone else have a better way to take some parameters, call a web service (REST or SOAP, I'm not picky) and shove the results back into excel for further manipulation?
XLLoop (http://xlloop.sourceforge.net/) can be used to call make Json of HTTP calls.
You can use PowerPivot with Excel 2010. Download from here.
From the home tab select 'From Data Feeds', then 'From Other Feeds'.
You should be able to use this to point to your URL.
I've read that PowerPivot uses REST but I haven't tried it myself.
Good luck! :)

Is there a way to extract a custom request header with cgicc

I am using Cgicc , which has some methods to extract specific request headers, e.g. getUserAgent would return "User-Agent" header.
Is there a generic method that can return an arbitrary header value, e.g. something like
getHeaderValue("x-my-header");
Is there a way to do this using cgicc? and if cannot be done with cgicc, how else can I extract a custom header from the request in c++?
No, cgicc does not support this direcly. However, it is just a wrapper around CGI. http://en.wikipedia.org/wiki/Common_Gateway_Interface and it uses "getenv" in CgiInput
class to extract all information provided by the web server.
So if the client send some header that is not supported directly by CgiCC but does supported by the web server (lets say Accept-Encoding:) that you just need to read apropriate
environment variable getenv("HTTP_ACCEPT_ENCODING")
But it should be supported by web server you are working with
EDIT: actually according CGI RFC http://www.ietf.org/rfc/rfc3875.txt web server should provide enviroment variable for your example: HTTP_X_MY_HEADER