How to add SOAP interface for Delphi Synapse HTTP Server? - delphi

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...

Related

Can Dart communicate / talk to Java?

I have a Java web service (with some server side business logic) created with jsp and servlets. Is there any useful way to let Dart and Java communicate / talk to each other? Does it make sense?
This is one solution: https://www.dartlang.org/articles/json-web-service/
Http can be sent or received by most languages.
A Dart client-side web application can indeed interact with server-side web services.
The language or platform that the server-side web services are written in and deployed on are unimportant as long as both sides support the protocols and data formats used to exchange messages.
Presumably your web service uses HTTP as the transport protocol and either XML or JSON as the data format. The article mentioned by #kpie should be a good starting point.

Fetch data from Siebel CRM

I'm planning to develop an adapter to access Siebel CRM data for my iOS app. I'm a new bee into this Siebel technology. I 've the Siebel CRM up an running in my workstation with sample db data. Could any one help me in getting this done? please excuse me if i've hosted this ques in a wrong stack.
There seems to be only 2 valid ways to do that:
SOAP webservices
REST api (but for this you need to have jboss or weblogic server: Sebel Bookshelf)
all other ways (Java Siebel Data Bean, COM interfaces, direct db access) got lots of issues: like issues with java on iOS ( I think it is not possible to run on iPhone), issues with legacy COM interfaces on iOS and numerous issues with direct db connection (complexity, stability, reusability...)
SOAP is out of the box on Siebel but requires more coding on iOS side, REST is easier on iOS or any webpage but requires some middlware:
JBoss/WebLogic + and RESTfull Siebel client form Siebel (available somewhere on their page)
java data bean app that produces REST
soap client that produces REST
I have worked on 2 projects involving iOS and Siebel: first one using JBoss and second project that used SOAP client which translated requests to/from REST. SOAP client approach was more stable (in comparison to RESTfull client from vendor - as the RESTfull client connects to Siebel internally using Java Data Bean) on Siebel 7.8.
In both cases we picked REST to talk to iOS as it allows easier deveopment on iOS side and also possiblity to easly utilize it in projects creating webpages to simplify/tune siebel GUI for different purpose..
If you're current system is sample db, then you have installed developer instance of Siebel. It uses a Sybase database. The server installation will use Oracle/MSSQL server. If you are ok with database connection, you can check that.
For Webservices, by default , Siebel does not support JSON/REST api. Only the older SOAP structure is supported. You will have to go through oracle bookshelves to setup an inbound webservice in Siebel.
But just to add, the latest version of Siebel's UI uses javascript/CSS, and runs on any browser, including IOs .

How can I use the Bloomberg API with Delphi?

I would like to connect to Bloomberg - data stream of stock quotations to our trading system written in Delphi.
The API libraries provided for download on the Bloomberg website (http://www.bloomberglabs.com/api/libraries/) do not include a version specific for Delphi.
Is there a way to access the Bloomberg API from Delphi if only C/C++, Java, .Net, Perl and Python libraries are available?
You can use without any problem the C/C++ SDK and map function calls into Delphi with the external keyword . Take a look at this example for more information .
However as someone stated in the comments since the API you are talking about just embed calls to a web service, you could just call the web service from Delphi or define your own API on Delphi based on the web service spec. You can just have a look at the source of the C/C++ and try yo convert it to Delphi.
If calling directly the web service or converting the the API to Delphi is not an option for you, you can just use the C/C++ API as external functions call.
Usually if I encounter the need to consume a web service where Delphi integration is not easy, I recommend to write a thin 'proxy' with one of the available SDKs.
Communication between the proxy and the Delphi side then can be implemented using simple file transfer, or a network protocol (such as HTTP).
In this case it could be:
(Bloomberg) <== Java SDK ==> (Java proxy) <== HTTP ==> (Delphi application)
The key advantage is that a first protoype can be implemented very quick, because all required parts are already present:
download SDK and create a Java web service (server) project
create small Delphi prototype which sends a HTTP request using Indy
in the Java web service, map the request parameters to a BB API call
map BB API call response to a Java web service response
read response in Delphi application

Should I port my WebBroker projects to Indy

Long ago I started some "web applications" using Delphi 2007 and WebBroker (TWebModule). At the time I assumed you needed a webserver such as Apache or Microsoft IIS in order to create any sort of website. Additionally I don't use most of the Apache features (except for Virtual Server so I can have multiple domains on a single ip address and SSL). So to me Apache is just an extra layer and makes makes debugging difficult.
Now enter Indy (TIdHTTPServer). If I understand correctly, Indy IS a webserver. So by using Indy I am no longer bound to use Apache or some other webserver. Is this correct?
Will I have any issues supporting the Virtual Servers in an Indy environment? And what about SSL. I have searched the literature and from what I can see it fully supports SSL certificates.
I am now in the process of porting some of my application from WebBroker to Indy. This mostly entails replacing within my code references of Request: TWebRequest with ARequestInfo: TIdHTTPRequestInfo and references to Response: TWebResponse with AResponseInfo: TIdHTTPResponseInfo.
Is there anyway to use the TWebModule architecture within Indy so that I don't need to do all of this rewriting?
Lastly is there anything else I need to be concerned with? My goal is to take Apache out of the loop.
Yes, you can use Indy's TidHTTPServer as a webserver, but it's much lower-level than IIS or Apache. There is no concept of virtual servers - this you would have to implement yourself.
Indy does support SSL as well via the OpenSSL dll's.
I imagine the biggest concerns you will have will be security related...there are millions and millions of sites running Apache or IIS and there are a ton of people devoted to finding flaws in those platforms, with a bunch of people fixing some of those flaws as they come up. Not so with Indy... there's one or two guys that respond on newsgroups to bugs that you discover. (One guy in particular, who will probably respond to your question here as well.)
Now, I use Indy HTTP server (along with SecureBlackBox SSL support) and I find it to be great for my purposes.
Indy HTTP server calls the WinSock API, and is able to implement:
A full HTTP/1.1 server;
A full HTTPS server (using either OpenSSL libraries or other third parties, like SecureBlackBox).
AFAIK you can use Indy to publish web modules.
See http://www.2p.cz/files/2p.cz/downloads/howto/indy_soap_web_services_in_delphi.pdf
You can also use other servers, for instance directly the kernel-mode http.sys server, which is used by ISS and .Net WCF for instance, and known to be very stable and efficient (it bypasses the WinSock APIs). Of course, it will serve HTTPS conent, if needed. It is available in standard since Windows XP SP2, and therefore in Vista and Seven. Using this component will let Microsoft will do all the debugging work for you, and it will be updated with the host OS. I use it for instance in our Client-Server ORM, or directly to replace a deprecated DCOM connection, with very good speed and stability on customer side.
Regarding virtual servers - the HTTP 1.1 spec requires clients to send a Host request header so virtual servers know which domain is being used specifically to handle the case when multiple domains have the same IP. TIdHTTPRequestInfo has a Host property for that value. In fact, TIdHTTPServer internally validates to makes sure that an HTTP 1.1 request has the Host header before firing any of its OnCommand... events.

Delphi SoapServer application

Is it possible to convert Delphi SoapServer application to use TCP/IP?
From your comment to your question it sounds like you are looking to get rid of SOAP, and use something else to communicatie over a TCP/IP connection.
The question one could ask is why do you want to convert to non-SOAP comm over TCP/IP?
But the answer to whether it is possible is: of course this is possible, there are many application servers using TCP/IP for communication without using SOAP as their communication's protocol.
You will need some kind of protocol for communication between server and clients. You could roll your own, but doing what SOAP is doing for you now: receiving and responding to commands from clients (or method invocation) and marshalling data/objects between server and clients is not a trivial task.
So I'd suggest you have a look at other remoting libraries for client/server communication, such as:
Remobjects: http://www.remobjects.com/
kbmMW: http://components4developers.com/
As others have said, SOAP is just XML on http/https, and usually does already use TCP.
That said, you could simply treat it as raw socket data or http data. i.e. you could make a client that just uses http POST to send a string to the server. The string would contain an XML SOAP request, and would be treated by the server as if it were SOAP. Likewise, you could build the server in a non-SOAP fashion, just accepting XML and returning XML, and the client wouldn't know the difference.
You can use Fiddler2 to play with this. You can build requests and send them via HTTP Post. The server has no idea that you're not a SOAP client.
Chris
If you're talking about pre-Delphi
2009 DataSnap, meaning COM based
DataSnap, then you have to use a third
layer utility to do the communication.
That utility named sockets.exe is
included with Delphi, and is in the
same dir as Delphi (Program
Files\\\\bin
If it is Delphi 2009 or better, then
DataSnap has built-in TCP/IP
functionality. You use
TDSTCPServerTransporter component.
Update: Ups! for some reason I did read DataSnap SoapServer (wich neither exists, but I did think of Soap Connection).
A Soap Server Application needs the "server" part, meaning a web server. SOAP is an technologie that runs over HTTP protocol, so I don't think it could be "converted".
DataSnap could do the job, or Indy TIdTCPServer or some of the derived classes.

Resources