PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV Mobile 2024
→
WM19 HTTPREQUEST
WM19 HTTPREQUEST
Started by Dave Summers, Jan., 08 2016 11:54 AM - 2 replies
Connect yourself…
Dave Summers
#1
Posted on January, 08 2016 - 11:54 AM
Hi
I am trying to make a REST webservice call passing an XML within the message.
In WD19 i get a correct XML response as expected first time BUT in WM19 i get 'error has occurred' in the XML response
Both calls are using the same code :-
sSendMessage is string
bufResult is Buffer
sSendMessage = "<r id=""HH1"" t="""" ts=""1974-07-15 18:35:59.000000+00:00"">"+CR
sSendMessage += "<d>"+CR
sSendMessage += "<c n=""UserName"">DbisAdmin</c>"+CR
sSendMessage += "<c n=""Password"">Test</c>"+CR
sSendMessage += "</d>"+CR
sSendMessage += "</r>"+CR
IF HTTPRequest("https://<url>/","","",sSendMessage,"text/xml","","")
bufResult = UTF8ToString(HTTPGetResult(httpResult))
Info(bufResult)
ELSE
Error(ErrorInfo())
END
Any help would be greatly appreciated
Many thanks
Dave
Report
0
0
Fabrice Harari
#2
Posted on January, 08 2016 - 1:44 PM
Hi Dave,
In WM, a variable defined as string is UNICODE by default, so you are
sending a unicode message to the web service and the webservice is
clearly waiting for an ANSI string
Best practice is to ALWAYS declare variable EXPLICITELY as ANSI string
or UNICODE string, depending on your needs
Best regards
--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting
Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)
More information on
http://www.fabriceharari.com
On 1/8/2016 5:54 AM, Dave Summers wrote:
Hi
I am trying to make a REST webservice call passing an XML within the
message.
In WD19 i get a correct XML response as expected first time BUT in WM19
i get 'error has occurred' in the XML response
Both calls are using the same code :-
sSendMessage is string
bufResult is Buffer
sSendMessage = "<r id=""HH1"" t="""" ts=""1974-07-15
18:35:59.000000+00:00"">"+CR
sSendMessage += "<d>"+CR
sSendMessage += "<c n=""UserName"">DbisAdmin</c>"+CR
sSendMessage += "<c n=""Password"">Test</c>"+CR
sSendMessage += "</d>"+CR
sSendMessage += "</r>"+CR
IF HTTPRequest("https://<url>/","","",sSendMessage,"text/xml","","")
bufResult = UTF8ToString(HTTPGetResult(httpResult))
Info(bufResult)
ELSE
Error(ErrorInfo())
END
Any help would be greatly appreciated
Many thanks
Dave
Report
0
0
Dave Summers
#3
Posted on January, 08 2016 - 3:38 PM
Fabrice
Your an absolute star as always, what would this forum do without you
problem solved - needed to be set ANSII as you suggested
Many thanks for your help
Dave
Report
0
0
→ Go back to WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (earlier versions)
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text