Hi Scott,
We have been using HTTP_REQ() from quiet sometime in our organization and have always used XML-INTO to parse the response.
In some scenarios, we have used XML-INTO multiple time to retrieve different value from the response received and it has always worked.
recently, I have been receiving pointer error when XML-INTO is called second time. could you please advise what could be the issue here?
I have attached code snippets and error screenshots.
Thank you,
Shweta
Code Snippet:
S_RESPONSE =
'<?xml version="1.0" encoding="UTF-8"?>+
<response><interestRate>7.13</interestRate>+
<repay>71617.14</repay>+
</response>';
xml-into intRate %xml(S_RESPONSE: 'case=any ns=remove + ==> works fine, intRate = 7.13
path=response/interestRate');
xml-into repayAmt %xml(S_RESPONSE: 'case=any ns=remove + ====> Pointer error
path=response/repay');
D intRate s 7P 4
D repayAmt s 15P 4
http log
HTTPAPI Ver 1.34 released 2017-03-15
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R4M0
New iconv() objects set, PostRem=819. PostLoc=0. ProtRem=819. ProtLoc=0
http_setauth(): entered
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: PEPPERAUS.LOCAL
DNS server found: 10.150.33.10
DNS server found: 10.150.33.4
https_init(): entered
QSSLPCL = *OPSYS
SSL version 2 support disabled
SSL version 3 support disabled
Old interface to TLS version 1.0 support enabled
TLS version 1.0 support enabled
TLS version 1.1 support enabled
TLS version 1.2 support enabled
-------------------------------------------------------------------------------------
Dump of local-side certificate information:
-------------------------------------------------------------------------------------
Nagle's algorithm (TCP_NODELAY) disabled.
SNI hostname set to: api-test.pepper.com.au
-------------------------------------------------------------------------------------
Dump of server-side certificate information:
-------------------------------------------------------------------------------------
Cert Validation Code = 6000
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
SetError() #49: SSL_protocol: Unknown protocol 5000
Protocol Used:
http_persist_req(POST) entered.
http_long_ParseURL(): entered
http_long_ParseURL(): entered
do_oper(POST): entered
There are 0 cookies in the cache
POST /sit/v1/mortgage/ctl/settlement/interestRate HTTP/1.1
Host: api-test.pepper.com.au
User-Agent: http-api/1.34
Content-Type: application/xml
Content-Length: 260
Authorization: Basic testAbC1234567890123456789abcdefghijklmnopqrstuVwXyZ=
senddoc(): entered
<?xml version="1.0" encoding="utf-8"?> <interestRate xmlns="https://api-test.pepper.com.au/sit/v1/m ... terestRate>
recvresp(): entered
HTTP/1.1 200 OK
Date: Mon, 17 Jun 2024 05:14:05 GMT
Content-Type: application/xml; charset=UTF-8
Content-Length: 143
Connection: keep-alive
x-correlation-id: 6acd38f0-2c68-11ef-b49b-06cd621c2869
Strict-Transport-Security: max-age=31536000; includeSubdomains;
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
section-io-id: 8bf5c9496144be543ddd6c28451370bb
SetError() #13: HTTP/1.1 200 OK
recvresp(): end with 200
recvdoc parms: identity 143
header_load_cookies() entered
recvdoc(): entered
SetError() #0:
recvdoc(): Receiving 143 bytes.
<?xml version='1.0' encoding='UTF-8'?>
<response>
<interestRate>7.13</interestRate>
<repaymentAmount>71617.14</repaymentAmount>
</response>
http_close(): entered
Receiving RNQ0222/MCH3601 when using XML-INTO
-
- Posts: 3
- Joined: Wed Jul 28, 2021 10:15 am
Receiving RNQ0222/MCH3601 when using XML-INTO
- Attachments
-
- Pointer error.png (114.94 KiB) Viewed 14616 times
-
- MCH3601.png (56.15 KiB) Viewed 14616 times
-
- Joblog-error.png (89.79 KiB) Viewed 14616 times
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Receiving RNQ0222/MCH3601 when using XML-INTO
What variable are you getting the RNQ0222 or MCH3601 on? Or, at least, tell me which line of code you're getting it on?
When you debug it and look at the variables, which variable can't be retrieved because it doesn't have an address is memory?
Troubleshooting a program is not "here's a bunch of random information".. But rather it's following what's happening in the code and figuring out what led up to the problem. So you start by determining what the exact problem is "Variable X has not been set to an address". Then you look at the code that led up to that -- where did "variable X" start, how was it meant to get memory assigned to it? Where could it have gone wrong?
When you debug it and look at the variables, which variable can't be retrieved because it doesn't have an address is memory?
Troubleshooting a program is not "here's a bunch of random information".. But rather it's following what's happening in the code and figuring out what led up to the problem. So you start by determining what the exact problem is "Variable X has not been set to an address". Then you look at the code that led up to that -- where did "variable X" start, how was it meant to get memory assigned to it? Where could it have gone wrong?
-
- Posts: 3
- Joined: Wed Jul 28, 2021 10:15 am
Re: Receiving RNQ0222/MCH3601 when using XML-INTO
Apologies for not providing the whole information.
Its when second xml-into is called, its not able to retrieve the value present in ‘repay’ part of the response.
It is retrieving ‘interestRate’ fine. But crashing with pointer error when trying to retrieve the value in ‘repay’.
I tried to retrieve ’repay’ first, then the ‘interestRate’. It is only crashing when retrieving value in ‘repay’ part of the response.
S_RESPONSE =
'<?xml version="1.0" encoding="UTF-8"?>+
<response><interestRate>7.13</interestRate>+
<repay>71617.14</repay>+
</response>';
xml-into intRate %xml(S_RESPONSE: 'case=any ns=remove +
path=response/interestRate'); ==> works fine, intRate = 7.13
xml-into repayAmt %xml(S_RESPONSE: 'case=any ns=remove +
path=response/repay'); ====> Pointer error
D intRate s 7P 4
D repayAmt s 15P 4
Its when second xml-into is called, its not able to retrieve the value present in ‘repay’ part of the response.
It is retrieving ‘interestRate’ fine. But crashing with pointer error when trying to retrieve the value in ‘repay’.
I tried to retrieve ’repay’ first, then the ‘interestRate’. It is only crashing when retrieving value in ‘repay’ part of the response.
S_RESPONSE =
'<?xml version="1.0" encoding="UTF-8"?>+
<response><interestRate>7.13</interestRate>+
<repay>71617.14</repay>+
</response>';
xml-into intRate %xml(S_RESPONSE: 'case=any ns=remove +
path=response/interestRate'); ==> works fine, intRate = 7.13
xml-into repayAmt %xml(S_RESPONSE: 'case=any ns=remove +
path=response/repay'); ====> Pointer error
D intRate s 7P 4
D repayAmt s 15P 4
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Receiving RNQ0222/MCH3601 when using XML-INTO
There isn't a variable in your code called 'repay'.
If I understand you correctly, you are stating that the pointer error occurs on this line of code:
There are only two variables in this line of code. repayAmt and S_RESPONSE. One of these must be the one that doesn't have a proper address. Which one is it? Look in the debugger and try to display the values of these variables, it should tell you which one is bad.
Then run the program again in debug and step through the code to determine which line caused the address of the variable to become invalid.
Problems like this are almost always caused by improper handling of parameters, such as the caller passing a different length/type of variable than the program expects, or using options(*varsize) incorrectly. But if it REALLY is that XML-INTO is corrupting the variable addresses (this is very unlikely) then you will need to report it to IBM.
If I understand you correctly, you are stating that the pointer error occurs on this line of code:
Code: Select all
xml-into repayAmt %xml(S_RESPONSE: 'case=any ns=remove +
path=response/repay');
Then run the program again in debug and step through the code to determine which line caused the address of the variable to become invalid.
Problems like this are almost always caused by improper handling of parameters, such as the caller passing a different length/type of variable than the program expects, or using options(*varsize) incorrectly. But if it REALLY is that XML-INTO is corrupting the variable addresses (this is very unlikely) then you will need to report it to IBM.
-
- Posts: 3
- Joined: Wed Jul 28, 2021 10:15 am
Re: Receiving RNQ0222/MCH3601 when using XML-INTO
Thanks Scott.
'repay' is the XML tag/path in the response we are receiving. The value we receive in <repay> is numeric.
S_RESPONSE =
'<?xml version="1.0" encoding="UTF-8"?>+
<response>+
<interestRate>7.13</interestRate>+
<repay>71617.14</repay>+
</response>';
Yes, the below line is crashing:
xml-into repayAmt %xml(S_RESPONSE: 'case=any ns=remove +
path=response/repay');
and the confusion is its working fine when we retrieve value from <interestRate> -
xml-into intRate %xml(S_RESPONSE: 'case=any ns=remove +
path=response/interestRate');
I will look into it more. Thank you so much for your time and response. Greatly appreciated.
'repay' is the XML tag/path in the response we are receiving. The value we receive in <repay> is numeric.
S_RESPONSE =
'<?xml version="1.0" encoding="UTF-8"?>+
<response>+
<interestRate>7.13</interestRate>+
<repay>71617.14</repay>+
</response>';
Yes, the below line is crashing:
xml-into repayAmt %xml(S_RESPONSE: 'case=any ns=remove +
path=response/repay');
and the confusion is its working fine when we retrieve value from <interestRate> -
xml-into intRate %xml(S_RESPONSE: 'case=any ns=remove +
path=response/interestRate');
I will look into it more. Thank you so much for your time and response. Greatly appreciated.
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: Receiving RNQ0222/MCH3601 when using XML-INTO
The XML tag in just characters in the middle of a larger string, it doesn't have it's own pointer or memory address... It makes zero sense that it would be the cause of the problem.