NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on September 05, 2019, 11:23:36 AM

Title: WebService Response
Post by: Alberto on September 05, 2019, 11:23:36 AM
Hi, I need to send the response without <13,10>, like:

{"CODRTN":"00","SALDOS":"000001958935100","SIGNO1":"+","SACTU":"000001958935100","SIGNO2":"+","DOCUM":"000000880000107","LOCAL":"000000055100107","CANEXT":"000"}

How to do it?
Title: Re: WebService Response
Post by: Matthew51 on September 05, 2019, 12:45:22 PM
In the NetWebServiceMethod, Return tab. Change "Format return for" to Compactness.
Title: Re: WebService Response
Post by: Alberto on September 05, 2019, 02:47:02 PM
Thanks, another one...

Im ask to response with a width of 869 chars
I have two values that are strings and may have trailing spaces and I need to send this spaces to keep the width but the values in the json response are clipped
how can I do it?
Title: Re: WebService Response
Post by: Bruce on September 05, 2019, 05:54:27 PM
>>I'm ask to response with a width of 869 chars

Where do you find these sorts of ridiculous requirements? :)
this is "just wrong"..... in so many ways...

yes, your response is going to get clipped. Yes, JSON has a variable length....
I guess put a . at the end of the response string or something like that?

Cheers
Bruce
Title: Re: WebService Response
Post by: Alberto on September 06, 2019, 04:38:53 AM
It is a requeriment from an ATM system to validate the credit of a client.
Will try if they accept a dot at the end.
Title: Re: WebService Response
Post by: Wolfgang Orth on September 06, 2019, 07:10:17 AM
It is a requeriment from an ATM system to validate the credit of a client.
Will try if they accept a dot at the end.

Alberto,

in HTML there is a "non-breaking space" to force a space character.
This in needed sometimes, like >                       < here because the browser reduces the number of spaces between two characters, like between two words, no matter how many spaces you have added into your source.

For this &nbsp; is used. It has its equivalent on &#160; and perhaps it could work for you by filling the end of your string with this garbage?

This is it how the line above looks like, what the browser returns:
This in needed sometimes, like &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt; here because.......


Just a wild guess from me.....
Wolfgang
Title: Re: WebService Response
Post by: Bruce on September 07, 2019, 10:45:01 PM
Wolfgang, this is JSON not HTML, so &nbsp; does not apply.

cheers
Bruce
Title: Re: WebService Response
Post by: Bruce on September 07, 2019, 10:46:04 PM
Alberto, your best bet may be to put the JSON into a StringTheory object, then pad it out to the length you want.

Then return the StringTheory object.

cheers
Bruce
Title: Re: WebService Response
Post by: Alberto on September 08, 2019, 04:44:16 AM
Thanks Bruce, Ive add a <160> to the string before the json is made and then a packet.replace after and it works ok.

By the way... had you seen my post about: "Problem when syncing spanish caracters:" ?
Title: Re: WebService Response
Post by: Bruce on September 08, 2019, 06:44:50 PM
yes, I've seen the post, but I can only investigate that in the office tomorrow.