RPG-XML Suite Header  RPG-XML Suite  RPG-XML Suite Overview of  RPG-XML Suite Download  RPG-XML Suite Today! News and Events for  RPG-XML Suite Get support for  RPG-XML Suite Contact us and learn more about  RPG-XML Suite About RPG-XML Suite

CLAIMINFO PF: 

      *-------------------------------------------------------------------------

      * @Name - CLAIMINFO

      * @Desc - Holds insurance claim information.

      *-------------------------------------------------------------------------

     A          R CLAIMINFOR

     A            SENDERID      10A         TEXT('sender id')

     A            SENDDATE        L         TEXT('sender date')

     A                                      DATFMT(*USA)  DFT('01/01/0001')

     A            REQDATE         L         TEXT('request date')

     A                                      DATFMT(*USA)  DFT('01/01/0001')

     A            TRANSID       10S 0       TEXT('transaction id')

     A            CLAIMNO       11A         TEXT('claim number')

     A            ADJUSTNAME    30A         TEXT('adjuster name')

     A            ADJUSTEXT      5A         TEXT('adjuster extension')

     A            CLMNTFIRST    20A         TEXT('claimant first name')

     A            CLMNTLAST     25A         TEXT('claimant last name')

     A            CLMNTSTREE    35A         TEXT('claimant street')

     A            CLMNTCITY     30A         TEXT('claimant city')

     A            CLMNTSTATE     2A         TEXT('claimant state')

     A            CLMNTZIP      10A         TEXT('claimant zip')

     A            CLMNTSSN      11A         TEXT('claimant soc sec no')

     A            DATELOSS        L         TEXT('date of loss')

     A                                      DATFMT(*USA)  DFT('01/01/0001')

     A            INJDESC       40A         TEXT('injury description')

     A            CMB           10A         TEXT('coord of medical benefits')

     A            COVERAGE       4A         TEXT('coverage')

     A            ADJUSCODE      4A         TEXT('adjuster code')

 

 

CLAIMINFO XSD that corresponds with PF: 

<?xml version="1.0" encoding="UTF-8"?>

<schema xmlns:tns="http://www.example.org/ClaimInfo/"

        xmlns="http://www.w3.org/2001/XMLSchema"

        targetNamespace="http://www.example.org/ClaimInfo/">

        <element name="CLAIMINFORequest">

                <complexType>

                        <sequence>

                                <element name="SENDERID">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="10"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="SENDDATE" type="date"></element>

                                <element name="REQDATE" type="date"></element>

                                <element name="TRANSID" type="int"></element>

                                <element name="CLAIMNO">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="11"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="ADJUSTNAME">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="30"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="ADJUSTTEXT">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="5"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="CLMNTFIRST">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="20"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="CLMNTLAST">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="25"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="CLMNTSTREE">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="35"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="CLMNTCITY">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="30"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="CLMNTSTATE">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="2"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="CLMNTZIP">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="10"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="CLMNTSSN">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="11"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="DATELOSS" type="date"></element>

                                <element name="INJDESC">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="40"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="CMB">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="10"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="COVERAGE">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="4"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                                <element name="ADJUSCODE">

                                        <simpleType>

                                                <restriction base="string">

                                                        <maxLength value="4"></maxLength>

                                                </restriction>

                                        </simpleType>

                                </element>

                        </sequence>

                </complexType>

        </element>

</schema>

 

 

Sample XML request used on HTTP POST to System i5: 

<?xml version="1.0" encoding="UTF-8"?>

<CLAIMINFORequest>

  <SENDERID>SENDERID</SENDERID>

  <SENDDATE>2001-01-01</SENDDATE>

  <REQDATE>2001-01-01</REQDATE>

  <TRANSID>0</TRANSID>

  <CLAIMNO>CLAIMNO</CLAIMNO>

  <ADJUSTNAME>ADJUSTNAME</ADJUSTNAME>

  <ADJUSTTEXT>ADJUSTTEXT</ADJUSTTEXT>

  <CLMNTFIRST>CLMNTFIRST</CLMNTFIRST>

  <CLMNTLAST>CLMNTLAST</CLMNTLAST>

  <CLMNTSTREE>CLMNTSTREE</CLMNTSTREE>

  <CLMNTCITY>CLMNTCITY</CLMNTCITY>

  <CLMNTSTATE>CLMNTSTATE</CLMNTSTATE>

  <CLMNTZIP>CLMNTZIP</CLMNTZIP>

  <CLMNTSSN>CLMNTSSN</CLMNTSSN>

  <DATELOSS>2001-01-01</DATELOSS>

  <INJDESC>INJDESC</INJDESC>

  <CMB>CMB</CMB>

  <COVERAGE>COVERAGE</COVERAGE>

  <ADJUSCODE>ADJUSCODE</ADJUSCODE>

</CLAIMINFORequest>

 

XML template file used to compose response XML located at /www/myrxs/templates/claiminfo.tpl 

/$CLAIMINFOResponse 

Content-type: text/xml 

 

<?xml version="1.0" encoding="UTF-8"?>

<CLAIMINFOResponse>

  <RESULT CODE="/%CODE%/">/%RESULT%/</RESULT>

  <TRANSID>/%TRANSID%/</TRANSID>

  <CLAIMNO>/%CLAIMNO%/</CLAIMNO>

</CLAIMINFOResponse>

 

 

RPG-XML Suite web service program WSCLMINF 

      //*******************************************************************************************

      // @Author: Aaron Bartell

      // @Created: 2007-06-11

      // @Desc: Read in xml and parse the Claim Info document. Store the values in PF CLAIMINF) and

      //        respond with whether or not the processing was successful.

      //        Use the Web Service Test client (PC app) to call.

      // @Notes:

      //*******************************************************************************************

     H dftactgrp(*no) bnddir('RXSBND')

 

     FCLAIMINFO if a e           k disk    prefix('CI.')

     D CI            e ds                  qualified extname(CLAIMINFO)

 

      /copy rxs,RXSCp

 

     D allHandler      pr

     D  pType                              value like(RXS_Type)

     D  pXPath                             value like(RXS_XPath)

     D  pData                              value like(RXS_XmlData)

     D  pDataLen                           value like(RXS_Length)

 

     D errHandler      pr

     D  pCurLine                     10i 0 value

     D  pCurCol                      10i 0 value

     D  pErrStr                    1024a   value varying

 

 

     D gError          ds                  likeds(RXS_Error) inz

     D gXml            s          65535a   varying

      /free

 

       monitor;

         clear gError;

 

         gXml = RXS_readStdIn();

 

         exsr parse;

 

         if gError.code <> *blanks;

           RXS_stdOutError('error': gError: *on);

           return;

         endif;

 

         exsr compose;

 

       on-error;

         RXS_stdOutError('error': RXS_catchError(): *on);

       endmon;

       *inlr = *on;

 

 

 

       //--------------------------------------------------------------------------------------------

       // @Author: Aaron Bartell

       // @Created: 2007-06-11

       // @Desc: Setup event handlers. Then call the parser with the xml received in on the request.

       //--------------------------------------------------------------------------------------------

       begsr parse;

 

       // Example XML that is being parsed:

       //<?xml version="1.0" encoding="UTF-8"?>

       //<CLAIMINFORequest>

       //  <SENDERID>SENDERID</SENDERID>

       //  <SENDDATE>2001-01-01</SENDDATE>

       //  <REQDATE>2001-01-01</REQDATE>

       //  <TRANSID>0</TRANSID>

       //  <CLAIMNO>CLAIMNO</CLAIMNO>

       //  <ADJUSTNAME>ADJUSTNAME</ADJUSTNAME>

       //  <ADJUSTTEXT>ADJUSTTEXT</ADJUSTTEXT>

       //  <CLMNTFIRST>CLMNTFIRST</CLMNTFIRST>

       //  <CLMNTLAST>CLMNTLAST</CLMNTLAST>

       //  <CLMNTSTREE>CLMNTSTREE</CLMNTSTREE>

       //  <CLMNTCITY>CLMNTCITY</CLMNTCITY>

       //  <CLMNTSTATE>CLMNTSTATE</CLMNTSTATE>

       //  <CLMNTZIP>CLMNTZIP</CLMNTZIP>

       //  <CLMNTSSN>CLMNTSSN</CLMNTSSN>

       //  <DATELOSS>2001-01-01</DATELOSS>

       //  <INJDESC>INJDESC</INJDESC>

       //  <CMB>CMB</CMB>

       //  <COVERAGE>COVERAGE</COVERAGE>

       //  <ADJUSCODE>ADJUSCODE</ADJUSCODE>

       //</CLAIMINFORequest>

 

 

       monitor;

         // Tell the parser we want to be notified of the beginning and ending

         // CLAIMINFORequest elements and all element content within this

         // XML document.

         RXS_addHandler('/CLAIMINFORequest>': %paddr(allHandler));

         RXS_addHandler('/CLAIMINFORequest/>': %paddr(allHandler));

         RXS_allElemContentHandler(%paddr(allHandler));

         RXS_parse(gXml: RXS_VAR: %paddr(errHandler));

       on-error;

         gError.code = '100';

         gError.text = 'Error occurred during the parsing of the document.';

       endmon;

 

       endsr;

 

 

       //--------------------------------------------------------------------------------------------

       // @Author: Aaron Bartell

       // @Created: 2007-06-11

       // @Desc: Using the template engine compose the response and send it to standard out (i.e.

       //        RXS_STDOUT).

       //--------------------------------------------------------------------------------------------

       begsr compose;

 

       // Compose xml

       RXS_initTplEng(RXS_STDOUT: *omit: *omit: *omit: *omit: *off);

       RXS_loadTpl('claiminfo.tpl');

 

       RXS_updVar('CODE': gError.code);

       RXS_updVar('RESULT': gError.text);

       RXS_updVar('TRANSID': %char(CI.TRANSID));

       RXS_updVar('CLAIMNO': CI.CLAIMNO);

       RXS_wrtSection('CLAIMINFOResponse': *on);

 

       endsr;

 

      /end-free

      //--------------------------------------------------------------------------------------------

      // @Author: Aaron Bartell

      // @Created: 2007-06-11

      // @Desc: This local sub procedure will be called for each event you told the parser you

      //         wanted to be notified of.

      // @Notes: There are four events that your program can be notified of through the allHandler

      //         sub procedure and they are passed in the pEvntType parm. An event is triggered

      //         as the parser reads the document top down, left to right (same way you read the

      //         newspaper).  Note that you will only be notified of events you specified before the

      //         call to RXS_parse by using API's RXS_allElemBegHandler, RXS_allElemContentHandler,

      //         RXS_allElemEndHandler, and RXS_allAttrHandler.

      //

      //         The four events and their values (note that these can all be overidden by

      //         changing the RXSCFG file or by doing a temporary override on the RXS_parse command)

      //

      //         Element Begin   = '>'   -- Placed at end of string (i.e. '/elem>')

      //         Element Content = '/'   -- Placed at end of string (i.e. '/elem/')

      //         Element End     = '/>'  -- Placed at end of string (i.e. '/elem/>')

      //         Attribute       = '@'   -- Placed between the elem and attr (i.e. '/elem@attr')

      //

      //         The most common events you will use are Element Content and Attribute simply

      //         because these are the two that provide business data via the pData parm on the

      //         allHandler procedure interface.  Events Element Begin and Element End are very

      //         helpful when you have repeating XML data.  You can then use the Begin and End

      //         events to do a CLEAR and WRITE to a PF record respectively.  Remember that

      //         in-between the Element Begin and Element End events you will be notified of all the

      //         element content, which means that after the CLEAR (i.e. Element Begin event) you

      //         can place data into the PF record until you reach the Element End event at which

      //         time you can do a WRITE of that record because it has now been populated with data.

      //--------------------------------------------------------------------------------------------

     P allHandler      b

     D allHandler      pi

     D  pType                              value like(RXS_Type)

     D  pXPath                             value like(RXS_XPath)

     D  pData                              value like(RXS_XmlData)

     D  pDataLen                           value like(RXS_Length)

 

     D chgMe           s                   like(RXS_XmlData)

      /free

 

       select;

 

       when pXPath = '/CLAIMINFORequest>';

         clear CLAIMINFOR;

       when pXPath = '/CLAIMINFORequest/SENDERID/';

         CI.SENDERID = pData;

       when pXPath = '/CLAIMINFORequest/SENDDATE/';

         CI.SENDDATE  = %date(pData);

       when pXPath = '/CLAIMINFORequest/REQDATE/';

         CI.REQDATE  = %date(pData);

       when pXPath = '/CLAIMINFORequest/TRANSID/';

         CI.TRANSID = RXS_charToNbr(pData: 0);

       when pXPath = '/CLAIMINFORequest/CLAIMNO/';

         CI.CLAIMNO = pData;

       when pXPath = '/CLAIMINFORequest/ADJUSTNAME/';

         CI.ADJUSTNAME = pData;

       when pXPath = '/CLAIMINFORequest/ADJUSTTEXT/';

         CI.ADJUSTEXT = pData;

       when pXPath = '/CLAIMINFORequest/CLMNTFIRST/';

         CI.CLMNTFIRST= pData;

       when pXPath = '/CLAIMINFORequest/CLMNTLAST/';

         CI.CLMNTLAST = pData;

       when pXPath = '/CLAIMINFORequest/CLMNTSTREE/';

         CI.CLMNTSTREE = pData;

       when pXPath = '/CLAIMINFORequest/CLMNTCITY/';

         CI.CLMNTCITY = pData;

       when pXPath = '/CLAIMINFORequest/CLMNTSTATE/';

         CI.CLMNTSTATE = pData;

       when pXPath = '/CLAIMINFORequest/CLMNTZIP/';

         CI.CLMNTZIP = pData;

       when pXPath = '/CLAIMINFORequest/CLMNTSSN/';

         CI.CLMNTSSN = pData;

       when pXPath = '/CLAIMINFORequest/DATELOSS/';

         CI.DATELOSS = %date(pData);

       when pXPath = '/CLAIMINFORequest/INJDESC/';

         CI.INJDESC = pData;

       when pXPath = '/CLAIMINFORequest/CMB/';

         CI.CMB = pData;

       when pXPath = '/CLAIMINFORequest/COVERAGE/';

         CI.COVERAGE = pData;

       when pXPath = '/CLAIMINFORequest/ADJUSCODE/';

         CI.ADJUSCODE = pData;

       when pXPath = '/CLAIMINFORequest/>';

         write CLAIMINFOR;

       endsl;

 

      /end-free

     P                 e

 

 

      //--------------------------------------------------------------------------------------------

      // @Author: Aaron Bartell

      // @Created: 2007-06-11

      // @Desc: If an error occurs this local sub procedure will be called by the parser.

      //--------------------------------------------------------------------------------------------

     P errHandler      B

     D errHandler      PI

     D  pCurLine                     10i 0 value

     D  pCurCol                      10i 0 value

     D  pErrStr                    1024a   value varying

      /free

 

       gError.code = 'WSCLMINF.1';

       gError.severity = 100;

       gError.pgm = 'WSCLMINF.errHandler';

       gError.text =

         'Line:' + %char(pCurLine) +

         ' Column:' + %char(pCurCol) +

         ' ' + pErrStr;

 

      /end-free

     P                 E