8/28/2025 3:27:10 PM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
|
|
|
|
Parse DOM in LAN Client - help
Posted: 03 Apr 09 7:59 AM
|
Hi,
I need some help on sending/parsing a XMLDocument from a Web Service. I feel that my code on the client is a bit clumsy. I need some advice how to aproach this problem or better implementation.
I am sending a request to a Web Service. That WebService is doing some heavy processing on the server side and then returns a XMLDocument to the client.
Just for comparisioan, I created 2 samples on the client, one parsing from a static .xml file, one parsing directly from the WebService(this is what I want) Both of them are working, I understand how to parse the xml document, but I am lost on the dynamic one, and my code is working just because of trial of error.
Thanks.
------------------------------------------ Code on the Web Service ------------------------------------------ [WebMethod] public XmlDocument HelloWorld() { XmlDocument doc = new XmlDocument(); doc.LoadXml("" + "Error" + "C:\\Temp\\blah.PDF" + ""); doc.Save(@"C:\Temp\Test.xml"); //just to test static load into DOM return doc; }
------------------------------------------ 1) Code SLX Client - Static ------------------------------------------ Sub GetXML_Static(Sender) 'method 1 - load .XML file - works fine dim objXML set objXML = CreateObject("Microsoft.XMLDOM") objXML.async = false
if objXML.Load("C:\Temp\Test.xml") then dim Root, NodeList, Elem Set Root = objXML.documentElement Set NodeList = Root.getElementsByTagName("status") For Each Elem In NodeList MsgBox Elem.firstChild.nodeValue Next
Set NodeList = Root.getElementsByTagName("filename") For Each Elem In NodeList MsgBox Elem.firstChild.nodeValue Next else MsgBox "Error reading the respone from the Web Server" end if
set objXML = nothing end sub
------------------------------------------ 2) Code SLX Client - Dynamic ------------------------------------------ sub GetXmlDOM(Sender) 'invoke SOAP dim c set c = CreateObject("MSSOAP.SOAPClient30")
if IsNull(c) then MsgBox("Could not create SOAPClient") exit sub end if
c.mssoapinit("http://localhost:1723/Service1.asmx?WSDL")
dim objXML set objXML = CreateObject("Microsoft.XMLDOM") objXML.async = false
dim response set response = c.HelloWorld() set objXML = response.context 'Load, LoadXML it's not working ??? why response.context? This seems to be a XMLNode already !!
dim strStatus, strFileName strStatus = objXML.getElementsByTagName("status").item(0).text strFileName = objXML.getElementsByTagName("filename").item(0).text
MsgBox strStatus MsgBox strFileName end sub
|
|
|
| |
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|