ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Getting SOAP fault message while using http_url_post

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting SOAP fault message while using http_url_post

    Hi All,

    I have written an RPGLE program, which sends a SOAP request by using http_url_post api.
    This api sends my SOAP request to the called WebServer program, and writes the respond to an IFS file.
    It works lovely.
    But if there is a problem (etc 404 error=the URL is not found), I don't get the SOAP fault message, it is not written into the IFS file (no IFS file is written at all).

    Earlier I have used http_url_post_xml, which parses the respond xml, but I had to change, because my SOAP message was too big for this api.
    The http_url_post_xml api parses the SOAP fault message too.

    Thank you Scott Klement for these good apis!

    Does anyone have experience about getting the SOAP fault message while using http_url_post?

    Thanks in advance,
    Klara Farkas

  • #2
    Re: Getting SOAP fault message while using http_url_post

    I don't understand... why don't you get the SOAP fault message in the IFS? Seems like you should...

    Also, I'm very skeptical about the response being too big for http_url_post_xml(). It can handle up to 16MB per XML tag, or up to a 2 TB total size XML document, if used properly. What sort of limit are you hitting?!

    Comment


    • #3
      Re: Getting SOAP fault message while using http_url_post

      Thank you Scott for your reply!

      This is the code, how I call the api, when I don't get the SOAP fault message in the IFS file:
      (In this example the serviceURL contains a wrong URL.)

      Code:
       rc = http_url_post(                                                            
                             serviceURL                                                 
                           : %addr(SOAP)                                            
                           : %len(SOAP)                                                 
                           : '/home/FileNet/' + %Trim(ReFilenev)                        
                           : w#timeout                                                  
                           : HTTP_USERAGENT                                             
                           : 'text/xml'                                                 
                           : 'http://www.webserviceX.NET/ConversionRate' );
      Sometimes an empty IFS file is written, sometimes there is no response file at all, rc=-1.



      I don't know, what limits am I hitting, when I use the other api, with response parsing.
      When one tag in the the response was too long, it was truncated at 65000 bytes.
      The LIBHTTP was downloaded from your site in February this year.
      We use 7.1 on our iSeries.
      In this case the code is:

      Code:
       rc = http_url_post_xml( serviceURL               
                              : %addr(SOAP)              
                              : %len(SOAP)               
                              : *NULL                    
                              : %paddr(EndTagCallback)   
                              : %addr(restext)           
                              : w#timeout                
                              : HTTP_USERAGENT           
                              : 'text/xml' );
      Thank you in advance!!
      with Regards,
      Klara Farkas

      Comment


      • #4
        Re: Getting SOAP fault message while using http_url_post

        Originally posted by Klara.Farkas View Post
        This is the code, how I call the api, when I don't get the SOAP fault message in the IFS file:
        (In this example the serviceURL contains a wrong URL.)
        You won't get a SOAP Fault if you use a wrong URL. SOAP faults come from SOAP servers.... If you're not connecting to a SOAP server, you won't get a SOAP fault, you'll get an HTTP error -- So you need to handle both circumstances.

        Originally posted by Klara.Farkas View Post
        I don't know, what limits am I hitting, when I use the other api, with response parsing.
        When one tag in the the response was too long, it was truncated at 65000 bytes.
        HTTPAPI supports RPG programs older than v6r1, in order for that to work properly, it must constrain strings to 65535. However, the XML parser does not have to return a string, it's also able to return data as a pointer and length. In that circumstance, it can handle much longer data. I described this situation here:


        But, you can also use http_url_post() as you've shown... this will give you the XML data in a file, and you can parse it separately (either by calling http_parse_xml_stmf() or by using another parser like XML-INTO or XML-SAX)

        Comment


        • #5
          Re: Getting SOAP fault message while using http_url_post

          Thank you so much Scott for your solving reply, I am so much grateful!!

          Klara

          Comment

          Working...
          X