[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HTTPAPI, RPG and COBOL



   Hi everybody;

   �
   �
   Based on HTTPAPI library of Scott Klement, and using the example of
   calling the Web service CurrencyConvertor (accessible from
   [1]http://www.webservicex.net), I developed a COBOL program (Similar to
   one provided in the example
   [2]http://scottklement.com/archives/ftpapi/200812/msg00014.html ) that
   consuming a Local Web Service, except at the level of XML PARSER I
   can�get the value of the attribute of the tag. Let me explain: the
   XML PARSER parameters are:

   �
   LSAA-DUMMY: Pointer

   LSAA-XML-DEPTH: Pointer

   LSAA-NAME: The name of the XML tag

   LSAA-PATH: The path tag

   LSAA-VALUE: The value of the tag

   LSAA-ATTRS: A pointer that�supposed containing a pointer table of the
   attributes and values �f each tag (eg <tag1 attr1 = "xxx"> "yyyy" </
   tag1) -> This is where I have problem.

   �
   The XML PARSER is called after each callback of the RPG procedure. And
   it�receives the expected parameters, except in case of a tag with
   attribute (eg. attr1) the PARSER receives a null pointer (Eval pointer
   gives "Identifier does not exist").

   �
   I think that the problem is at the passing/crossing of parameters
   between programs.

   �
   Are Did anyone have already encountered this problem ?

   �
   For full clarification, here are the details of the problem :

   �1-����� The COBOL program �CALL�alls an RPG
   HTTP_URL_POST_XML procedure, by passing some parameters like: the URL
   of the WS, the TIMEOUT, CONTENT-TYPE, ACTION ... etc (see code).

CALL PROCEDURE
    "HTTP_URL_POST_XML" USING BY REFERENCE WSAA-URL
                     BY VALUE      WSAA-SOAP-POINTER
                     BY VALUE      WSAA-SOAP-LEN
                     BY VALUE      WSAA-STARTPROC-POINTER
                     BY VALUE      WSAA-ENDPROC-POINTER
                     BY VALUE      WSAA-OUTPUT-POINTER
                     BY VALUE      WSAA-TIMEOUT
                     BY REFERENCE  WSAA-USER-AGENT
                     BY REFERENCE  WSAA-CONTENT-TYPE
                     BY REFERENCE  WSAA-SOAP-ACTION
                     RETURNING     WSAA-RETURN-CODE.

   �2- 2- After running and receiving / reading the XML response, and
   when closing a tag (</ tag>) EXPORT RPG procedure is called, it makes a
   callback by completing a structure:

Callback( root.userdata
        : rootDepth(root)
        : [3]element.name
        : elemPath(root: element)
        : p_retval
        : wwAttrAry
        );

   � � �The structure is defined as follows:

endElement      B                   export
endElement      PI
  root                              likeds(elemroot)
  name                          *   value

p_callback      s               *   procptr
Callback        PR                  extproc(p_callback)
  userdata                      *   value
  depth                       10I 0 value
  name                      1024A   varying const
  path                     24576A   varying const
  retval                        *   value
  Attrs                         *     dim(32767)
                                        const options(*varsize)

qqq


3- Evaluating the wwAttrAry, the result is:

> EVAL wwAttrAry
WWATTRARY (1) = SPP: E9AC54183F05AF70
WWATTRARY (2) = SPP: E9AC54183F05AF90
WWATTRARY (3) = SPP: * NULL
WWATTRARY (4) = SPP: * NULL
WWATTRARY (5) = SPP: * NULL
.... etc.
WWATTRARY (500) = SPP: * NULL

Here is the result of a first table case: EVAL on the table : wwAttrAry(1):C 100
 ==> "v ® Z�y GREEN"
the "v" is the name of the attribute, "GREEN" is its value.



4- Continuing the execution, the PARSER is called, only the LSAA-NAME, LSAA-PATH
 and LSAA VALUE parameters are set.


Question :

1 - How i can get the right parameters return in my COBOL program (Get all param
eters, not only�LSAA-NAME, LSAA-PATH and LSAA VALUE).
2 - How can i read the content of the table wwAttrAry case by case (get the valu
es not the pointers adresses)


Thank you so much for your potential returns.


Best regards.

References

   1. http://www.webservicex.net/
   2. http://scottklement.com/archives/ftpapi/200812/msg00014.html
   3. http://element.name/
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------