How can z/OS call a web service? [closed] - web-services

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a COBOL program that needs to get data from a web service. Without using CICS what are my best options? I thought that a C program could read the web service and save it to a file, then the COBOL could read that file. Can COBOL call a web service? The data is about 300mb in size.

Use 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, and that was with an example to start with that did a partial hacky way of doing it.
You'll 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

It is possible to call java from COBOL programs on z/os.
We have done it in our company.
You have to specify that it is RECURSIVE
You have to import the classes
Class HelloJ is
"com.ibm.zos.batch.container.test.HelloJ"
Class JavaException is "java.lang.Exception"
Class BCDTranHelper is
"com.ibm.batch.spi.UserControlledTransactionHelper".
The you have to include JNI.
LINKAGE SECTION.
COPY JNI
***Then you can invoke java from COBOL in your PROCEDURE DIVISION with:
Invoke HelloJ "sayHello"
Also look at Java Exception Check * to see how to handle the exceptions.
This is very useful if you want to invoke a web service from your COBOL program on z/os.
see this link for more details.
http://pic.dhe.ibm.com/infocenter/zos/v1r13/index.jsp?topic=%2Fcom.ibm.zos.r13.iean500%2Fcodeexm.htm

Maybe have a look at this article. It suggests creating a C/C++ wrapper interace to the web service. Although this article is for iSeries, you might be able to implement something very similar under zSeries using BPXBATCH
Basically, they suggest using a C wrapper between your COBOL code and the C++ code that interfaces with the web service. This solution allows COBOL to call a C function in a relatively straight forward way. The C function mimics C++ behavior by implementing the call to the Web service using a C++ proxy.

If you can use Java at your site calling Java from a cobol program to access the web service may be an option. Assuming your using Enterprise cobol check out section 6.44 of Java Stand-alone Applications on z/OS Volume II

Use the z/OS client web enablement toolkit if you are at z/OS 2.1 or above.
Look at the sample in SYS1.SAMPLIB(HWTHXCB1) for Cobol.
If your Cobol is running under DB2 DSN command, you can also use SOAPHTTP* scalar functions.

Related

How to compile C++ code for Roku? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have an android streaming client application which uses Java and cpp code. I want to port my application to Roku. I understand that Roku recommends only BrightScript for apps development.
1) According to this link (C/C++ development in Roku), gaming application can be written in cpp using marmalade and compiled for Roku.
2) But this link (How feasible is Roku app development with Marmalade?) clearly says marmalade can not be used for streaming application.
3) My questions are
(A) Is it possible to compile cpp for for roku?
(B) Where can I find the toolchain for building?
(C) If UI is developed using BrightScript, how can I call cpp functions from it?
You can't. Not independently from Roku Inc anyway - you will need a very close collaboration from them, which means you should be able to persuade their business development/partners department you are worth time and money. In other words, your company better be a household name.
You cannot "find" the C toolchain, it may only be bestowed to you by the Co on individual basis, after approval and under NDA.
If you don't have special relationship (project/contract) with Roku Inc, for non-games you can only develop in BrightScript. It's a mandate, not recommendation.
Specifically for your case, best option seems to be to use the already existing streaming formats/components the Roku API already provides. BrightScript is a script language, not fast enough to write a codec.
You have to use brightscript for Roku Streaming applications.

Running stored procedures of a SQL server from c++ code [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a database in SQL server and have already created stored procedures which run on the data stored in this database. The client code of this databse is a native c++ windows service code. what I need is simple, connecting to the sql server from my c++ code, run the stored procedures ( sending the input parameters and getting the output) and closing the connection. How can I do this?
I found many solutions for connecting to db from c++ code but they are all based on some framework ( .Net, MFC, or some other managed c++ etc...) but my code is pure native legacy cpp code written in VS 2005 and for some compatibility reasons need to stay as it is.
I really appriciate any comments/ hints.
Use the SQL Server Native Client. This is a native library that provides OLE DB access to SQL Server. The client library itself is based on COM (as befits its object-oriented design):
This page provides a straightforward example of how to connect to a database server: https://msdn.microsoft.com/en-us/library/ms131323.aspx
And this page describes (though without giving an example) how to execute a command: https://msdn.microsoft.com/en-us/library/ms131427.aspx
A class and interface reference is provided here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms711625(v=vs.85).aspx

Writing C++ for the Web [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Is it possible to create a C++ application that can be run trough the browser? Is there any way to link C++ application with a database (that can be used by both Mac, Linux and Windows).
It's perfectly possible to do it, back in the day (when there was no PHP around), many web applications were written in C++. There is a standard called CGI that facilitates communication between your application and your web server. This tutorial shows hot to set it up for an Apache web server, using Perl as the target language. You should be able to write a C++ program that prints out the same text and test it.
Databases can be accessed using C++ using a variety of libraries, depending on your needs and database system.
While all of this is totally possible, I'd be interested why you would do such a thing in the days of sophisticated frameworks and languages that are far more suited to web applications than C++. I'd certainly not recommend it.
CGI or FastCGI for server side C++.
NaCl for client side C++.
Database connections with things like MySql Connector.
If by "through the browser" you mean a webapp, yes - you can write CGI applications in C++, as in most other languages. See the answers to this question.
wt is a toolkit that may make it easier for you if you come from a desktop background.
About the portable database layer, take a look at these two questions. If all you need is a database that works across platforms, but don't need to be able to switch database engines across platforms, SQLite may be the way to go.
If you mean by "run through the browser" to run native code in the browser the only way I know of to execute native code in the browser is Google's NaCl.
For server side C++ no special rules apply and it's very common. All normal rules for C++ application (including databases and linking) apply here.
Any scripting langauge can run COM. You can create COM objects in C++ that you can invoke serverside from php.
Is it possible to create a C++ application that can be run trough the browser?
I'm not sure what you mean by "run through the browser" (or, for that matter, "C++ application"). pmr has already mentioned Google NaCl as one option. If "C++ application" includes C++ plugins, then "sure, you can." You can compile C++ to Javascript. If you're talking about web sites or web services, I can say "yes, it's possible; I maintain a web service that uses C++ for the backend, and Amazon was once written in C++, do you have any particular question?"
It's possible to write a lot of things in a Turing complete language. That doesn't mean it's a good idea.
Is there any way to link C++ application with a database (that can be used by both Mac, Linux and Windows).
Again, I'm not sure what you mean by "link ... with a database." You certainly can interact with a database using things like ODBC, DTL, LDAP or MongoDB. You also can embed a database in your program, using things like SQLite, MySQL embedded, Firebird embedded, Berkeley DB, LevelDB, or whatever Microsoft's calling Microsoft Jet these days. Do you have a particular question?

A scripting language for web services apis for handling documents? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm investigating using a scripting language in order to call a web service that handles documents in a repository database. I'm thinking about powershell or perl, but I don't have much experience with using scripts to call web services.
As far as the api's, they are mostly just get/put operations for the files and the files are xml based.
We are looking at scripts as something that would be easy to use, compact code, portable, and rapid implementation.
The script has to run on windows boxes, XP I think, and the document file transfers are going to be very large due to embeded graphics in the documents, like around 10gbs.
Does anyone have any experience with this and has a recommendation, based on the above items?
I'm a bit biased because I'm a Java developer, but you ought to consider Groovy. It works seamlessly with the rest of the Java stack, but has dynamic syntax. If you are doing REST you can do something like this (GET example):
def response = "FULL_URL_STRING_WITH_PARAMS".toURL().text
That will take a string, convert it to a URL, fetch it and put the response in a string named response in a single line. Groovy has a lot of things like that for handling networking code and its XML and JSON APIs are really slick. For example, this is how you would parse a XML response (using RSS as an example):
def rssFeed = new XmlSlurper().parseText(response)
rssFeed.channel.item.each { item ->
println "${item.title} ${item.pubDate}"
}
The JsonSlurper works the same way with raw JSON output.

How to write a good program for blocking unwanted / harmful websites [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I intend to write a simple application that will block network traffic (HTTP and HTTPS) with unwanted / malicious web sites.
Assumptions:
At the beginning the logic will be simple. After entering in the browser the address from the "black list" my logic should take control under communication and send defined by me site contents
Later I want to add some logic that will search web body looking for unwanted / harmful words
The program will be written in C++
I do not want to use existing libraries (open source etc.) only write all from scratch. J just want to learn windows network mechanism and layers
Unfortunately, I am a layman when it comes to play with the network layer in Windows.
Where do I start?
Where and how should I inject my filtering logic?
You should look into Windows Filtering Platform. This API gives you access to the network stack at a very low level.
You have at least 2 options:
Build your own proxy that filters traffic and replace unwanted content and setup this proxy in browser settings.
Create NDIS filter driver. You can start reading about NDIS here. You can also find sample driver in WDK.
I would prefer the first option.
I a working on something similar in my spare time(as if I had any).
It's not very easy.
It depends a lot on the OS version.
There's LSP(Layered Service Provider) but as I understand it it doesn't work on Win 7 or later. There is an implementation of something similar to what you are trying to achieve here.
For Win 7 and above there is the filter driver alternative but I tested it and if the site is using SSL you won't see anything. You have to somehow handle this either within the driver itself or redirect the traffic to a man-in-the-middle proxy. I didn't get that far yet.
Anyway this is M$'s official sample. And you might also be interested in this.