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

RE: question about writing request XML to IFS



It looks like your  soap and $xmlIn might be varchar and you don't quite have the usage of them down pat. Varchar fields have 2 or 4 bytes of length data in front of the data.  RPGLE handles finding the data so you can eval char = varchar, but APIs usually require the actual data to be passed via the pointer. 

To find the length of a varChar:
Length = %len(soap); // or if you have extra blanks on the end you wish to discard
Length = %len(%trimr(soap));
To get a pointer to the data in a varChar use:
%addr(soap:*data)

So your write in the code below looks like it might be re-written as:

callp write(fd:%addr(SOAP:*data): %len(SOAP));

-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Donnie Barrow
Sent: Thursday, March 26, 2015 11:30 AM
To: HTTPAPI and FTPAPI Projects
Subject: question about writing request XML to IFS

Ok I calling out to a webservice with this xml 

<?xml version="1.0" encoding="UTF-8"?>¬¬ <ORD_LOCK_STAT_REQ>  <INSTANCE>wmsdev02</INSTANCE> ¬ <ORDNUM>120328600-003145237</ORDNUM>
¬ <WH_ID>MA12</WH_ID>
 <CLIENT_ID>XPDEX</CLIENT_ID>
 </ORD_LOCK_STAT_REQ>¬¬

But when I look at it in the IFS this is what it looks likeR<?xml version="1.0" encoding="UTF-8"?>¬¬ <ORD_LOCK_STAT_REQ>  <INSTANCE>wmsdev02</INSTANCE> ¬ <ORDNUM>120328600-003145237</ORDNUM>
¬ <WH_ID>MA12</WH_ID>
 <CLIENT_ID>XPDEX</CLIENT_ID>
 </ORD_LOCK_STAT_REQ>¬¬
Whis is it writing the "R" in front of the xml in the IFS?????1 H BNDDIR('HTTPAPI':'QC2LE':'EXPAT')
2 H CCSID(*UCS2:1200)

  // ----------------------------------------------
  //  Create SOAP document to tell server
  // ----------------------------------------------
 $xmlin='<?xml version="1.0" encoding="UTF-8"?>' +crlf
 +' <ORD_LOCK_STAT_REQ>' +crlf
 +'   <INSTANCE>'+%trim(instance)+'</INSTANCE>' +crlf
 +'   <ORDNUM>'+%trim(ordnum)+'</ORDNUM>' +crlf
 +'   <WH_ID>'+%trim(iwrpwh)+'</WH_ID>' +crlf
 +'   <CLIENT_ID>'+%trim(client_id)+'</CLIENT_ID>' +crlf
 +' </ORD_LOCK_STAT_REQ>' +crlf;

soap = %trim(%trimr($xmlin));
$Filename1 = embfile;
length = %len(SOAP) + 2;

fd = open(%trim($filename1)
        :O_WRONLY+O_CREAT+O_TRUNC+O_CCSID
        :S_IRGRP + S_IWGRP + S_IXGRP +
          S_IRUSR + S_IWUSR + S_IXUSR
        :819);
callp close(fd);

 fd = open(%trim($filename1):O_WRONLY+O_TEXTDATA);
 callp write(fd:%addr(SOAP): length);
 callp close(fd);

Donnie BarrowIT Consultant - DBarrow Consulting 


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