Non Ibmi Client Sql

XMLSERVICE.NonIbmiClientSql History

Hide minor edits - Show changes to output

March 03, 2014, at 02:56 PM EST by 24.125.120.102 -
Changed line 59 from:
http://youngiprofessionals.com/wiki/index.php/XMLSERVICE/RubySTRSQL
to:
http://174.79.32.155/wiki/index.php/XMLService/XMLSERVICERuby
Changed line 101 from:
Note the database option of ActiveXMLService::Base.establish_connection needs to specify and name that is listed in the Relational Database Directory Entries on your IBMi. Use the Work with Relational Database Directory Entries command (WRKRDBDIRE) to list your systems entries (there probably will only be one.)
to:
Note the database option of ActiveXMLService::Base.establish_connection needs to specify and name that is listed in the Relational Database Directory Entries on your IBMi. Use the Work with Relational Database Directory Entries command (WRKRDBDIRE) to list your systems entries (there probably will only be one.)
March 03, 2014, at 02:54 PM EST by 24.125.120.102 -
Changed lines 38-39 from:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly (following instructions at http://youngiprofessionals.com/wiki/index.php/XMLSERVICE/RubySTRSQL) . But if you have installed PowerRuby, change the location of the library containing the XMLService CGI program to POWER_RUBY, e.g.:
to:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly (following instructions at http://174.79.32.155/wiki/index.php/XMLService/XMLSERVICEInstall) . But if you have installed PowerRuby, change the location of the library containing the XMLService CGI program to POWER_RUBY, e.g.:
Deleted line 101:
March 03, 2014, at 02:53 PM EST by 24.125.120.102 -
Changed lines 38-39 from:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly (following instructions at http://174.79.32.155/wiki/pmwiki.php/XMLService/XMLSERVICEInstall) . But if you have installed PowerRuby, change the location of the library containing the XMLService CGI program to POWER_RUBY, e.g.:
to:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly (following instructions at http://youngiprofessionals.com/wiki/index.php/XMLSERVICE/RubySTRSQL) . But if you have installed PowerRuby, change the location of the library containing the XMLService CGI program to POWER_RUBY, e.g.:
Deleted line 102:
March 03, 2014, at 02:52 PM EST by 24.125.120.102 -
Changed lines 38-39 from:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly. But if you have installed PowerRuby, change the location of the library containing the XMLService CGI program to POWER_RUBY, e.g.:
to:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly (following instructions at http://174.79.32.155/wiki/pmwiki.php/XMLService/XMLSERVICEInstall) . But if you have installed PowerRuby, change the location of the library containing the XMLService CGI program to POWER_RUBY, e.g.:
Deleted line 103:
March 03, 2014, at 02:50 PM EST by 24.125.120.102 -
Deleted line 75:
  adapter: 'XMLSERVICE_IBM_DB',
March 03, 2014, at 02:44 PM EST by 24.125.120.102 -
Changed line 76 from:
  adapter: 'ibm_db',
to:
  adapter: 'XMLSERVICE_IBM_DB',
Deleted line 105:
March 03, 2014, at 02:43 PM EST by 24.125.120.102 -
Changed lines 67-69 from:
to:
With the xmlservice gem installed, you can create a Ruby file similar to the following to access your data:

March 03, 2014, at 02:37 PM EST by 24.125.120.102 -
Changed line 3 from:
!!! Ruby Toolkit Don, accessing table rows via XMLService SQL interface ...
to:
!!! Ruby: XMLService SQL interface ...
March 03, 2014, at 01:55 PM EST by 24.125.120.102 -
March 03, 2014, at 01:54 PM EST by 24.125.120.102 -
Changed line 84 from:
query = XMLService::I_DB2.new("select * from xmlsvcdb/topics")
to:
query = XMLService::I_DB2.new("SELECT * FROM xmlsvcdb/topics")
Changed lines 86-87 from:
rc = query.xmlservice_error
if rc
to:
if query.xmlservice_error
Changed lines 100-104 from:
Note the database option of ActiveXMLService::Base.establish_connection needs to be the Relational Database Directory Entry name on your IBMi. Use the Work with Relational Database Directory Entries command (WRKRDBDIRE) to list your systems entries (there probably will only be one.)



to:
Note the database option of ActiveXMLService::Base.establish_connection needs to specify and name that is listed in the Relational Database Directory Entries on your IBMi. Use the Work with Relational Database Directory Entries command (WRKRDBDIRE) to list your systems entries (there probably will only be one.)



March 03, 2014, at 01:52 PM EST by 24.125.120.102 -
Changed lines 71-72 from:
xml_con = ActiveXMLService::Base.establish_connection(
to:

ActiveXMLService::Base.establish_connection(
Changed line 74 from:
  adapter:  'ibm_db',
to:
  adapter: 'ibm_db',
Added line 105:
March 03, 2014, at 01:51 PM EST by 24.125.120.102 -
Changed lines 77-81 from:
  install:      'XMLSERVICE',
  ctl:          '*sbmjob',
  ipc:          '/none',
  size:        15000000,
  head:     
'<?xml version='1.0'?>'
to:
  install:  'XMLSERVICE',
  ctl:  '*sbmjob',
  ipc'/none',
  size: 15000000,
  head: '<?xml version='1.0'?>'
March 03, 2014, at 01:50 PM EST by 24.125.120.102 -
Changed lines 21-22 from:
Note the Listen directive above specifies a port number and you should chose one that is not is use. You could, however, add the above directives to an existing Apache instance. If you do create a new Apache instance, to test the server from your browser, you will need to alsow add DocumentRoot and Directory directives to provide access to htdocs:
to:
Note the Listen directive above specifies a port number and you should chose one that is not is use. You could, however, add the above directives to an existing Apache instance. If you do create a new Apache instance, to test the server from your browser, you will need to also add DocumentRoot and Directory directives to provide access to htdocs:
Changed line 58 from:
On your client, you will need to have the xmlservice Ruby gem installed.
to:
On your client, you will need to have the xmlservice Ruby gem installed. To do that visit the following link:
Changed lines 60-64 from:




to:
and download the latest XMLService.
Extract that download and then, from a terminal session, use the gem install command specifying the location of the downloaded gem. For example, on my Mac I used the following:

> gem install ~/Downloads/xmlservice-1.0.1.devel_GA18/xmlservice-1.0.1.gem

The command gem list should then show xmlservice.


[@
require 'xmlservice'
require 'net/http'
xml_con = ActiveXMLService::Base.establish_connection(
  connection: "http://192.168.168.65:4242/cgi-bin/xmlcgi.pgm",
  adapter:  'ibm_db',
  database: 'B608E5BA',              # WRKRDBDIRE to find your system's name
  username: 'DENONCOURT',
  password: 'secret',
  install:      'XMLSERVICE',
  ctl:          '*sbmjob',
  ipc:          '/none',
  size:        15000000,
  head:      '<?xml version='1.0'?>'
)
query = XMLService::I_DB2.new("select * from xmlsvcdb/topics")
query.xmlservice
rc = query.xmlservice_error
if rc
  puts query.dump_all()
end
puts query.dump_inspect
query.xml_output.each do |row|
  all = ""
  row.each do |n,v|
    all << "#{n}=#{v} "
  end
  puts all
end

@]

Note the database option of ActiveXMLService::Base.establish_connection needs to be the Relational Database Directory Entry name on your IBMi. Use the Work with Relational Database Directory Entries command (WRKRDBDIRE) to list your systems entries (there probably will only be one.)



March 03, 2014, at 01:40 PM EST by 24.125.120.102 -
Changed lines 38-39 from:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly. But if you have installed PowerRuby, change the location of the CGI to POWER_RUBY:
to:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly. But if you have installed PowerRuby, change the location of the library containing the XMLService CGI program to POWER_RUBY, e.g.:
Changed lines 58-59 from:

to:
On your client, you will need to have the xmlservice Ruby gem installed.
http://youngiprofessionals.com/wiki/index.php/XMLSERVICE/RubySTRSQL




March 03, 2014, at 01:38 PM EST by 24.125.120.102 -
Changed lines 38-59 from:
to:
The above example Apache httpd.conf configuration assumes that you have installed XMLService directly. But if you have installed PowerRuby, change the location of the CGI to POWER_RUBY:

[@
Listen *:4242
DocumentRoot /www/xmlservice/htdocs
ScriptAlias /cgi-bin/ /QSYS.LIB/POWER_RUBY.LIB/
<Directory /QSYS.LIB/POWER_RUBY.LIB>
  AllowOverride None
  order allow,deny
  allow from all
  SetHandler cgi-script
  Options +ExecCGI
</Directory>
<Directory /www/xmlservice/htdocs>
  order allow,deny
  allow from all
</Directory>
@]



March 03, 2014, at 01:36 PM EST by 24.125.120.102 -
Changed lines 8-9 from:

to:
You will need to set up an Apache server instance on your IBMi that has, as a minimum, the following in the httpd.conf:
Changed line 11 from:
DocumentRoot /www/xmlservice/htdocs
to:
Listen *:4242
Deleted lines 18-21:
<Directory /www/apachedft/htdocs>
  order allow,deny
  allow from all
</Directory>
Added lines 20-38:

Note the Listen directive above specifies a port number and you should chose one that is not is use. You could, however, add the above directives to an existing Apache instance. If you do create a new Apache instance, to test the server from your browser, you will need to alsow add DocumentRoot and Directory directives to provide access to htdocs:

[@
DocumentRoot /www/xmlservice/htdocs
ScriptAlias /cgi-bin/ /QSYS.LIB/XMLSERVICE.LIB/
<Directory /QSYS.LIB/XMLSERVICE.LIB>
  AllowOverride None
  order allow,deny
  allow from all
  SetHandler cgi-script
</Directory>
<Directory /www/xmlservice/htdocs>
  order allow,deny
  allow from all
</Directory>
@]

March 03, 2014, at 01:29 PM EST by 24.125.120.102 -
Changed lines 7-12 from:
The easiest way to test XMLService's program call is to use the Rails console. Otherwise you will need to create a controller to execute your IBMi program call, build a view to display the output, and then modify /config/routes with the URL to the controller action. Note that you can copy and paste lines of Ruby code into your QP2Term session. This document places the program call code in a Rails helper. That helper can later be used from a controller but, initially, to get comfortable with XMLService, we will invoke the helper method from the Rails console. We will be calling a program called ZZCALL that exists in the XMLSERVICE library that was installed with PowerRuby.

Be sure to set the Ruby and Rails version that was used when you created your Rails application before launching Rails console.

Place the following in your Rails application's app/helpers directory with the name of zzcall_helper.rb

to:
Should you wish to access DB2 table data from a non-IBMi client (and you don't want to purchase DB2 Connect) you can use the XMLService SQL interface.

Changed lines 11-33 from:
require 'xmlservice'

module ZzcallHelper
  def self
.callpgm()
   ActiveXMLService::Base.establish_connection connection: 'ActiveRecord'
 
   in_inds1 = {'dschara'=>'x','dscharb'=>'y','dsdec1'=>66.6666,'dsdec2'=>77777.77}
    zzcall = XMLService::I_PGM.new("ZZCALL", 'XMLSERVICE') <<
      XMLService::I_a.new('inchara',1,'a') <<
      XMLService::I_a.new('incharb',1,'b') <<
      XMLService::I_p.new('indec1',7,4,11.1111) <<
      XMLService::I_p.new('indec2',12,2,222.22) <<
      XMLService::I_DS.new("inds1",1,
      [
        XMLService::I_a.new('dschara',1,in_inds1['dschara']),
        XMLService::I_a.new('dscharb',1,in_inds1['dscharb']),
        XMLService::I_p.new('dsdec1',7,4,in_inds1['dsdec1']),
        XMLService::I_p.new('dsdec2',12,2,in_inds1['dsdec2'])
      ])
    zzcall.xmlservice
    puts "zzcall.xml_PARM3.xml_indec2: "+zzcall.xml_PARM3.xml_indec2.to_s
  end
end

to:
DocumentRoot /www/xmlservice/htdocs
ScriptAlias /cgi-bin/ /QSYS
.LIB/XMLSERVICE.LIB/
<Directory /QSYS.LIB/XMLSERVICE.LIB>
  AllowOverride None
  order allow,deny
  allow from all
  SetHandler cgi-script
</Directory
>
<Directory /www/apachedft/htdocs>
  order allow,deny
  allow from all
</Directory
>
March 03, 2014, at 01:28 PM EST by 24.125.120.102 -
Added lines 1-37:
(:quicktoc:)
>>round frame bgcolor=#ffffdd<<
!!! Ruby Toolkit Don, accessing table rows via XMLService SQL interface ...
[[XMLSERVICERubyDonWork]]
>><<

The easiest way to test XMLService's program call is to use the Rails console. Otherwise you will need to create a controller to execute your IBMi program call, build a view to display the output, and then modify /config/routes with the URL to the controller action. Note that you can copy and paste lines of Ruby code into your QP2Term session. This document places the program call code in a Rails helper. That helper can later be used from a controller but, initially, to get comfortable with XMLService, we will invoke the helper method from the Rails console. We will be calling a program called ZZCALL that exists in the XMLSERVICE library that was installed with PowerRuby.

Be sure to set the Ruby and Rails version that was used when you created your Rails application before launching Rails console.

Place the following in your Rails application's app/helpers directory with the name of zzcall_helper.rb

[@
require 'xmlservice'

module ZzcallHelper
  def self.callpgm()
    ActiveXMLService::Base.establish_connection connection: 'ActiveRecord'
    in_inds1 = {'dschara'=>'x','dscharb'=>'y','dsdec1'=>66.6666,'dsdec2'=>77777.77}
    zzcall = XMLService::I_PGM.new("ZZCALL", 'XMLSERVICE') <<
      XMLService::I_a.new('inchara',1,'a') <<
      XMLService::I_a.new('incharb',1,'b') <<
      XMLService::I_p.new('indec1',7,4,11.1111) <<
      XMLService::I_p.new('indec2',12,2,222.22) <<
      XMLService::I_DS.new("inds1",1,
      [
        XMLService::I_a.new('dschara',1,in_inds1['dschara']),
        XMLService::I_a.new('dscharb',1,in_inds1['dscharb']),
        XMLService::I_p.new('dsdec1',7,4,in_inds1['dsdec1']),
        XMLService::I_p.new('dsdec2',12,2,in_inds1['dsdec2'])
      ])
    zzcall.xmlservice
    puts "zzcall.xml_PARM3.xml_indec2: "+zzcall.xml_PARM3.xml_indec2.to_s
  end
end

@]