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

RE: Post XML data & expecting XML file in return



Mike,

How do I specify the XML delimiter?  Apparently the value is something to do with a variable length string that I write out to the XML file.

Below is the raw XML...When I view using XML Spy, it shows 'SUB'.  When I copy/paste to this document it shows a right arrow.  When I delete the value, XML Spy shows no errors.

<?xml version="1.0" encoding="utf-8" ?><POS xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema";><POSReq><SignonReq><custLoginName>KemperSpec</custLoginName><custPwd>8f46u31FGe</custPwd><orderingCustomerOrgId>123456789012</orderingCustomerOrgId><shippingCustomerOrgId>123456789012</shippingCustomerOrgId><requestID>30105012012081315561</requestID></SignonReq><ProductReq><productCd>MILES</productCd></ProductReq><PolicyReq><Policy><polNum>FCFIPP301050100</polNum><Drivers><Driver><drvId>A</drvId><Name><firstName>JANE</firstName><lastName>RAMIREZ</lastName><middleName/></Name><age>31</age><genderCd>F</genderCd><maritalStatusCd>S</maritalStatusCd><occupDesc>NA</occupDesc></Driver><Driver><drvId>B</drvId><Name><firstName>ROBERT</firstName><lastName>EDWARDS</lastName><middleName>D</middleName></Name><age>55</age><genderCd>M</genderCd><maritalStatusCd>S</maritalStatusCd><occupDesc>SOFTWARE ENGR</occupDesc></Driver></Drivers><Vehicles><Vehicle><vehId>1</vehId><vin>1B3AP24K6RN257124</vin><useCd>W</useCd><poDrvId>A</poDrvId></Vehicle><Vehicle><vehId>2</vehId><vin>4T1BE46K98U739104</vin><useCd>P</useCd><poDrvId>B</poDrvId></Vehicle></Vehicles><Address><addr1>455 9TH AVE</addr1><addr2/><city>SAN FRANCISCO</city><state>CA</state><zip>94118</zip></Address></Policy></PolicyReq></POSReq></POS>


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Mike Krebs
Sent: Monday, August 13, 2012 2:32 PM
To: HTTPAPI and FTPAPI Projects
Subject: RE: Post XML data & expecting XML file in return

500 errors are often bad XML. Sometimes in the debug log, you will see more description of the error. Have you turned on debug?

Copy and paste the whole STRING into notepad just before http_url_post. Save as test.xml. Open with IE. Does it like it?

Should there be something at the end of "ProcessRequestv2" to delimit the XML? It can be valid the way it is but seems a little strange.


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Holmes, Worth
Sent: Monday, August 13, 2012 1:05 PM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: Post XML data & expecting XML file in return

Gentlemen,

I am trying to send a block of XML-formatted data (1500 bytes on average) that includes all the user, password, client ID, etc., and request data that was created in a previous program. The response will be an XML file that will be parsed for information and passed back to the calling program  Forms were not used in this program, unlike the currently running HTTPAPI RPGLE code.  I am getting ' MSG = 'HTTP/1.1 500 Internal Server Error', but am not getting this error with another application using http_url_post.

XMLDATA is the input field passed into the program and String is a variable length field to be sent to the remote URL.  Below is a screen shot of the beginning of the XML data:
[cid:image002.jpg@01CD76E4.826FD2C0]

Below is the RPGLE code that I am trying to run:
// Setup input string from XMLDATA --------
 String = %trimr(XMLDATA);
 Eval StrLen = %Len(String);

 //  The http_url_post() function does an HTTP POST operation
 //  sending any data at the pointer (%addr) of String.

 //  The results, in this case, are saved to the IFS in Filename
 //  like '/Temp/M0023546.xml' which is M + Policy.

 x = %scan ('<requestID>': String);
 Policy = %Subst(String : (x + 11) : 7);
 Filename = '/Temp/M' + Policy + '.xml';

 rc = http_url_post('https://qpconfirma.qualityplanning.com/+
                     Service/QPConfirm.asmx/ProcessRequestv2'
                     : %addr(String) + 2
                     : StrLen
                     : Filename
                     : HTTP_TIMEOUT
                     : HTTP_USERAGENT
                     : 'application/x-www-form-urlencoded');

     if rc <> 1;
        msg = http_error;
        dsply msg;
     else;
        exsr Parse_XML;
     endif;

The message I get is:
MSG = 'HTTP/1.1 500 Internal Server Error

Any suggestions?

Thanks, Worth Holmes
(817) 938-3889




Worth Holmes
IT Application Dev Lead

Kemper Services Group
8360 LBJ Freeway, Suite 400, Dallas, TX 75243
972.690.5500 x1656 / 817.938.3889 Cell
903.561.1838 Fax
wholmes1@xxxxxxxxxx
kemper.com<http://kemper.com>





CONFIDENTIALITY NOTICE: This communication may contain confidential information intended only for the addressee(s). If you received this communication in error, please notify the sender and delete it from your system.
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------