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

Headers



   Hi Scott,


   I obtained a free trial of RX web service tool. And the web service I
   am trying to consume works on that tool, but not on the HTTPAPI.

   So what I thought was, if I can find the difference between the two and
   incorporated it in the HTTPAPI, I might be able to get the HTTPAPI to
   work.


   In the RX log it shows what it passed to the server that created the
   service and the response. Here below is the log of the post.

   It has some additional headers. Now that you explained what they mean,
   I believe they should not make any difference but I thought I would try
   to add it to the HTPPAPI.


   POST /client_smart/api HTTP/1.1

   User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

   Host: 172.16.255.7:5001

   Accept: */*

   Connection: Keep-Alive

   Content-Type: text/xml; charset=utf-8
             This is from the RX tool.

   SOAPAction: "/client_smart/api/get_client"

   Content-Length: 398


   HTTP/1.1 200 OK

   Connection: close

   Date: Fri, 26 Apr 2013 13:15:39 GMT


   I talked to the vendor that created the service and they were able to
   capture what we send to them. The first log shows how a successful call
   looks like and the second is the one is the one I sent using HTPPAPI
   and it failed. I am also including the log from the HTPPAPI and my
   code. I think its something on their server, but what is a mystery is
   why some tools work and others don't.

   Thanks for your help.


   Here the TCP Stream on a successful call. It sends a POST request.

   cid:image002.jpg@01CE41B3.22275EC0


   Here's the TCP Stream on Mauricio's  failing call. Note no POST
   request.

   cid:image006.jpg@01CE41B3.22275EC0

JPEG image

JPEG image

HTTPAPI Ver 1.24 released 2012-01-23                                            
OS/400 Ver V7R1M0                                                               
                                                                                
New iconv() objects set, PostRem=1208. PostLoc=0. ProtRem=819. ProtLoc=0        
http_persist_open(): entered                                                    
http_long_ParseURL(): entered                                                   
DNS resolver retrans: 2                                                         
DNS resolver retry  : 2                                                         
DNS resolver options: x'00000136'                                               
DNS default domain: VONMAUR.COM                                                 
DNS server found: 64.22.192.4                                                   
DNS server found: 64.22.192.3                                                   
http_persist_post(): entered                                                    
http_persist_req(POST) entered.                                                 
http_long_ParseURL(): entered                                                   
do_oper(POST): entered                                                          
There are 0 cookies in the cache                                                
POST /client_smart/api HTTP/1.1                                                 
Host: 172.16.255.7:5001                                                         
User-Agent: http-api/1.24                                                       
Content-Type: text/xml; charset=utf-8                                           
SOAPAction: /client_smart/api/get_client                                        
Content-Length: 443                                                             
                                                                                
                                                                                
senddoc(): entered                                                              
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?> <soapenv:Envelope xm
recvresp(): entered                                                             
                                                                                
HTTP/1.1 500 Internal Server Error                                       
Connection: close                                                        
Date: Fri, 26 Apr 2013 14:18:08 GMT                                      
Content-Type: text/html                                                  
Content-Length: 15942                                                    
X-Runtime: 0.047000                                                      
                                                                         
                                                                         
SetError() #13: HTTP/1.1 500 Internal Server Error                       
recvresp(): end with 500                                                 
recvdoc parms: identity 15942                                            
header_load_cookies() entered                                            
recvdoc(): entered                                                       
SetError() #0:    
SetError() #0:                                                     
<html xmlns="http://www.w3.org/1999/xhtml";>                        
<head>                                                             
  <title>Action Controller: Exception caught</title>               
  <style>                                                          
    body { background-color: #fff; color: #333; }                  
                                                                   
    body, p, ol, ul, td {                                          
      font-family: verdana, arial, helvetica, sans-serif;          
      font-size:   13px;                                           
      line-height: 18px;                                           
    }                                                              
                                                                   
    pre {                                                          
      background-color: #eee;                                      
      padding: 10px;                                                           
      font-size: 11px;                                                         
    }                                                                          
                                                                               
    a { color: #000; }                                                         
    a:visited { color: #666; }                                                 
    a:hover { color: #fff; background-color:#000; }                            
  </style>                                                                     
</head>                                                                        
<body>                                                                         
                                                                               
<h1>                                                                           
  TypeError                                                                    
</h1>                                                                          
<pre>can&#x27;t convert NilClass into String</pre>           
                                                             
                                                             
<p><code>Rails.root: C:/vmpss/webpss/client_smart</code></p>                                                        
 Columns . . . :    6  76            Edit                       MDIAZ/QRPGLESRC 
 SEU==>                                                                GETCLTID 
 FMT H  HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
        *************** Beginning of data ************************************* 
0000.01 H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE')                              
0002.00  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 
0003.00  *                                                                      
0004.00  * D E V E L O P E D   F O R   V O N   M A U R                          
0005.00  *                                                                      
0006.00  * Program...... Get Client ID                                          
0007.00  * Description.. Call the web service that get the Client ID.           
0008.00  *                                                                      
0009.00  * Programmer... Mauricio Diaz-Lapham                                   
0010.00  *                                                                      
0011.00  * Objective.... Create the logic that will call the web service        
0012.00  *                                                                      
0014.00  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 
0015.00  * Modifications:                                                       
0016.00  * --------------                                                       
0017.00  * PROJ#    DATE    PROGRAMMER    NOTES                           
 
0018.00  * -----  --------  ----------    ------------------------------------- 
0039.00  *-------------------------------------------------------------------*  
0039.01  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*      
0039.02  * Usage:                                                               
0039.03  * ------                                                               
0039.04  *                                                                      
0083.01  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 
0083.02 c* External Procedures                                                  
0083.03  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 
0083.17                                                                         
0083.18 d Setup           pr                                                    
0083.19                                                                         
0083.20 d WebService      pr            10i 0                                   
0083.25                                                                         
0083.27 D Incoming        PR                                                    
0083.28 d   @ClientID                 9000A                                     
0083.29 D   depth                       10I 0 value                                                                               
0083.30 D   name                      1024A   varying const                     
0083.31 D   path                     24576A   varying const                     
0083.32 D   value                    65535A   varying const                     
0083.33 D   attrs                         *   dim(32767)                        
0083.34 D                                     const options(*varsize)           
0083.35                                                                         
0083.36 d GETCLTID        pr                  ExtPgm('GETCLTID')                
0083.37 d  ClientID                      4a                                     
0083.38                                                                         
0083.39 d GETCLTID        pi                                                    
0083.40 d  ClientID                      4a                                     
0083.41  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 
0083.42 c*====================================================================  
0083.43 c* Copybooks                                                            
0083.44 c*====================================================================  
0083.45                                                                         
0083.46  /copy config_h                                                    
                                                                                
 083.47  /copy httpapi_h                                                        
0083.48                                                                         
0083.49  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 
0083.50  * Indicators:                                                          
0083.51  * ----------                                                           
0083.52  *                                                                      
0083.53  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 
0106.03 c* Stand Alone Fields                                                   
0106.04 d ErrMsg          s           1024a   varying                           
0106.06 d Soap            s          32767a   varying                           
0106.07 d @ClientID       s           9000a   varying                           
0106.09 d ReturnCode      s             10i 0                                   
0106.11                                                                         
0106.12 dVariableRecords...                                                     
0106.13 d                 ds                  Qualified                         
0106.14 d Number                        10i 0                                  

0106.16 c*====================================================================  
0106.17 c* Main                                                                 
0106.18 c*====================================================================  
0106.19  /free                                                                  
0106.20                                                                         
0106.21      Setup();                                                           
0106.92                                                                         
0106.93  /end-free                                                              
0106.94                                                                         
0106.95  *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= 
0107.00  ********************************************************************** 
0108.00  * Main processing - Call the Webservice to update CMA                  
0111.00  ********************************************************************** 
0112.00                                                                         
0113.00  /Free                                                                  
0144.09                                                                         
0144.10       // Call the web service that will update the client smart file.   

0144.11       ReturnCode = WebService();                                        
0144.12       If ReturnCode <> 1;                                               
0144.13          ErrMsg = http_error();                                         
0144.14          ReturnCode = -1;                                               
0144.15       Else;                                                             
0144.16          ErrMsg = 'HTTP/1.1 200 OK';                                    
0144.23       EndIf;                                                            
0144.27                                                                         
0145.00       *inLr = *on;                                                      
0146.00       Return;                                                           
0147.00                                                                         
0147.01   /end-free                                                             
0147.02 c*====================================================================  
0147.03 c* Setup();                                                             
0147.04 c*                                                                      
0147.05 c* General setup.                                                       
0147.06 c*====================================================================  
                                                                                
0147.08 p Setup           b                                                     
0147.09  /free                                                                  
0147.10                                                                         
0147.11   VariableRecords.Number = 4; // Number of keys.                        
0147.12                                                                         
0147.13   // Turn HTTP debug on or off                                          
0147.14   http_debug(*ON);                                                      
0147.19                                                                         
0147.20   // Set the correct CCSID.                                             
0147.21   http_setCCSIDs(1208:0);                                               
0147.22                                                                         
0147.23   // Strip off back end CRLFs on the returned XMLs.                     
0147.24   http_XmlStripCRLF(*ON);                                               
0147.25                                                                         
0147.26  /end-free                                                              
0147.27 p Setup           e                                                     
                                                                                
 0410.00                                                                         
0411.00 c*====================================================================  
0412.00 c* WebService(); Call The Web Service.                                  
0413.00 c*====================================================================  
0414.00                                                                         
0415.00 p WebService      b                                                     
0416.00 d WebService      pi            10i 0                                   
0417.00  /free                                                                  
0606.17                                                                         
0606.19    Soap='<?xml version="1.0" encoding="iso-8859-1" standalone="no"?> '  
0606.20    +'<soapenv:Envelope '                                                
0606.22    +'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; '            
0606.23    +'xmlns:xsd="http://www.w3.org/2001/XMLSchema"; '                     
0606.25    +'xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; '        
0606.26    +'xmlns:urn="urn:ActionWebService">'                                 
0606.27    +'   <soapenv:Header/>'                                              
0606.28    +'   <soapenv:Body>'                                                                         
 0606.29   +'      <urn:get_client '                                            
0606.31    +'        <client_id xsi:type="xsd:int">'+ClientID+'</client_id> '   
0606.32    +'     </urn:get_client> '                                           
0606.33    +'  </soapenv:Body> '                                                
0606.52    +' </soapenv:Envelope>';                                             
0607.02                                                                         
0607.03    //Consume the web service                                            
0610.02     ReturnCode = http_url_post_xml(                                     
0610.03     'http://172.16.255.7:5001/client_smart/api'                         
0610.06        : %addr(SOAP) + 2                                                
0610.07        : %len(SOAP)                                                     
0610.08        : *NULL                                                          
0610.09        : %paddr(Incoming)                                               
0610.10        : %addr(@ClientID)                                               
0610.11        : HTTP_TIMEOUT                                                   
0610.12        : HTTP_USERAGENT                                                 
0610.13        : 'text/xml; charset=utf-8'                     
0610.15        : '/client_smart/api/get_client');                               
0610.16                                                                         
0610.17   return ReturnCode;                                                    
0610.18                                                                         
0611.00  /end-free                                                              
0612.00 p WebService      e                                                     
0613.00 c*====================================================================  
0614.00 c* Incoming1();                                                         
0615.00 c* Parse the XML coming in to see what the client ID we received is.    
0616.00 c*====================================================================  
0617.00                                                                         
0618.00 p Incoming        B                                                     
0620.00 d Incoming        PI                                                    
0621.00 d   @ClientID                 9000A                                     
0622.00 d   depth                       10i 0 value                             
0623.00 d   name                      1024a   varying const             
0624.00 d   path                     24576a   varying const                     
0625.00 d   value                    65535a   varying const                     
0626.00 d   attrs                         *   dim(32767)                        
0627.00 d                                     const options(*varsize)           
0627.01                                                                         
0627.02 D atof            PR             8F   extproc('atof')                   
0627.03 D   string                        *   value options(*string)            
0628.00  /free                                                                  
0629.00                                                                         
0630.00   if (name = 'get_Client');                                             
0631.00     @ClientID = value;                                                  
0632.00   endif;                                                                
0633.00                                                                         
0634.00  /end-free                                                              
0635.00 p Incoming        E                                                     
        ****************** End of data ****************************************                                                                             

                                                                                
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------