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

Re: Fw: RPG calling a web service / HTTP 1.1 500 Internal Server Error, here is the attached code



Sender: Michael Tierney <miketinternet@xxxxxxxxx>

Here it is from cut and paste:


    100      h DFTACTGRP(*NO) ACTGRP(*NEW)
BNDDIR('LIBHTTP/HTTPAPI')
    200
    300      d/copy libhttp/qrpglesrc,httpapi_h
    400
    500      d rc              s             10I
0
    600      d msg             s             52A
    700
    800      d AddElement      PR          2056a
    900      d   tag                        256a 
 value
   1000      d   string                    1024a
   1100
   1200      d StartOfElement  PR
   1300      d   r                               
 likeds(Response)
   1400      d   depth                       10I
0 value
   1500      d   name                      1024A 
 varying const
   1600      d   path                     24576A 
 varying const
   1700      d   attrs                         * 
 dim(32767)
   1800      d                                   
 const options(*varsize)
   1900
   2000      d EndOfElement    PR
   2100      d   r                               
 likeds(Response)
   2200      d   depth                       10I
0 value
   2300      d   name                      1024A 
 varying const
   2400      d   path                     24576A 
 varying const
   2500      d   value                    32767A 
 varying const
   2600      d   attrs                         * 
 dim(32767)
   2700      d                                   
 const options(*varsize)
   2800
   2900      d Response        ds                
 qualified
   3000      d   ResCode                    256A
   3100
   3200      d resp            ds                
 likeds(Response)
   3300
   3400       * Field Definitions
   3500      d NameParm        s             10  
                                                 
                    06/24/05
   3600
   3700      d custinfo        s           1024  
                                                 
                    06/24/05
   6600
   6800      d addtaskstring   s          24576
   6900      d requeststring   s          24576
   7000      d soapaction      s            256
   7100      d soapheader      s           1024
   7200      d soaptrailer     s           1024
   7300      d lengths         s             10 
0
   7400
   7500      d url             c                 
 'http:-
   7600      d                                   
 //bospcshantanu.gct.com-                        
                    06/24/05
   7700      d                                   
 /MikeTest/MikeTest.asmx'                        
                    06/24/05
   7800
   7900      c     *entry        plist
   8000      c                   parm            
       NameParm                                  
                    06/24/05
   8100
   8200       * Get the string values needed for
the tags
   8300      c                   exsr     
getValues
   8400
   8500       * Build the string needed for the
SOAP call
   8600      c                   exsr     
buildString
   8700
   8800       * send the the webservice string
   8900      c                   eval     
lengths = %len(%trim(requestString)) + 1000
   9000      c                   eval      rc =
http_url_post_xml(
   9100      c                             url   
                              :
   9200      c                            
%addr(requeststring)                 :           
                           06/24/05
   9300      c                            
%len(%trim(requestString))           :
   9400      c                            
%paddr(StartOfElement)               :
   9500      c                            
%paddr(EndOfElement)                 :
   9600      c                            
%addr(resp))                                     
                           06/24/05
  10100      c                   if        rc <>
1
  10200      c                   eval      msg =
http_error
  10300      c                   dsply           
       msg
  10400      c                   endif
  10500
  10600      c                   eval      *inlr
= *on
  10700      c                   return
  10800
  10900      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  11000       * Initialize SOAP document:
  11100      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  11200      c     *inzsr        begsr
  11300
  11400       /free
  11500         // Set up the SOAP Header
  11600         soapheader =
  11700          '<?xml version="1.0"
encoding="UTF-8"?>'                     +
  11800          '<soap:Envelope '               
                            +
  11900         
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
'     +
  12000         
'xmlns:xsd="http://www.w3.org/2001/XMLSchema"; '  
           +
  12100         
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>'
   +
  12200          '<soap:Body>'                   
                            ;
  12300
  12400         // Set up the SOAP Trailer
  12500         soaptrailer =
  12600          '</soap:Body>'                  
                            +
  12700          '</soap:Envelope>'              
                            ;
  12800       /end-free
  12900
  13000      c                   endsr
  13100
  13200      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  13300       * getValues - fill the values
needed for the Soap call
  13400      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  13500      c     getValues     begsr
  13600
  13800      c                   Movel    
NameParm      CustInfo                           
                           06/24/05
  16700      c                   endsr
  16800
  16900      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17000       * buildString - build strings
needed for Soap call
  17100      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  17200      c     buildString   begsr
  17300
  17400       /free
  17500
  17600         // Set up the URL
  17700         //url =
'http://idmwebdev/idmws/webservice2/addtask'     
  +
  17800         //      '/addtask.asmx';
  17900
  18000         // Set up the task string portion
of the SOAP request
  18100         addtaskstring =
  18200          '<AddTask
xmlns="http://tempuri.org/MikeTest/Service1";>';  
                                          
06/24/05
  18300         addtaskstring =
%trim(addTaskString)
  18400          +
addElement('CustInfo':CustInfo)                  
  ;                                              
 06/24/05
  24100         addtaskstring =
%trim(addTaskString)
  24200          + '</AddTask>'                  
                            ;
  24300
  24400         // Set up the request string
  24500         requeststring = %trim(SoapHeader)
+
  24600                        
%trim(addtaskstring) +
  24700                        
%trim(SoapTrailer);
  24800
  24900         // Set up the Soap Action
  25000         soapAction =
'http://tempuri.org/MikeTest/Service1/As400Call';
                                         06/24/05
  25100                                          
                                                 
                    06/24/05
  25200       /end-free
  25300
  25400      c                   endsr
  25500
  25600      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  25700      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  25800      p StartOfElement  B
  25900      d StartOfElement  PI
  26000      d   r                               
 likeds(Response)
  26100      d   depth                       10I
0 value
  26200      d   name                      1024A 
 varying const
  26300      d   path                     24576A 
 varying const
  26400      d   attrs                         * 
 dim(32767)
  26500      d                                   
 const options(*varsize)
  26600       /free
  26700
  26800       /end-free
  26900      p                 E
  27000
  27100      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  27200      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  27300      p EndOfElement    B
  27400      d EndOfElement    PI
  27500      d   r                               
 likeds(Response)
  27600      d   depth                       10I
0 value
  27700      d   name                      1024A 
 varying const
  27800      d   path                     24576A 
 varying const
  27900      d   value                    32767A 
 varying const
  28000      d   attrs                         * 
 dim(32767)
  28100      d                                   
 const options(*varsize)
  28200
  28300       /free
  28400         select;
  28500         when
path='/soap:Envelope/soap:Body/AddTaskResponse'
and
  28600              name = 'AddTaskResult';
  28700              msg = value;
  28800              dsply msg;
  28900         endsl;
  29000       /end-free
  29100      p                 E
  29200
  29300      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  29400      
*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  29500      p AddElement      B
  29600      d AddElement      PI          2056a
  29700      d   tag                        256a 
 value
  29800      d   string                    1024a
  29900
  30000      d   tagstring     s           2056
  30100
  30200       /free
  30300          tagstring = '<' + %trim(tag) +
'>' +
  30400                      %trim(string) + '</'
+ %trim(tag) + '>';
  30500          return tagstring;
  30600       /end-free
  30700      p                 E

--- Scott Klement <sk@xxxxxxxxxxxxxxxx> wrote:

> Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>
> 
> Hello,
> 
> > Here is the code, Yahoo has some bug with
> attachments.  Sorry for the 
> > mix of free and RPG4, just trying to get it
> to work at this point.
> 
> Your (second) attachment appears to be nothing
> but garbage on my screen. 
> Can you please download the member to your PC
> via ASCII mode in FTP?  Then 
> open the member in Notepad and copy/paste it
> into the e-mail message.
> 
> Thanks
> 
>
-----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubsribe
> from the list send mail
> to majordomo@xxxxxxxxxxxxx with the body:
> unsubscribe ftpapi mymailaddr
>
-----------------------------------------------------------------------
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------