×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




You cannot use an xml parser to parse json data... so you cannot use
http_url_get_xml()

I would suggest something like http_url_get() to get the the json data
and then parse it using a another tool
Scott Klement has provided a good one using open source YAJL and DATA-INTO
parser...
https://www.common.org/scotts-iland-blog/parsing-json-data-into/

Paul




From: Don Brown <DBrown@xxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Date: 09/01/2019 10:45
Subject: HTTPAPI PUT receiving JSON Response XML Parse failed
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>



I am posting this here as it appears the ftpapi mailing list is not up ?

I am receiving the error SetError() #66: XML parse failed at line 1, col
0: not well-formed (invalid token)

The response is in json which would be why I am getting that error but how

do I retrieve the json ?

Here is the snippet of code for the REST web service call

uri = 'https://uat.api.onegov.nsw.gov.au/+
/oauth/client_credential/accesstoken+
?grant_type=client_credentials';

http_xproc( HTTP_POINT_ADDL_HEADER
: %paddr(Headers) );

rc = http_url_get_xml(uri: *null: %paddr(getXml): *null);

P Headers B
D Headers PI
D Header 1024A varying
D UserData * value
/free
Header = 'Postman-Token: f6a0e906-b1cf-4e13-8da8-023274871bd4'
+ x'0d25'
+ ' apikey: WmTFrOi8ZXBa0RBn6Tx2vYd3dnkOgtjj'
+ x'0d25'
+ 'authorization: Basic +
V21URnJPaThaWEJhMFJCbjZUeDJ2WWQzZG5rT2d0amo6cnRUcjk5amtockNhV0Z0aA'
+ x'0d25'
+ 'cache-control: no-cache'
+ x'0d25';
/end-free

Here is the received data from the debug log file ...

SetError() #13: HTTP/1.1 200 OK
recvresp(): end with 200
recvdoc parms: identity 549
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
{ "refresh_token_expires_in" : "0", "api_product_list" : "[P2P
Rideshare API Product]", "api_product_list_json" : [ "P2P Rideshare API
Product" ], "organization_name" : "onegov", "developer.email" :
"sam@xxxxxxxxx", "token_type" : "BearerToken", "issued_at" :
"1547025315124", "client_id" : "WmTFrOi8ZXBa0RBn6Tx2vYd3dnkOgtjj",
"access_token" : "TSrlH2CQ6vWTBmVwUR1GcVM4FNCr", "application_name" :
"2d8ee44d-5621-459a-8e44-7946c8d319dd", "scope" : "", "expires_in" :
"43199", "refresh_count" : "0", "status" : "approved" }
http_close(): entered
HTTPAPI Ver 1.24 released 2012-01-23
OS/400 Ver V7R3M0

SetError() #66: XML parse failed at line 1, col 0: not well-formed
(invalid token)



Don Brown

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.