11/22/2024 9:55:45 AM
|
|
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 the use of .NET Extensions in SalesLogix version 7 and higher. View the code of conduct for posting guidelines.
|
|
|
| |
|
Re: Consuming Webservice in Saleslogix 6.2
Posted: 12 Jan 07 4:43 PM
|
fiogf49gjkf0d Here is a javascript example that we use in the web client. It uses the msxml object which you should be able to use from vbscript (the lan client) as well. Hopefully the object names and the members used will get you enough info so you can find your way. I would not say it is "tutorial" code but I am swamped and dont have time to polish it.
var oXMLDoc; var oXMLHTTP = false; var lRowCount; var lRowIndex;
try { oXMLDoc = new ActiveXObject("Msxml2.DOMDocument"); } catch (d) {
}
if (oXMLDoc == null) { alert("Unable to create DOM document!"); return(false); }
try { oXMLHTTP = new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e) { try { oXMLHTTP = new ActiveXObject("Msxml2.XMLHTTP"); } catch (E) { oXMLHTTP = false; } } if (!oXMLHTTP) { alert('Unable to make http request.'); return(false); }
// Set up the post oXMLHTTP.onreadystatechange = function() { // a readyState of 4 means we're ready to use the data returned by oXMLHTTP if (oXMLHTTP.readyState == 4) { // get the return envelope var szResponse = oXMLHTTP.responseText;
// load the return into an XML data island oXMLDoc.loadXML(szResponse);
if (oXMLDoc.parseError.errorCode != 0) { var xmlErr = oXMLDoc.parseError; alert("You have error " + xmlErr.reason); } else { // Process Data lRowCount = oXMLDoc.getElementsByTagName("LookupResults").length; var sPostal; var sCity; var sState; var sCountry; if (lRowCount == 0) { // Do Nothing - should we notify the user? } else if (lRowCount == 1) { sPostal = oXMLDoc.getElementsByTagName("LookupResults")(0).childNodes(0).text; sOriginalPostal = sPostal; sCity = oXMLDoc.getElementsByTagName("LookupResults")(0).childNodes(1).text; sState = oXMLDoc.getElementsByTagName("LookupResults")(0).childNodes(2).text; sCountry = oXMLDoc.getElementsByTagName("LookupResults")(0).childNodes(3).text; setPostalCityState(sPostal, sCity, sState, sCountry, postalElement, cityElement, stateElement, countryElement); } else {
for (lRowIndex = 0; lRowIndex < lRowCount; lRowIndex++) { sPostal = oXMLDoc.getElementsByTagName("LookupResults")(lRowIndex).childNodes(0).text; sCity = oXMLDoc.getElementsByTagName("LookupResults")(lRowIndex).childNodes(1).text; sState = oXMLDoc.getElementsByTagName("LookupResults")(lRowIndex).childNodes(2).text; sCountry = oXMLDoc.getElementsByTagName("LookupResults")(lRowIndex).childNodes(3).text; } } } } }
// send the POST to the Web service oXMLHTTP.open("POST", "https://webserver.com:925/AddressFunctions/AddressFunctions.asmx/GetPostalCityState", false); oXMLHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); oXMLHTTP.send("PostalCode=" + postalCode); }
Timmus |
|
|
| |
|
Re: Consuming Webservice in Saleslogix 6.2
Posted: 14 Jan 07 9:03 AM
|
fiogf49gjkf0d I like the simple MSSOAPClient object (when in ASP Script)
set c = CreateObject("MSSOAP.SOAPClient") c.mssoapinit("http://loca lhost/MYSoapApp/MYSoapApp.Calc.soap?WSDL") for i = 1 to 10 WScript.Echo i & " " & c.Add(i,i) & " " & Time next
(sample taken from web) |
|
|
|
Re: Consuming Webservice in Saleslogix 6.2
Posted: 19 Feb 07 2:29 PM
|
fiogf49gjkf0d Jason,
I used your suggestion above to get data from a web service. Now, to make a method call, I need to send a variable of complex type, like an object with a string and 2 ints to the webservice. How would you declare the variable in saleslogix ?
Thanks
Gus |
|
|
|
Re: Consuming Webservice in Saleslogix 6.2
Posted: 19 Feb 07 3:16 PM
|
fiogf49gjkf0d There's not exactly support per se for passing complex types to a web service in VBScript. However, there's some ways to sort of mimick a complex type. Basically, when you pass a complex type to a web service, it is serialized to XML in a SOAP envelope. You can construct the XML/envelope yourself and pass that along to the web service.
Click here for a sample in a MS newsgroup
Make sense? |
|
|
|
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!
|
|
|
|
|
|
|
|