Created
August 27, 2017 21:34
-
-
Save richardschoen/9256ff3d45cfb43eac28c15af2061ded to your computer and use it in GitHub Desktop.
IBM i XMLSERVICE remote command call sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using IbmiXmlserviceStd; | |
namespace IbmiXmlServiceCommandSample1Cs | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
String baseUrl = "http://1.1.1.1:30000/cgi-bin/xmlcgi.pgm"; | |
String ibmiUser = "USER1"; | |
String ibmiPass = "PASS1"; | |
bool useHttpCredentials = false; | |
bool rtncmd = false; | |
String clCmd = "SNDMSG MSG(TESTDOTNET) TOUSR(QSYSOPR)"; | |
XmlServicei _ibmi = new XmlServicei(); | |
// Set credential information | |
_ibmi.SetUserInfoExt(baseUrl, ibmiUser, ibmiPass, useHttpCredentials); | |
// Run CL command and return success or failure | |
rtncmd = _ibmi.ExecuteCommand(clCmd); | |
if (rtncmd) | |
{ | |
Console.WriteLine("Command was successful."); | |
Environment.Exit(0); | |
} else | |
{ | |
Console.WriteLine("Command failed."); | |
Environment.Exit(99); | |
} | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment