NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Simon Kemp on December 08, 2016, 06:37:20 AM
-
Hi,
I'm on 9.13 and working on a webservice. xml error response looks like this:-
<?xml version="1.0" encoding="utf-8"?>
<GetSubscriberDetails_response xmlns="Subscriptions">
<ServiceErrors>
<Error>
<ErrorNumber>9005</ErrorNumber>
<ErrorPosition>GetSubscriberDetails</ErrorPosition>
<ErrorRecordId>Password</ErrorRecordId>
<ErrorDescription>Authentication Failed</ErrorDescription>
<ErrorRecommendation/>
</Error>
</ServiceErrors>
</GetSubscriberDetails_response>
json like this :-
{
"GetSubscriberDetails_response" : {
"queue" : [
{
"ERRORNUMBER" : 9005,
"ERRORPOSITION" : "GetSubscriberDetails",
"ERRORRECORDID" : "Password",
"ERRORDESCRIPTION" : "Authentication Failed",
"ERRORRECOMMENDATION" : ""
}
]
}
}
What have I got wrong!?
Thanks.
-
Simon, are you using an external tool to validate the json string?
In my case i use JSONLint. and at first it gave me errors about bad string in position 1 and the problem was the spaces after the { (i think because the copy paste from the browser.
-
Hi,
I'm not really sure what you're asking, sorry!
I was driving at that "queue" when I expected "ServiceErrors", and "ERRORNUMBER" where I expected "ErrorNumber" ...
Thanks
-
Oh, i was thinking about the structure of the JSON ;D
-
I think the main problem is this generated code:-
BuildResultFields Routine
! Start of "Start of BuildResultFields Routine"
! [Priority 5000]
! End of "Start of BuildResultFields Routine"
if p_web.RequestJSON
If Records(p_web.ServiceErrorQueue)
jsonResults.append(p_web.ServiceErrorQueue)
That last line should probably be :-
jsonResults.append(p_web.ServiceErrorQueue, 'ServiceErrors')
And if I put this in the available embed :-
json.SetTagCase(jf:CaseAsIs)
Things look better to me :-
{
"GetSubscriberDetails_response" : {
"queue" : [
{
"ErrorNumber" : 9005,
"ErrorPosition" : "GetSubscriberDetails",
"ErrorRecordId" : "Password",
"ErrorDescription" : "Authentication Failed",
"ErrorRecommendation" : ""
}
]
}
}
-
I agree Simon - I'll tweak that for the next build.
cheers
Bruce
-
Thank you sir.