[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: java.lang.RuntimeException: Invocation of program failed.AS400Message (ID: CPF9897 text: XML parse failed at line 1, col 2: not well-formed (invalid token)):com.ibm.as400.access.AS400Message@34ce34ce
- From: Scott Klement <sk@xxxxxxxxxxxxxxxx>
- To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: java.lang.RuntimeException: Invocation of program failed.AS400Message (ID: CPF9897 text: XML parse failed at line 1, col 2: not well-formed (invalid token)):com.ibm.as400.access.AS400Message@34ce34ce
- Date: Sat, 15 Feb 2014 18:23:03 -0600
You are passing HTTP_XML_CALC to the XML parser. This tells it to
Expat's ability to figure out the text encoding from the contents of
the XML data, but Expat does not support EBCDIC. An easy work around
is to use HTTP_STMF_CALC instead of HTTP_XML_CALC. This tells it to
use the CCSID of your stream file, which IIRC, will default to your
job's CCSID, so should be correct.
It seems very weird to me that you refer to this as a web service
provider, and give a Java error message when nothing here appears to be
a web service provider or written in Java. I can only assume that the
RPG program you provided that loads the XML from a CTDATA array is not
the "normal" way of calling this.
If this is called from Java, are you required to have the data in
EBCDIC there, too? This would likely work better if the data could be
provided in Unicode, since the callers may not want to be restricted to
only passing data that fits in an EBCDIC character set -- that's not
your immediate problem, but could potentially be a problem down the
road.
-SK
On 2/15/2014 11:25 AM, Kevin Wengert wrote:
Hi,
I'm a newbie with creating a web service provider, but have been doing
RPG coding for 20 years. This one has me pulling my hair out so any
help would be greatly appreciated.
I've written a test program to send a sample XML file to my web service
provider RPG. The web service accepts the xml as the first parameter
in a variable length field, writes it to the IFS, then calls
http_parse_xml_stmf to parse the file. The error message tells me that
XML parse failed at line 1, col2: not well-formed (invalid token). I'm
lost. Here are the relevant samples of the code:
H Copyright('Logistix Software Solutions, 2014')
H Option(*SrcStmt: *NoDebugIO) DatEdit(*MDY) DatFmt(*MDY)
H DftActGrp(*NO) ActGrp(*CALLER) Bnddir('HTTPAPI')
D LPDBPSRR PR ExtPgm('LPDBPSRR')
D DriverProExport...
D 9999995a Varying
D Valid 5a Options(*NoPass)
D Msg 256a Options(*NoPass)
D DS
D DriverProExport...
D 9999995a Varying
D XML 1 DIM(3984)
D Overlay(DriverProExport:5)
D txml s 1 DIM(3984) CTDATA PERRCD(80)
D y s 10i 0
/Free
%Len(DriverProExport) = %elem(xml);
For y = 1 to %Elem(XML);
XML(y) = TXML(y);
EndFor;
LPDBPSRR(DriverProExport);
Return;
/End-Free
**
<DriverProExport
xmlns="[1][1]http://tempuri.org/"><RouteUpdates><Route><DCID>2</DCID>
<RouteID>2018</RouteID><ScheduledDate>2014-01-24T00:00:00</ScheduledDat
e><Stops>
<Stop><StopID>74071</StopID><AlternateStopNumber>1</AlternateStopNumber
><Manifes
tNumber></ManifestNumber><DriverSignIndicator>false</DriverSignIndicato
r><Driver
ID>4060</DriverID><DelivScanQty></DelivScanQty><DelivManualPickQty></De
livManual
PickQty><ArrivalTime>2014-02-12T12:39:46</ArrivalTime><DepartureTime>20
14-02-12T
12:47:18</DepartureTime><StopWorkDuration>450</StopWorkDuration><GPSLat
itude>29.
7247</GPSLatitude><GPSLongitude>-95.5534</GPSLongitude><GPSDateTime>201
4-02-12T1
2:39:47</GPSDateTime><ScheduledReturns><ScheduledReturn><PickupID>14569
08</Picku
pID><ProductID>1114</ProductID><Quantity>1</Quantity><CreditReferenceID
>1258513<
/CreditReferenceID><OriginalUOM></OriginalUOM><UOM>CS</UOM><Disposition
></Dispos
ition><ReturnReasonCode></ReturnReasonCode><CreditAmount>0</CreditAmoun
t><Weight
>0</Weight><ReturnedProductID></ReturnedProductID><ReturnQuantity>1</Re
turnQuant
ity><TaxPerItem>0</TaxPerItem><TaxTotal>0</TaxTotal><AddChgPerItem>0</A
ddChgPerI
tem><AddChgTotal>0</AddChgTotal><Price>17.109</Price></ScheduledReturn>
</Schedul
edReturns><RejectItems><RejectItem><ProductID>64454</ProductID><RejectR
easonCode
>D30</RejectReasonCode><RejectQuantity>1</RejectQuantity><ReturnedProdu
ctID>6445
4</ReturnedProductID><Weight>0</Weight><ItemClass>O</ItemClass><Invoice
Number>12
62878</InvoiceNumber><UOM>CS</UOM><ItemID>1262878-50</ItemID><OriginalQ
uantity>1
</OriginalQuantity><InvoiceSequence>50</InvoiceSequence><LotNumber></Lo
tNumber><
TaxPerItem>1.23876</TaxPerItem><TaxTotal>1.24</TaxTotal><AddChgPerItem>
0</AddChg
PerItem><AddChgTotal>0</AddChgTotal><CreditAmount>19.59</CreditAmount><
ItemDescr
iption>GLOVE VINYL POWDER FREE
X-LARGE</ItemDescription><AlternateProductID></Al
ternateProductID><Price>18.352</Price></RejectItem><RejectItem><Product
ID>7420</
ProductID><RejectReasonCode>D30</RejectReasonCode><RejectQuantity>1</Re
jectQuant
ity><ReturnedProductID>7420</ReturnedProductID><Weight>9.99</Weight><It
emClass>O
</ItemClass><InvoiceNumber>1262878</InvoiceNumber><UOM>CS</UOM><ItemID>
1262878-1
</ItemID><OriginalQuantity>1</OriginalQuantity><InvoiceSequence>1</Invo
iceSequen
ce><LotNumber></LotNumber><TaxPerItem>0</TaxPerItem><TaxTotal>0</TaxTot
al><AddCh
gPerItem>0</AddChgPerItem><AddChgTotal>0</AddChgTotal><CreditAmount>74.
06</Credi
tAmount><ItemDescription>N A SALMON 2-3 ATLANTIC FILLET
PBO</ItemDescription><Al
ternateProductID></AlternateProductID><Price>7.413</Price></RejectItem>
</RejectI
tems><InRouteSplits><InRouteSplit><ProductID>64212</ProductID><PackQuan
titySplit
>10</PackQuantitySplit><SplitReasonCode>D70</SplitReasonCode><InvoicedA
mount>2.7
</InvoicedAmount><AdjustedWeight>0</AdjustedWeight><MultiPickIndicator>
false</Mu
ltiPickIndicator><InRouteSplitQuantity>1</InRouteSplitQuantity><Invoice
Number>12
62878</InvoiceNumber><UOM>EA</UOM><OriginalQuantity>1</OriginalQuantity
><ItemID>
1262878-49</ItemID><InvoiceSequence>49</InvoiceSequence><CaseWeight>0</
CaseWeigh
t><TaxPerCase>0</TaxPerCase><CaseTaxTotal>0</CaseTaxTotal><CaseCreditAm
ount>3.26
</CaseCreditAmount><TaxPerSplit>0</TaxPerSplit><SplitTaxTotal>0</SplitT
axTotal><
SplitChargeAmount>2.7</SplitChargeAmount><SplitsPerCase>12</SplitsPerCa
se><PackQ
uantityReturned>2</PackQuantityReturned><ItemDescription>DELI PAPER 8 X
10 3 4</
ItemDescription><AlternateProductID></AlternateProductID><Price>3.262</
Price><Sp
litPrice>0.27</SplitPrice></InRouteSplit></InRouteSplits><CatchWeightAd
justments
><CatchWeightAdjustment><ItemID>1262878-55</ItemID><ProductID>90676</Pr
oductID><
InvoiceNumber>1262878</InvoiceNumber><InvoiceSequence>55</InvoiceSequen
ce><Origi
nalWeight>17.95</OriginalWeight><AdjustedWeight>15.22</AdjustedWeight><
TaxPerIte
m>0</TaxPerItem><TaxTotal>0</TaxTotal><CreditAmount>11.84</CreditAmount
><Price>4
.338</Price></CatchWeightAdjustment></CatchWeightAdjustments><SalesOffT
ruck /></
Stop></Stops><Inputs /></Route></RouteUpdates></DriverProExport>
H Copyright('Logistix Software Solutions, 2014')
H Option(*SrcStmt: *NoDebugIO) DatEdit(*MDY) DatFmt(*MDY)
H DftActGrp(*NO) ActGrp(*CALLER) Bnddir('HTTPAPI')
H PgmInfo(*PCML: *MODULE)
*****************************************************************
* Copyright Logistix Software Solutions 2014
*****************************************************************
*****************************************************************
* Logistix PoD Header
FLPODSHM IF E K DISK
/copy qrpglesrc,httpapi_h
/copy qrpglesrc,ifsio_h
D LPDBPSRR PR ExtPgm('LPDBPSRR')
D DriverProExport...
D 9999995a Varying
D Valid 5a Options(*NoPass)
D Msg 256a Options(*NoPass)
D LPDBPSRR PI
D DriverProExport...
D 9999995a Varying
D Valid 5a Options(*NoPass)
D Msg 256a Options(*NoPass)
D StartOfElement PR
D UserData * value
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value 65535A varying const
D attrs * dim(32767)
D const options(*varsize)
D EndOfElement PR
D UserData * value
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value 65535A varying const
D attrs * dim(32767)
D const options(*varsize)
d GetLib PR extpgm('WUTBOBJC')
d 10 const
d 10
d 7 const
d 50
d 1
D RunCommand PR ExtPgm('QCMDEXC')
D Command 70a Const
D Length 15p 5 Const
D SDS
D PgmId *PROC
D WrkStn 244 253
D UsrNm 254 263
D rc s 10I 0
D fd S 10I 0
D flags S 10U 0
D mode S 10U 0
D len S 10I 0
/Free
GetDate(DateTime);
wDebugFile = '/Logistix/Debug/DQ' + %EditC(DateTime:'X') +
'.txt';
http_debug(*ON: wDebugFile);
GetLib('KINETICS':ObjLib:'*JOBD':ObjDesc:ObjErr);
Chain (ObjLib) LPODSHM;
wTimeStamp = %Char(%Timestamp():*ISO0);
wFile = '/Logistix/Events/EV' + wTimeStamp + '.xml';
flags = O_RDWR + O_CREAT + O_TRUNC;
mode = S_IRUSR + S_IWUSR + S_IRGRP + S_IROTH;
fd = Open(wFile:flags:mode);
If fd >= *Zero;
Monitor;
callp write(fd:%addr(DriverProExport) + 4:
%len(%Trim(DriverProExport)));
callp close(fd);
rc = http_parse_xml_stmf( wFile
: HTTP_XML_CALC
: %paddr(StartOfElement)
: %paddr(EndOfElement)
: *Null);
If RC <> *Zero;
// Error processing;
http_error(err);
http_crash();
Valid = 'false';
Msg = 'Unable to parse file';
Else;
Valid = 'true';
Msg = 'OK';
// Do some processing
EndIf;
On-Error;
// Error processing;
http_error(err);
http_crash();
Valid = 'false';
Msg = 'Unknown error in writing or parsing ifs file';
EndMon;
Else;
// Error processing;
http_error(err);
http_crash();
Valid = 'false';
Msg = 'Unable to open ifs file';
EndIf;
Return;
/End-Free
Thanks,
Kevin
Thanks,
Kevin
References
1. [2]http://tempuri.org/
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
[3]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
References
1. http://tempuri.org/
2. http://tempuri.org/
3. 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
-----------------------------------------------------------------------