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!
|
|
Re: Calling a webservice from SLX LAN client
Posted: 15 Apr 08 3:57 PM
|
Ensure you have declared the variables outside of any of your routines. They need to be "global". Check out my examples above and you will see they are declared before any of the control events. Make sense?
Timmus |
|
|
| |
| |
| |
|
Re: Calling a webservice from SLX LAN client
Posted: 27 Apr 09 11:43 PM
|
Well, I am coming pretty late to this discussion, so my apologies. I have been so busy lately working at times over 16 hours a day... But that is not the point.
An alternative, and somewhat simpler, is to use the Soap Client object provided with SalesLogix (although you may need to use a Form to instantiate it).
This is how I did this (on SLX 6.2 Windows client), still functioning on SLX 7.5:
- On my Form, added a Soap Client Object. - Configured the WSDLFile property to the URL of the Web Service (this was a .NET web service. E.g.: http://MyServer/MyWebService/Auth.asmx?wsdl - Generated my XML payload (this is the same as when using the XMLTHHP Object - Retreiving the SOAP Remote object and calling its methods:
e.g.: ' SOAP Client object is named "sp" ' ServiceName = "Auth" ' Service exposes a single method: ' - ImportCustomerFromXML ' Input: XML String ' Output: Error Message. If no error has ocurred it returns a blank string
Dim remoteObject
Set remoteObject = sp.RemoteObject strRes = remoteObject.ImportCustomerFromXML(strXML) 'Invoke Method on Web Service
'If Response isn't blank, it contains an Error Message. If strRes <> "" then MsgBox strRes End If Set remoteObject = Nothing
The advantage of using the SOAP object is that I don't have to worry about building the code to invoke the Web Service and its methods. I can call the Methods directly against my local reference to the Remote Object.
Now, I cannot guarantee that this will work for everyone's situation, but it certainly worked for me 4 years ago and it sill working. |
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 28 Apr 09 1:23 AM
|
Hi Raul,
Do you think the above method would work for the sharepoint web service below? (creates folders within SharePoint document library)
http://servername/_vti_bin/dws.asmx?op=CreateFolder
***************** SOAP 1.2 The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.
POST /_vti_bin/dws.asmx HTTP/1.1 Host: portal Content-Type: application/soap+xml; charset=utf-8 Content-Length: length
string
|
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 10 Nov 09 8:52 PM
|
Hi,
I've tried the code from Timmus to call a web service with paramaters that returns a single value but I continue to get "A string literal was expected but no opening quote character was found" Is there something I am missing or should be looking for? I have a custom web service for SharePoint but even trying the "Add" web service posted previously give me the same error.
thx in advance for any assistance.
Leon |
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 10 Nov 09 9:12 PM
|
That seems to be an issue with Quotes.
By any chance, are you dealing with Data that contains quotes on it? E.g. O'Donnell Also, if you are building code with embedded quotes on it, maybe there is a place where something is being missed.
Again, focus on the strings that you are building, make sure that you escape / encode any characters as needed. And, for the time being, test with data that doesn't have quotes within it. |
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 10 Nov 09 9:24 PM
|
Thx Raul. I'm not dealing with any quotes at all at the moment. I'm hard coding the .Send() parameter to make sure I'm not passing any incorrect variables but no success. Below is my code for the custom web service (which was created by an external web developer) I'm getting the same error from out-of-the-box SharePoint web services though.
'****************** Dim oXMLDoc Dim oXMLHTTP
Sub CreateSharepointFolder( strsite , strpath , strlistname, strsubfolders , strfoldername)
set oXMLDoc = CreateObject("Msxml2.DOMDocument") set oXMLHTTP = CreateObject("Msxml2.XMLHTTP.3.0")
oXMLHTTP.onreadystatechange = getRef("HandleStateChange")
call oXMLHTTP.open("POST", "http://portal/_vti_bin/efic.asmx/CreateFolder", false)
call oXMLHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
call oXMLHTTP.send("sitecollection=http://portal/&web=dept/lel&listname=Matters&subfolders=http://portal/dept/lel/Matters/2009&foldername=TestfolderLeon")
end sub
Sub HandleStateChange dim sResult
if (oXMLHTTP.readyState = 4) then dim szResponse: szResponse = oXMLHTTP.responseText
call oXMLDoc.loadXML(szResponse) if (oXMLDoc.parseError.errorCode <> 0) then call msgbox (oXMLDoc.parseError.reason) else
call msgbox(oXMLDoc.getElementsByTagName("string")(0).childNodes(0).text)
end if end if End Sub |
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 10 Nov 09 9:50 PM
|
Does this code works fine if you run it outside SLX (paste it onto a text file and rename it to .vbs)?
Also, is SLX the one giving you the error regarding the quotes? If so, where is it failing? What line is it pointing to?
I would suggest you put up a Message box with the content of szResponse. The error message you are getting could be coming from your own code where it is displaying the Parser Error. |
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 17 Nov 09 8:10 PM
|
Hi Raul,
I still get an error when running it as a vbs file so I'm presuming there is something wrong with the web service using http post? It does work using the test form on the web page. I'll go back to the web developer and see what he says about running it in a vbs file.
Should I look at using your SOAP client? If so, do you have some code example I could look at?
Thx again. Leon |
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 17 Nov 09 8:50 PM
|
Further info - running the code in a vbs file on the actual web server works so I presume if I installed the SLX client on the web server it should work also. However, why would it not run on the clients?
Thx in advance. Leon |
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 19 Nov 09 2:35 AM
|
Did you ever figure out what the content of the response was? Was the error coming from the response?
Again, I would suggest that you Save the response out to file. Then you should be able to read it and tell what the difference is.
If you are getting the data from both places, then you may want to compare the results to make sure that they match. If the results do match on both the server and the remote machine, then you may have issues with other components (such as the XML version installed, etc). |
|
|
|
Re: Calling a webservice from SLX LAN client
Posted: 01 Dec 09 4:18 PM
|
Problem was resolved. Initially we tried to deploy the web service through SharePoint (MOSS 2007) however, this doesn't work using the http post method. Instead a seperate web site and application pool was added to the web server and the DLL was added to the assembly.
The client issue was resolved by adding the web.config to the new website - which is mentioned above - that adds the httpget and httppost protocols.
Thx for your help. The VBS file help me to convince the external developer that it wasn't SLX related!!
Cheers, Leon |
|
|
| |
|