Would it be possible to use web services from a Cobol program? - web-services

We have some COBOL programs in our financial applications which need to interact with some of our backend systems. One of the available interfaces is through a web service. Can a program written in Cobol make requests to a web service?

Microfocus provide a tool called Enterprise Server which allows COBOL to interact with web services.
If you have a COBOL program A and another COBOL program B and A calls B via the interface section, the tool allows you to expose B's interface section as a web service.
For program A, you then generate a client proxy and A can now call B via a web service.
Of course, because B now has a web service any other type of program (command line, Windows application, Java, ASP etc.) can now also call it.

I've never used COBOL but from quick Google search it looks like it's possible.
This looks like it'll help, and talks about integrating webservices with cobol through c code.

What platform is this on? IBM's CICS supports webservices invokationnn from cobol program via EXEC CICS INVOKE.

ibm is now trying to implement a technology called embedded websphere with java.
ibm belives this is the only way to give the life to mainframes.

I know I can write a WebService with Delphi and call a COBOL DLL or
call a Delphi dll to comunicate with webservice.
Right now Im writing a webservice client, it will be a DLL, and Ill call from old COBOL systems.

If you have and are using CICS, it has built-in mechanisms for that. But assuming you can't use that for some reason, you can build an HTTP client using the IBM TCP/IP 'EZASOKET' modules.
I work for a company with a z/OS system running mostly COBOL, batch (JCL) and CICS. To call webservices, we wrote a module to implement HTTP 1.0 using TCP/IP. With modules
EZASOKET
GETHOSTBYNAME
SOCKET
CONNECT
WRITE
FCNTL
READ
CLOSE
SELECTEX
supplementary modules:
EZACIC04 translates EBCDIC to ASCII
EZACIC05 translates ASCII to EBCDIC
EZACIC06 convert character to bit mask
EZACIC08 decode IP address
Since I wrote this for my company, I can't just give out the code. But for reference, it took me 3 days to write the module (plus a little debugging later), and that was with an example to start with that did a partial hacky way of doing it.
You will need to read through IBM's references to know how to use the EZA modules.
http://publib.boulder.ibm.com/infocenter/zos/v1r11/index.jsp?topic=/com.ibm.zos.r11.halc001/sampcs.htm

Related

c++ wcf client duplex

I have a WCF service that uses duplex contracts via a netTCP binding. It's basically a chat server that relays the messages it receives to the connected clients. The service, and the C# client work great.
What I want to do is create an unmanaged C++ client for the service. Is this possible? And if so, how is this achieved?
I'm ok with using 3rd party libraries, just no .Net
use the little-known WWS - Windows Web Services. This is basically WCF but native code. Its much smaller in size and much faster - MSDN magazine shows some benchmarks (yeah, ok) that say WWS handling SOAP is faster than WCF's Net.TCP. WWS net.tcp calls are several times faster than WCF :)
WWS also runs with a much reduced working set, 500kb vs 4.5mb for the simplest of simple services.
That link has sample code for you.
I think you get this library for free in Windows 7. You can get it for XP as a separate download.

How to make windows XP service act as SOAP Web Service?

Assume I have simple program (executable compiled from a C program)that provides text information running as Windows XP service. AFAIK Windows service can communicate with any external process running on the same PC but not with remote processes. How can I convert this windows service to SOAP Web service so that it responds to any any SOAP requests from any remote host?
What are the steps for this like what library to use (not .NET) ?
There's no magic library that will do it for you, you have to create a Program yourself and expose a SOAP endpoint with the service functionality.
Windows processes can communicate with other processes if those process offer a way for that communication to happen (inter-process messaging, reading system event queues, etc), so assuming your C program do offers a way for that communication to happen, your new program can feed that program the input, get the text information and return it to the client consuming your web service.
If you don't want to use .NET maybe you can use some other high level language like Java, Ruby or Python than can help you get your service up un running faster, but you have to create a program yourself, there's no magic library to wrap a program in and make it a SOAP web service.

Rails WebService and C++ application to expose

(Sorry for my english)
First: I have an application created using C++ (this is for performance needs), this application uses an image to make some processing and returns a simple answer (1 or 0 ).
Now I need to expose this application from a webservice.
I think to create a webservice using Rails, but I don't know if it's possible using rails to call the C++ process..
The idea is to use the webservice to get an image sent by a client, pass this image to the C++ application and return (using the webservice) a message to the client, based on the result of C++ application.
Is this possible?
Any example or guideline?
Thanks in advance
EDIT: Solved using Thrift thrift.apache.org
I read something about Thrift .. but i think maybe i can't use to solve this problem (maybe) ..
The idea is use a mobile application (iOS and/or Android) where the user can upload an image to the service. The service take the image and make some image processing, this part (the processing) was written with C++ as standalone application that receive an image and return a message, so when the processing is done, the service receive the result (a message) from the processing app and return this to the mobile application.
So.. is this possible with Thrift (if so, i need to read more)? o i need to use something else?
Thanks in advance
I have never done that before, but I think you should take a look at Thrift which was initially developed by Facebook and allows you to make multiple languages work together via RPC calls.
Thrift allows you to define data types
and service interfaces in a simple
definition file. Taking that file as
input, the compiler generates code to
be used to easily build RPC clients
and servers that communicate
seamlessly across programming
languages.
I encourage you to search on Google with the following keywords : thrift C++ rails webservice etc.

Integrating C++ code with any web technology on Linux

i am writing an program in c++ and i need an web interface to control the program and which will be efficient and best programming language ...
Your application will just have to listen to messages from the network that your web application would send to it.
Any web application (whatever the language) implementation could use sockets so don't worry about the details, just make sure your application manage messages that you made a protocol for.
Now, if you want to keep it all C++, you could use CPPCMS for your web application.
If it were Windows, I could advice you to register some COM component for your program. At least from ASP.NET it is easily accessible.
You could try some in-memory exchange techniques like reading/writing over a localhost socket connection. It however requires you to design some exchange protocol first.
Or data exchange via a database. You program writes/reads data from the database, the web front-end reads/writes data to the database.
You could use a framework like Thrift to communicate between a PHP/Python/Ruby/whatever webapp and a C++ daemon, or you could even go the extra mile (probably harder than just using something like Thrift) and write language bindings for the scripting language of your choice.
Either of the two options gives you the ability to write web-facing code in a language more suitable for the task while keeping the "heavy lifting" in C++.
Did you take a look at Wt? It's a widget-centric C++ framework for web applications, has a solid MVC system, an ORM, ...
The Win32 API method.
MSDN - Getting Started with Winsock:
http://msdn.microsoft.com/en-us/library/ms738545%28v=VS.85%29.aspx
(Since you didn't specify an OS, we're assuming Windows)
This is not as simple as it seems!
There is a mis-match between your C++ program (which presumibly is long running otherwise why would it need controlling) and a typical web program which starts up when it receives the http request and dies once the reply is sent.
You could possibly use one of the Java based web servers where it is possible to have a long running task.
Alternatively you could use a database or other storage as the communication medium:-
You program periodically writes it current status to a well know table, when a user invokes the control application it reads the current status and gives an appropriate set of options to the user which can then be stored in the DB, and actioned by your program the next time it polls for a request.
This works better if you have a queuing mechanism avaiable, as it can then be event driven rather than polled.
Go PHP :) Look at this Program execution Functions

Can a Silverlight client talk to a C++ server?

Our company wants to transform our current user interface to a web client. We are considering to use Microsoft's Silverlight for this, but it will need to communicate with our legacy C++ server application (native C++, not C++/CLI). I am wondering whether it would be feasible to write such an IPC library by hand, our otherwise whether there are ready-made IPC protocols available both as a C++ and a Silverlight library.
Update: I emphasize the programming languages used because they determine which libraries can be used. For example, a library written for .NET's intermediate language cannot be used by a native C++ application.
You can certainly do this -- on my desktop right now, I'm running a C++ server application in one instance of Visual Studio, a Silverlight application in a second instance, and the Silverlight app is talking to the C++ server over sockets. However, there are several significant caveats:
(1) Silverlight will only talk to a small range of ports (4502-4532), so you may need to modify the server (or insert a proxy of some sort) to allow Silverlight to talk to it;
(2) The server has to serve up a socket policy file on port 943; and
(3) You can't easily use traditional higher-level access mechanisms like RPC or what-not. If the C++ server expects a particular protocol, you're going to have to write all the stuff yourself in Silverlight/C#. That's not necessarily rocket science, but if you're not familiar with sockets programming, there's a learning curve. Expect to spend a lot of time dealing with byte[] arrays, Buffer.BlockCopy(), BitConverter.GetBytes(), and what-not.
An alternative would be to wrap the C++ server with a WCF server, and then call the WCF server from Silverlight. WCF is generally a lot slower than sockets, but it's also a lot easier to call in Silverlight.
You can use TCP sockets or WebServices to connect to your application. You will probably need to write a gateway application (one that connects the socket based clients with your C++ server application) for this though.
You have at least 3 ways to do it:
Direct socket communications - lots of C++ libraries around (Winsock, wxWidgets)
Web-services - not that pretty in C++ compared to Java/C# but there are tools like gSoap
Simply use plain old HTTP requests. GET/POST from Silverlight (easy), and send back some XML or JSON data (or XAML) which you build manually in C++ (or there are bound to be C++ libs for this too)