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

Re: Problem with http_url_post_xml



   Jaime,


   Actually you are not that far away from success.


   First of all you have to use " Element_Val_t" and
   "http_XmlReturnPtr(*ON);" to make HTTPAPI returning the full element
   data to your callback procedure:


    D SaveEmbed       PR
    D   embfile                     50a   varying
    D   depth                       10I 0 value
    D   name                      1024A   varying const
    D   path                     24576A   varying const
    D   value                             likeds(Element_Val_t) const
    D   attrs                         *   dim(32767)
    D                                     const options(*varsize)


    http_XmlReturnPtr(*ON);
    rc = http_url_post( 'http://www.webservicex.net/aba.asmx'

                      ...


   Second you need to change the prototype of procedure writeConst() to:


    D writeConst      PR            10I 0 ExtProc('write')
    D  fildes                       10i 0 value
    D  buf                            *   value options(*string)
    D  bytes                        10U 0 value

   There are various options to define the prototype of the "write" C
   procedure, depending on what fits best to your needs. With
   options(*string) you can either pass a character field, a literal or a
   pointer to the write() procedure.


   Finally you have to slightly adjust the writeConst(..) statement like
   this:


    writeConst(fd: xmlhdr: %len(xmlhdr));          // no change here

    writeConst(fd: value.p_newval: value.len);    // but here!


   Thomas.


   Jaime Enrique Villa Torres <jvilla@xxxxxxxxxxxxxxx> hat am 10. Juli
   2011 um 20:21 geschrieben:
   > Dear Scott.
   >
   > We appeal to you to solve a problem we have, and would be immensely
   grateful
   > if you can help us.
   >
   > We are working on V5R4M0. We use your valuable API HTTPAPI for the
   > consumption of web services. So far we have had no problem; we
   simply use
   > http_url_post_xml with %paddr(Incoming) and everything is correct.
   >
   > We have now a new need leaving the result in the IFS. The return
   from the
   > consumed webservice is a string value, which contains data formatted
   in XML,
   > and its size is greater than 65,535 caracterres. http_url_post_xml
   leaves in
   > the IFS all the information, but the character "<" is converted into
   "&lt"
   > even though it is enclosed by a "<! [CDATA [...]]". This does not
   happen
   > when consuming the same web service via SOAPUI.
   >
   > We looked for a solution on the internet and found the following
   link:
   > http://www.scottklement.com/httpapi/bankrout.txt, and based on the
   example
   > we tried to solve our problem. Everything is perfect, but when
   looking at
   > the result of the PARSE, it has only 65,535 characters. While
   looking for
   > the solution we tried a procedure similar to the SaveEmbed example,
   called
   > GetInnerDoc, but the result was the same. We did another test using
   your
   > excample, called BANKROUT, using the procedure called GetInnerDoc
   and
   > entering a new change:
   >
   > D Element_Val_t ds qualified
   > D based(Template)
   > D buf *
   > D len 10i 0
   >
   > With the above DS we redefined variable "Value" of procedure
   GetInnerDoc,
   > and then we found this problem in the procedure:
   >
   > D writeConst PR 10I 0 ExtProc('write')
   > D fildes 10i 0 value
   > D buf 65535A const options(*varsize)
   > D bytes 10u 0
   >
   > Variable buf is 65,535. We tried to redefine it based on DS
   Element_Val_t,
   > but when we perfom this:
   >
   > CALLP Write (fd:% addr (value.buf) value.lon), the system sends a
   message
   > indicating that "The receiver is to small to hold the result".
   >
   > Continuing with our experiments we defined the following variable: S
   10i 0 D
   > lenW, initialy set to 190,000. Then we performed this instruction:
   CALLP
   > Write (fd:% addr (value.buf) lenW). When looking at the IFS file, we
   see the
   > right size, but the data is truncated to 65,535 characters.
   >
   > The question that remains is: what we are doing wrong? (meaning, why
   the
   > function http_parse_xml_stmf() which uses procedure SaveEmbed, or
   function
   > http_url_post_xml which uses procedure GetInnerDoc, don't generate
   data
   > bigger that 655,35 characters?)
   >
   > We thank you a lot for your help, and for your HTTPAPI.
   >
   > Best regards,
   >
   >
   >
   >
   >
   > Jaime E. Villa Torres
   >
   > Gerente de Tecnolog�   >
   > Its Solutions Ltda
   >
   > Calle 81 No 11 - 68 Of 614
   >
   > Tel (57 1) 6180767 - 6180807
   >
   >
   >

   [j4sFAon4A+e+dNZVTTAdQAAAABJRU5ErkJggg==]
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------