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

Re: Re: Parameter values



Sender: <nellestj@xxxxxxx>

Okay - I'm trying out the encoding like you suggested. The programmer that wrote the webservice is looking for the data to come in one big string like this:
 rc = http_url_get_xml('http://10.223.30.230/'+             
                        'RTITripWS/TripService.asmx/'+      
                        'GetTripUtilization?'+              
                        'OrderNumber=' + %trimr(OrderNo) +  
                        '&SequenceNumber=01' +              
                        '&PTA= 12252004' +                  
                        '&Status=WHAT' +                    
                        '&UnitNumber=  3302' +              
                        '&DrvLstCtySt=MARSWI' +             
                        '&DrvLstLat=0' +           

When I encode, do I include the '&' in front of the fields?  The programmer said that's what tells him it's a new field.  Basically he's looking for a '?' in front of the first field, and an '&' in fron of all of the others.          
> 
> From: Scott Klement <sk@xxxxxxxxxxxxxxxx>
> Date: 2004/12/20 Mon PM 07:00:30 GMT
> To: ftpapi@xxxxxxxxxxxxx
> Subject: Re: Parameter values
> 
> Sender: Scott Klement <sk@xxxxxxxxxxxxxxxx>
> 
> 
> On Mon, 20 Dec 2004 nellestj@xxxxxxx wrote:
> >
> > How do I pass the value of variable when calling a webservice? Assume 
> > OrderNo = '2077736'. If I change the code to 'OrderNumber=2077736', it 
> > works fine, but when I change it to 'OrderNumber=' + OrderNo +, I can a 
> > return code of 400, which says "Bad Request".  Can you help me? Thanks 
> > in advance!! :)
> 
> As I've already explained, you have to make sure that the data in the URL 
> is properly encoded.  You can use HTTPAPI's routines to do this, or you 
> can do it yourself.
> 
> Certain characters cannot appear in a URL.  This includes spaces, control 
> characters, etc.  Other characters have special meaning, such as the plus 
> symbol, the & symbol, etc.
> 
> In the specific example that you posted, I'm willing to bet that the 
> problem is spaces in the order number field.  You probably use a typical 
> fixed-length RPG field, which will have extra spaces at the end of it. 
> You can use the %trim() BIF to remove them.
> 
> However, I strongly recommend that you use an encoding routine to make 
> sure tha parms don't ever contain illegal characters.
> 
> EXAMPLE14 demonstrates the URL encoding routines that come with HTTPAPI. 
> In your case, it would be something like:
> 
>     Enc = http_url_encoder_new();
>     http_url_encoder_addvar_s(Enc: 'OrderNumber': %trimr(OrderNo));
>     http_url_encoder_addvar_s(End: 'SequenceNumber: '01');
> 
> and so on... check out EXAMPLE14 for a complete example.
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubsribe from the list send mail
> to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
> -----------------------------------------------------------------------
> 

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------