Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML manipulation under HTTP
Message
From
21/08/2002 16:05:52
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00691791
Message ID:
00692186
Views:
36
After having done more tests, it seems to be related in the way the XML format is generated. As of this point, I have the Web Service to work ok if my Web app in generating the XML string by the use of CURSORTOXML(ALIAS(),'lcHtml',1,48,0,'1'). In fact, this is how all our other Web Services are working. We never had any problem so far with that approach. And, for this particular Web Service, having the XML string to be generated in that way, I can have my Web Service to STRCONV() to UTF-8 without any error.

However, for that particular Web Service, we can't use CURSORTOXML() as we need to format the XML string based on a specific XSD schema. So, I am definining the XML string manually. However, when I do that, the MSXML2.ServerXMLHTTP object receives an empty value for ResponseXML.XML. For some kind of reason, CURSORTOXML() generates a proper format that MSXML2.ServerXMLHTTP recognizes the content in ResponseXML.XML. However, if I do the entire XML string manually, I end up with an empty value.

Here's how our Web Service is processing.
loHTTP=CREATEOBJECT('MSXML2.ServerXMLHTTP')
loHTTP.Open('GET',lcUrl,.F.)
loHTTP.Send()
loXML=loHTTP.ResponseXML
RETURN STRCONV(STRCONV(loXML.XML,1),9)
Then, having our Web app to use CURSORTOXML(), which works, would go approx. like this:
lcHtml=''
lcHtml=lcHtml+'HTTP/1.0 200 OK'+CHR(10)
lcHtml=lcHtml+'Content-type: text/xml'+CHR(10)
lcHtml=lcHtml+'Expires: -1'
lcHtml=lcHtml+CHR(10)
SELECT * FROM ALIAS() INTO CURSOR Temp
CURSORTOXML(ALIAS(),'lcXML',1,48,0,'1')
lcHtml=lcHtml+lcXML
RETURN lcHtml
However, as I need to conform to a specific XSD schema, I have to do it manually, which doesn't work anymore as the Web Service will obtain an empty value for loXML.XML:
lcHtml=''
lcHtml=lcHtml+'HTTP/1.0 200 OK'+CHR(10)
lcHtml=lcHtml+'Content-type: text/xml'+CHR(10)
lcHtml=lcHtml+'Expires: -1'
lcHtml=lcHtml+CHR(10)
SELECT * FROM ALIAS() INTO CURSOR Temp
lcHtml=lcHtml+'<?xml version="1.0" encoding="utf-8" ?>'+CHR(13)
lcHtml=lcHtml+'<MyRoot>'+CHR(13)
SCAN
   lcHtml=lcHtml+'<MyElement>'+CHR(13)
   ...
   lcHtml=lcHtml+'</MyElement>'+CHR(13)
ENDSCAN
lcHtml=lcHtml+'</MyRoot>'+CHR(13)
RETURN lcHtml
So, I guess something is missing in my approach in order to be compliant and have the XML string to be recognized in the loXML.XML.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform