64
© 2014 HelpSystems. Company Confidential. 8/26/14 1 Using XMLSERVICE with .Net Communicating with IBM i from .Net

Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

Embed Size (px)

Citation preview

Page 1: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 1

Using XMLSERVICE with .NetCommunicating with IBM i from .Net

Page 2: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 2

Presenter

Richard SchoenDirector of Document Management

27+ years of multi-platform developmentEmail: [email protected] Phone: (952) 486-6802

Page 3: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 3

Agenda

• Application Modernization• Introduction to Microsoft Technology• Introduction to XMLSERVICE• Introduction to XMLSERVICE for .Net• Live demo of XMLSERVICE with .Net code

Page 4: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 4

My Personal Journey with System Integration

• Integrate S/36 to DOS Turbo Pascal screen - HLLAPI (1988)• Windows 3.1, Microsoft Visual C/C++, Visual Basic 3 (1993)• APPC programming with PC Support to access RPG (1995)• TCP/IP, FTP from Windows to IBM i (1997)• Sockets programming with VB and RPG (2002)• Web development and web services (1997 – current)• IBM i access ODBC/OLEDB/ADO.Net (2000-current)• JT400 java API converted to .Net with IKVM (2005)• HTTP URL API – (AKA REST) – (2004 – current)• XMLSERVICE – universal open source communicator (2012)• RDI/Eclipse and Visual Studio• (1984 – today) The greatest computing era !!

Page 5: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 5

Application Modernization

• You need to do some modernization beyond 5250 • You need to educate your management on IBM i• Augment existing business apps with modern UI• Providing modern UI where necessary• No need to rip, replace or re-write existing business

systems• Take charge and educate ourselves• Our teams need GUI Apps, Management Reporting, Data Extraction,

Web Portals, Graphical Apps, Mobile Apps• Get some quick wins under your belt• Choose your poison RPG, PHP, Ruby, Java, Node.js, .Net• All use HTML, CSS, Javascript and back end data services

Page 6: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 6

Intro to Microsoft - Microsoft is Not the Enemy

• Microsoft development technology is proven • Microsoft Visual Studio Community is FREE• Microsoft .Net has been open sourced

http://www.dotnetfoundation.org

• Many open source projects on .Net foundation• Lots of free .Net education available on Internet• GUI Desktop Apps and Smart Clients• Command Line Console Apps, Windows Services• Web Apps, Web Services, Mobile• XMLSERVICE can be used with .Net

Page 7: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 7

Accessing IBM i Data and Services from .Net

• Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net• Using JT400 for database, program and IFS access• Using RPG and CL program calls and Stored Procs• Using RPG Service Programs• Repurposing an interactive RPG app to be a Stored Procedure• IWS Server – IBM i Integrated Web Services Server• CGIDEV RPG as a REST data service provider (XML, JSON, etc)• Web services via RPG, Java, PHP, Ruby, Node.js, .Net, etc.• XMLSERVICE – CGI service program hosted on Yips site

Page 8: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 8

What Is XMLSERVICE ?

• XMLSERVICE is a single library of Open Source RPG code that enables XML scripting calls of System i resources using most any language available on your platform.http://youngiprofessionals.com/wiki/XMLSERVICE

• XMLSERVICE RPG server library does not require other language products to run on your IBM i, however language teams often provide a client toolkit to greatly simplify XML calls to XMLSERVICE.

• Language vendors often provide compiled XMLSERVICE distributed with product installations (Zend Server, PowerRuby).

• IBM installing XMLSERVICE as part of technical refreshes ?• Original author Tony Cairns - IBM• Richard has developed a .Net wrapper API for XMLSERVICE

http://xmlservicei.codeplex.com

Page 9: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 9

Why Use XMLSERVICE ?

• Building multi-platform apps that need to access IBM i data• Building mobile apps that need access to IBM i data• Don’t want to deploy IBM Client Access and drivers - Windows• Don’t want to deploy JT400 – Windows, Linux, Mac, Android• Most development environments can make HTTP calls• Most environments can compose and decompose XML• Think of XMLSERVICE as a universal communicator for IBM i

Page 10: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 10

XMLSERVICE is FREE

•XML Service is completely free/safe commercial use download (Yips) • BSD license, download, keep any source copy forever (safe)

•XML Service written in RPG open source (you can change it) • Techniques used IBM i calls are stable, unlikely to change (ever)

•XML Service is supported Open Source • XML Service fix/add improvement goal is never impact current

customers

Page 11: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 11

XML Service - XML everything

• XML input <> XML output • Any device • Any language • Any local/remote connection • Any IBM i service (PGM, CMD, System API, DB2, PASE)

Page 12: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 12

XML Service - IBM i Native Access through XML

• Access Native IBM i Objects from any language using XML • Local or remote IBM i: IBM i local, IBM i-2-IBM i,

Linux/Unix/Windows-2-IBM, etc. • Any language access: PHP, Ruby, Java, Perl, RPG, .Net or no language at all

(HTML/XML)

Page 13: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 13

XML Service - IBM i Native Access through XML

Many Native Object Types• DB2 SQL – INSERT/UPDATE/DELETE/SELECT• Program call• Procedure call• Data Area• Data Queue• Message Queue• Commands• System values, • Spool files, PASE utilities

Page 14: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 14

XML Service - IBM i Native Access through XML

Local or remote call interfaces to XMLSERVICE • Primary: call DB2 stored procedures local or remote (iPLUG4K - iPLUG15M) • Secondary: call REST HTTP local or remote (xmlcgi.pgm)• Richard has used XMLCGI for all work so far• Richard has tested program /service program calls, CL DB2, DTAQ so far• You can test other calls or wait for me to do it

Page 15: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 15

XMLSERVICE Moving Parts

Page 16: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 16

XMLSERVICE Moving Parts

• Any language • Browser HTML/XML • Script PHP, Ruby, Java, JavaScript, Node.js, etc. • Compiled RPG, C, etc. • Microsoft .Net

• Any local/remote connection • Linux/Unix/Windows/Mac ibm_db2/odbc/REST to IBM i• Native IBM i ibm_db2/odbc/REST to IBM i

Page 17: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 17

XMLSERVICE Set Up Overview

• Restore XMLSERVICE library. Source only. Need to build• Run CRTXML CL program to build XMLSERVICE objects• Create XMLSERVICE Apache instance• Configure XMLSERVICE Apache Instance • STRTCPSVR SERVER(*HTTP) HTTPSVR(XMLSERVICE) • Test using RJS XMLSERVICE .Net wrapper• Note: If you plan to XMLSERVICE over the web,

SSL would be a good idea but not covered here.

Page 18: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 18

Building XMLSERVICE Objects• Download XMLSERVICE source library save file from Yips site

http://youngiprofessionals.com/wiki/uploads/XMLSERVICE/xmlservice-rpg-1.9.2.zip

• Upload and restore XMLSERVICE source library save file instructionshttp://youngiprofessionals.com/wiki/index.php/XMLSERVICE/XMLSERVICEInstall

• ADDLIBLE XMLSERVICE• WRKMBRPDM FILE(XMLSERVICE/QCLSRC) • Find CRTXML member and change type to CLP.• Use option 14 to compile CRTXML –or-

CRTCLPGM PGM(XMLSERVICE/CRTXML) SRCFILE(XMLSERVICE/QCLSRC)• CALL CRTXML to create XMLSERVICE objects

Page 19: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 19

Creating Apache Instance• Navigate to http://1.1.1.1:2001 in browser and log in.

Use your IBM i IP address or host name

• Your ADMIN HTTP instance must be running. It usually is.WRKACTJOB SBS(QHTTPSVR)and look for ADMIN jobs.

• STRTCPSVR SERVER(*HTTP) HTTPSVR(*ADMIN)

Page 20: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 20

Creating Apache Instance

• Select Internet Configurations from left tree menu• Select IBM Web Administration for i to create web server instance

Page 21: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 21

Creating Apache Instance

• Select Create HTTP Server to create new Apache instance

Page 22: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 22

Creating Apache Instance

• Enter XMLSERVICE or a desired HTTP instance name.

Page 23: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 23

Creating Apache Instance

• Click Next to continue. You can change setting if desired.

Page 24: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 24

Creating Apache Instance

• Click Next to continue. You can change setting if desired.

Page 25: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 25

Creating Apache Instance

• Enter port 30000 or your desired TCP/IP port and click Next

Page 26: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 26

Creating Apache Instance

• Click Next to continue. You can change setting if desired.

Page 27: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 27

Creating Apache Instance

• Click Next to continue. You can change setting if desired.

Page 28: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 28

Creating Apache Instance

• Click Finish to complete your Apache server instance creation

Page 29: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 29

Creating Apache Instance

• Under Tools, select Edit Configuration File• We have to enable calls to XMLSERVICE

Page 30: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 30

Creating Apache Instance

• Enter or copy/paste config info and click OK to save configuration• Sample config info can be found on next slide

Page 31: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 31

Listen *:30000 DocumentRoot /www/xmlservice/htdocs#Apache rest configuration (CGI interface) #Example: Add the following to /www/zendsvr/conf/httpd.confScriptAlias /cgi-bin/ /QSYS.LIB/XMLSERVICE.LIB/ <Directory /QSYS.LIB/XMLSERVICE.LIB/> AllowOverride None order allow,denyallow from all SetHandler cgi-script Options +ExecCGI

</Directory> #Optional for server side includes (very handy for pure html/xml sites): # server side includes Options +ExecCGI +Includes AddType text/html .shtmlAddOutputFilter INCLUDES .shtmlAddOutputFilter INCLUDES .html

IBM i Apache Server Basic Config

Page 32: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 32

Creating Apache Instance

• Click the green play button to start your Apache server instance

Page 33: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 33

Creating Apache Instance

• Navigate to site URL to test. http://1.1.1.1:30000• Default index.html home page should display. If so you’re done.

Page 34: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 34

XMLSERVICE Check Apache Web Server Instance Jobs

• WRKACTJOB SBS(QHTTPSVR) and check for XMLSERVICE active jobs

Page 35: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 35

Why write a .Net wrapper for XMLSERVICE ?

• Creating XML requests are time consuming• Simplify IBM i calls for .Net developers• Simplify communications by using HTTP/HTTPS• Remove the need to know any XML• No more IBM i Access requirements for applications• Single .Net DLL Assembly to distribute with .Net apps• Quickly consume query results as .Net DataSets• Quickly call programs and subprocedures with parameters• XMLSERVICE for .Net is Open source

http://xmlservicei.codeplex.com

• Wrapper can be extended just like XMLSERVICE itself

Page 36: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 36

• Compose XML command or query string in code• Post string to Apache Server URL to call XMLSERVICE via HTTP/HTTPS• Retrieve Raw XML response data• What to do with the response data ?• DB Query – decompose XML to a .Net Dataset• CL Command – decompose XML and scan for errors• Program and procedure calls - decompose XML for return parms• XMLSERVICE .Net wrapper simplifies the process

XMLSERVICE .Net Calls Work via XMLCGI

Page 37: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 37

XMLSERVICE .Net Uses IPC for Stateful Connections

• XMLSERVICE.Net wrapper uses IPC for stateful connections.• Creates an IFS directory in /tmp for each named IPC connection• Creates an XTOOLKIT job• Allows multiple calls using same connection• Sub-second response after initial call• Use same QTEMP library• Starts new job on IBM i to service requests• You can manually kill active XTOOLKIT IPC jobs

Page 38: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 38

XMLSERVICE Spawned IBM i Job

Page 39: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 39

XMLSERVICE IPC /tmp directories

Page 40: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 40

• Install XMLSERVICE on its own Apache instance• Enable SSL connectivity to IBM i and IIS (if needed)• Ideally never expose XMLSERVICE directly to the Internet• Keep IBM i two layers back from Web• Never disable XMLSERVICE user ID and passwords• Limit IP addresses that can access XMLSERVICE• Review available Apache security settings

.Net Application Architecture with XMLSERVICE

Page 41: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 41

• Desktop Apps – WinForms and WPF• Smart Clients – Online and Offline • Web Apps – WebForms, MVC• Web Services – SOAP, REST, XML, JSON• Console Apps / Command Line Apps• Windows Services – Top Shelf• Mobile Apps – Use .Net for Data Services

.Net Application Types Supported

Page 42: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 42

ASP.Net Web App Architecture with XMLSERVICEIBM i

Running XMLSERVICEApache Web Instance

Firewall/Cloudor Intranet

Windows Server - IISRunning ASP.Net App

Using XMLSERVICE .Net

HTTP Port 30000 or SSL (443) callsfrom .Net App to IBM i via XMLSERVICE

HTTP Port 80 or SSL (443) calls to ASP.Net web app on IIS

Mobile, Web or Intranet Users Access ASP.Net web apps

IBM i stays safely behind firewall

Web pages and business logic served via web application. jQuery Mobile, Bootstrap, etc.

Page 43: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 43

ASP.Net Web Service Architecture with XMLSERVICEIBM i

Running XMLSERVICEApache Web Instance

Firewall/Cloudor Intranet

Windows Server - IISRunning ASP.Net Web SvcUsing XMLSERVICE .Net

HTTP Port 30000 or SSL (443) callsfrom .Net App to IBM i via XMLSERVICE

HTTP Port 80 or SSL (443) calls to ASP.Net web app on IIS

Desktop, Mobile, Web or Intranet App Users Access ASP.Net Web and Data Svc

IBM i stays safely behind firewall

Apps send or receive XML, JSON or REST URL calls with web service

Page 44: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 44

Desktop App Architecture with XMLSERVICEIBM i

Running XMLSERVICEApache Web Instance

Windows Desktop AppsDesktop/Laptop/TabletUsing XMLSERVICE .Net

HTTP Port 30000 or SSL (443) callsfrom .Net App to IBM i via XMLSERVICE

Internal desktop applications can talkdirectly to IBM i via XMLSERVICEover HTTP Port 80 or SSL (443) calls

Page 45: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 45

Windows Service App Architecture with XMLSERVICEIBM i

Running XMLSERVICEApache Web Instance

Windows Service AppsDesktop, Laptop or Server

Using XMLSERVICE .Net

HTTP Port 30000 or SSL (443) callsfrom .Net App to IBM i via XMLSERVICE

Windows service applications can talkdirectly to IBM i via XMLSERVICEover HTTP Port 80 or SSL (443) calls

Page 46: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 46

The following XML string runs the selected SQL Select query

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110111250358&ctl=*sbmjob&xmlin=<?xml version='1.0'?> <?xml-stylesheet type='text/xsl' href='/DemoXslt.xsl'?> <script> <sql> <options options='noauto' autocommit='off'/> </sql> <sql> <connect conn='myconn' options='noauto'/> </sql> <sql> <prepare conn='myconn'>select * from qiws/qcustcdt</prepare> </sql> <sql> <execute/> </sql> <sql> <describe desc='col'/> </sql> <sql> <fetch block='all' desc='on'/> </sql> <sql> <free/> </sql> </script>&xmlout=500000

Tip: Might want to limit the number of records returned.

SQL SELECT Database Query XML Example

Page 47: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 47

The following XML string runs the selected SQL Insert query

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110111250358&ctl=*sbmjob&xmlin=<?xml version='1.0'?><?xml-stylesheet type='text/xsl' href='/DemoXslt.xsl'?><script><sql><options options='noauto' commit='none' error='fast'/></sql><sql><connect conn='myconn' options='noauto' error='fast'/></sql><sql><prepare conn='myconn'>insert into qiws/qcustcdt (CUSNUM,LSTNAM) VALUES(123456,'RJS') </prepare></sql><sql><execute/></sql><sql><describe desc='col'/></sql><sql><fetch block='all' desc='on'/></sql><sql><free/></sql></script>&xmlout=500000

Note: journaling and commitment control disabled currentlyWill add a setting to control.

SQL INSERT Statement XML Example

Page 48: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 48

The following XML string runs the selected SQL Update query

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110111250358&ctl=*sbmjob&xmlin=<?xml version='1.0'?><?xml-stylesheet type='text/xsl' href='/DemoXslt.xsl'?><script><sql><options options='noauto' commit='none' error='fast'/></sql><sql><connect conn='myconn' options='noauto' error='fast'/></sql><sql><prepare conn='myconn'>update qiws/qcustcdt set LSTNAM=‘Johnson’ where CUSNUM=123456 </prepare></sql><sql><execute/></sql><sql><describe desc='col'/></sql><sql><fetch block='all' desc='on'/></sql><sql><free/></sql></script>&xmlout=500000

Note: journaling and commitment control disabled currentlyWill add a setting to control.

SQL UPDATE Statement XML Example

Page 49: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 49

The following XML string runs the selected SQL Delete query

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110111250358&ctl=*sbmjob&xmlin=<?xml version='1.0'?><?xml-stylesheet type='text/xsl' href='/DemoXslt.xsl'?><script><sql><options options='noauto' commit='none' error='fast'/></sql><sql><connect conn='myconn' options='noauto' error='fast'/></sql><sql><prepare conn='myconn'>delete from qiws/qcustcdt where CUSNUM=123456 </prepare></sql><sql><execute/></sql><sql><describe desc='col'/></sql><sql><fetch block='all' desc='on'/></sql><sql><free/></sql></script>&xmlout=500000

Note: journaling and commitment control disabled currentlyWill add a setting to control.

SQL DELETE Statement XML Example

Page 50: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 50

The following XML string runs the selected CL command

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110111250358&ctl=*sbmjob&xmlin=<?xml version='1.0'?> <?xml-stylesheet type='text/xsl' href='/DemoXslt.xsl'?> <script> <cmd>SNDMSG MSG('TEST XMLSERVICE') TOUSR(QSYSOPR)</cmd> </script>&xmlout=32768

Note: make sure commands handle errors to avoid QSYSOPR errors/locks

CL Command XML Example

Page 51: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 51

The following XML string runs the selected program call with parms

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110030417059&ctl=*sbmjob&xmlin=<?xml version='1.0'?><pgm name='TESTCL1' lib='XMLDOTNETI'><parm><data type='50A'></data></parm><parm><data type='15p2'>100.00</data></parm></pgm>&xmlout=32768

Note: make sure programs handle errors to avoid QSYSOPR errors/locks

Program Call XML Example

Page 52: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 52

The following XML string runs the selected subprocedure with parms

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110030417059&ctl=*sbmjob&xmlin=<?xml version='1.0'?><script><pgm name='XMLSVC001' lib='XMLDOTNETI' func='SAMPLE1'><parm io='input'><data type='200A'>Test</data></parm><return><data type='200A'></data></return></pgm></script>&xmlout=32768

Note: make sure sub-procedures handle errors to avoid QSYSOPR errors/locks

Service Program Subprocedure Call XML Example

Page 53: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 53

The following XML string runs the selected data queue send program

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110031927974&ctl=*sbmjob&xmlin=<?xml version='1.0'?><pgm name='QSNDDTAQ' lib='QSYS'><parm><data type='10A'>XMLSVCTEMP</data></parm><parm><data type='10A'>QGPL</data></parm><parm><data type='5p0'>14</data></parm><parm><data type='14A'>This is a test</data></parm></pgm>&xmlout=32768

Note: Data queue must already exist

Send Data to Data Queue Call XML Example

Page 54: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 54

The following XML string runs the selected data queue receive program

db2=*LOCAL&uid=USER&pwd=PASSWORD&ipc=/tmp/xmlservicei20151110031927974&ctl=*sbmjob&xmlin=<?xml version='1.0'?><pgm name='QRCVDTAQ' lib='QSYS'><parm><data type='10A'>XMLSVCTEMP</data></parm><parm><data type='10A'>QGPL</data></parm><parm><data type='5p0'>14</data></parm><parm><data type='14A'></data></parm><parm><data type='5p0'>1</data></parm></pgm>&xmlout=32768

Note: Data queue must already exist

Receive Data from Data Queue Call XML Example

Page 55: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 55

• Functions we will review• CL command calls• Program Calls• DB2 query to .Net DataSet/DataTable• IPC to maintain state• Data queue send/receive• Test windows application

.Net Application Code Demo

Page 56: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 56

• Saw an overview on how to install XMLSERVICE• Learned a bit about how XMLSERVICE works• Saw XMLSERVICE for .Net in action• Code for this XMLSERVICE .Net example will be placed on

CodePlex• Just like XMLSERVICE the code is free, but unsupported• Email me if you have questions:

[email protected]• Start communicating with your IBM i using XMLSERVICE and .Net• Enhance what I’ve done and contribute changes• Have fun• DO NOT reach out to RJS or HelpSystems support teams• Slides and Sample XMLSERVICE for .Net Code

http://downloads.rjssoftware.com/files/classes/2015/xmlservicei-20151112.zip

Wrap-Up / What’s Next ?

Page 57: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 57

• http://yips.idevcloud.com/wiki/index.php/XMLService/XMLSERVICE• http://files.zend.com/help/Zend-Server-5.1-

IBMi/setting_the_xml_service_options.htm• http://yips.idevcloud.com/wiki/index.php/XMLService/XMLSERVICEConnect• https://support.zend.com/hc/en-us/articles/203076756-IBM-i-XMLSERVICE-

Toolkit-will-not-do-anything-even-after-restarting

Misc Web Links for XMLSERVICE

Page 58: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 58

Flexible IT Software SolutionsOur solutions help customers save time, money,and eliminate errors. Each functional area offers these benefits:

• Automate manual IT and business processes

• Remove costly scheduling gaps and delays

• Meet Service Level Agreements

• Avoid outages and network slowdowns

• Access real-time data from anywhere

• Run lightning-fast large queries

• View dashboards from any browser

• Present metrics in a user-friendly format

• Protect critical data at every access level

• Centralize user profile administration

• Eliminate viruses before they spread

• Stay informed when security event occur

• Simplify compliance and pass any audit

• Automatedocument capture

• Speed up approval processes

• Safeguard documents

• Reduce printing, storage and distribution costs

• Index documents via OCR or database

SYSTEMS & NETWORK MGMT. BUSINESS INTELLIGENCE SECURITY & COMPLIANCE DOCUMENT MANAGEMENT

Page 59: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 59

Core Software Areas

• Multiplatform Job Scheduling

• Network Monitoring and System Management

• System Security and Compliance

• Business Intelligence and Reporting

• Business Process Automation

• Document, Forms and Report Management

Page 60: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 60

Some of Our CustomersOver 350 of the Forbes Global 2,000 and 9,000 total customers worldwide

SYSTEMS & NETWORK MGMT. BUSINESS INTELLIGENCE SECURITY & COMPLIANCE DOCUMENT MANAGEMENT

7,079 Customers1 2,749 Customers1 957 Customers1 1,300 Customers1

1Customers may exist in multiple categories

Page 61: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 61

Helpsystems Family of Brands

Page 62: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 62

Solutions Portfolio

Page 63: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 63

30 Years of Growth and Innovation

Page 64: Using XMLSERVICE with - HelpSystemsdownloads.rjssoftware.com/files/classes/2015/IBMiDotNetWithXML... · • Using IBM i Access database drivers – ODBC/OLEDB/ADO.Net • Using JT400

© 2014 HelpSystems. Company Confidential.8/26/14 64

Thank you for attending today !

Contact Info

Website: www.helpsystems.com

Telephone: 800-328-1000 sales

+1 952-933-0609 support

Presenter Richard Schoen

[email protected]: 952-486-6802