Hello,
I use 'Microsoft XML, v6.0'.XMLHTTP automation and "POST" method to send form data to the www server.
The problem that I have, all spaces are being removed when they are getting posted to the www server.
OrderID=ABC 123 DEF -> ABC123DEF
CustName=JOHN ALEXANDER BELL -> JOHNALEXANDERBELL
How can I resolve this?
Here is my snippet:
Variable:
XMLHTTP -> 'Microsoft XML, v6.0'.XMLHTTP
GLSetup.GET;
IF ISCLEAR(XMLHTTP) THEN CREATE(XMLHTTP);
XMLHTTP.open('POST', GLSetup."URL", FALSE);
XMLHTTP.setRequestHeader('Content-Type: ', GLSetup."Request Header");
OrderId :='ORDERID='+OrderId+'&';
Amount := 'AMOUNT='+DELCHR(FORMAT(ROUND(Amount,0.01,'>')*100),'=',',')+'&';
Currency := 'CURRENCY='+'GBP'+'&';
CardNo := 'CARDNO='+DELCHR(DELCHR(CardNumber,'=',' -'),'=',' ')+'&';
ExDate :='EXPDATE='+ExpirationMonth+ExpirationYear+'&';
CustName := 'NAME='+COPY(Customer.Name,1,30)+'&'
StrtoPost := OrderId + Amount + Currency + CardNo + ExDate + CustName;
XMLHTTP.send(StrtoPost);
Thanks for helping!
0
Comments
So for an example the name could be formatted like so -
See this article for reference - https://w3schools.com/tags/ref_urlencode.asp
Hi @robbonick , thanks for responding!
Any success story on using CONVERTSTR for this?
Because I got this error when trying:
CustName := 'NAME='+CONVERTSTR(COPY(Customer.Name,1,30),'','%20')+'&'
You need to build custom replace function. It may look like this:
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Thank you for being resourceful and helpful @Slawek_Guzek !! Appreciate your helps!
I'll try it out and let you know.
https://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode(v=vs.110).aspx
Hi @Slawek_Guzek
I got an empty return using your snippet:
Here is my command:
CustName := Replace(COPYSTR(Cust.Name,1,30),'','%20');
Please advise!
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Hi @Slawek_Guzek ,
I corrected the code and called the function as per your suggestion but I still get an empty Customer Name.
Please advise.
Thanks
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03