How can I call a webservice from a COBOL program? I have no idea how to do this, can any one help and define steps?
Any sample code will be more hellpful.
Thanks
CICS Transaction Server documentation is available here. Select your version and release of CICS.
Invoking a REST web service from CICS COBOL can be done via the WEB OPEN, WEB CONVERSE, and WEB CLOSE application programming interfaces. The APIs are documented in the Reference section.
Invoking a SOAP web service from CICS COBOL requires some setup work, often via the CICS Web Services Assistant provided with CICS (search on DFHWS2LS) however your shop may make use of IBM's CICS Explorer or there are third-party tools your shop may have decided to acquire for this purpose.
The capability to invoke REST and SOAP web services has existed since at least 2005 when CICS Transaction Server 3.1 was made generally available.
In either case, you are best served by talking to your CICS support staff about what is allowed in your shop and how they and your security staff want to proceed. As these capabilities have existed for quite some time now, most shops likely have some policies and procedures in place governing their use.
Related
I am researching how to integrate Microsoft Dynamics NAV with my existing REST API (built on Django REST Framework). What I would like to do is trigger API calls from NAV to CRUD objects via the REST API.
Reading the web services docs for NAV, it seems clear that NAV can expose a web service for other software to consume from. But can NAV consume 3rd party APIs? In the web services examples documentation, it says:
Solutions that need to execute business logic or read data from
Microsoft Dynamics NAV are candidates for Web service implementation.
These can also be solutions that write data to Microsoft Dynamics NAV
and validate the data using existing business logic.
Also, it gives the following example of how to use web services:
Execute any kind of business logic that is more easily developed and
managed in Microsoft Dynamics NAV.
However, I don't see any examples of data writing. It doesn't seem that in the exposure of web service pages or codeunits, there's a way to make calls to 3rd party APIs and execute business logic with the data that comes back within NAV. Is this actually possible?
Unfortunately not, no.
You do however have access to the full .NET framework from within the 'Development Client' of Dynamics NAV - When defining your variables select the Type of DotNet
It's far from perfect, so for larger tasks I'll create AddIns or completely external libraries (depending on version).
For something smaller like this I personally find it easiest to write it in C# as a small (console) app and the 'translate' it back into Dynamics NAV.
If you are looking for way to invoke a web service then why do you need Nav web services? Nav web services is a way to call Nav.
These can also be solutions that write data to Microsoft Dynamics NAV and validate the data using existing business logic.
This means if you invoke published Nav web service then you can pass data to your call and the data will be validated and saved to Nav. So this is about how to push data to Nav, not pull from external system.
If you want to invoke a web service from Nav consider this options:
Write external wraper library (as mentioned by #SeeSharp or as described). Then use it in C/AL as DotNet or Automation types of variables.
Use existing libraries like 'Microsoft XML, v6.0'.XMLHTTP60 right in C/AL to make http calls to your web service.
Do it Navision style.
Last damn option is to write console application that will consume your web service and call it from Nav using shell. This is not an option, I know.
I have developed my first basic cics application which is an examination system. Now I want this to be available for everyone. I don't have any idea whether this is possible or not. Can anyone guide me or provide any links or books for deploying in a server. Thank you
If your application is in a CICS region, it is available to "everyone" who has access to that region and your transaction.
CICS is a web application server, among other things. Those applications can be written in Assembler, C, COBOL, Java, PHP, PL/I, or Rexx.
If your application uses 3270 for its user interface and you want to make it available via the web, you can use a feature of CICS Web Support specifically for that.
I am familiar with SOAP web services, and have done some PUT/GET/POST verbs in REST web services. Somewhere I read that your REST web service can return a code if something goes wrong at the web service, but can it return twice?
By that I mean: supposed your REST web service is querying a database and it is doing a lazy load, so it is taking a while. You intend to return an array of values from the database back to the client that called the REST web service. But while the REST web service is working on your database query, can it return a string that says "Query is 10% complete, please wait" or something like that? Can the REST web service call another web service that somehow communicates back to the client this information?
I doubt this is possible, otherwise I would have seen it, but I ask anyway.
Target platform is Visual Studio 2010 Professional with C# and MS Sql Server 2008
You could look at COMET, which according to wikipedia:
...is a programming technique that enables web servers to send data to the client without having any need for the client to request it. It allows creation of event-driven web applications which are hosted in the browser.
There are a number of articles on the web about doing this plus a couple of frameworks on sourceforge and github. However this is not trivial. I know it is possible with REST because a previous employer of mine has several real-time feeds based on RESTfull endpoints using COMET for push.
See here:
http://www.aaronlerch.com/blog/2007/07/08/creating-comet-applications-with-aspnet/
http://sourceforge.net/projects/emergetk/
https://github.com/Oyatel/CometD.NET
Say you have a SQL Server 2008 database. You build a SOAP web service. You then deploy or publish this using Visual Studio 2010 in one website. Now, using the same database, you build a REST web service, in a different solution. You deploy this on another website.
Can you consume the endpoints and/or .svc file of both the SOAP and REST web services, though they reference the same SQL Server 2008 database?
I don't see why not, but before I go down this path and spend days I'd like to make sure.
Also if there's a performance hit to the database if it is running both SOAP and REST at the same time--again, I don't see why it would matter, but I must make sure. Thanks.
The database is completely oblivious of how your clients submit requests. All it sees is ODBC (or whatever) connections running queries. You could have 20 people sitting in SQL Developer typing these queries manually, it wouldn't know any better.
So yes, you are right, your question makes no sense -- you can have as many different interfaces as you want, performance/load will be determined only by the queries executed.
SQL Server won't know anything of your web service - it will just receive queries and return the data to the calling connection (your server-side code in this case).
It doesn't care whether the query originated in VBA, Mgmt Studio, your SOAP service or all three.
Has anyone tried to build an e-commerce site atop MS Dynamics, using the new Web Services introduced in Nav 2009 ? I'd like to know what kind of load these web services can take, and what kind of resources can be read/written, and any other challenges that I can expect.
I intend to integrate an existing linux-based webapp via Web Services ...
Thanks.
Web services in NAV 2009 can call either CodeUnit or Page objects. Pages allow you to create, read, update and delete rows from their source table. CodeUnits offer greater flexibility, allowing you to invoke any action you can implement in C/AL. I think CodeUnit trigger arguements are limited to primitive types and Records.
NAV web services use Windows Authentication, so your linux app will have to be able to present Windows credentials accordingly. I'm not an expert in this area, so I'm not sure how difficult this is from a Linux machine.
With regard to the supported load, I would ask in the forum at mibuso - this is the largest community of experienced users I am aware of. I expect you will be limited by the CPU and memory of the web service host. NAV does not support clustering\load balancing on the web service tier, but I beleive it is possible to run several side by side.