I am trying to call a SharePoint web service from Acrobat JavaScript, and I am encountering an error that I cant seem to get around. Hoping for some help on what I am doing wrong to call sharepoint. I have seen two ways of doing a SOAP call to a web service:
Way 1:
var strURL = "http://www.webservicex.net/globalweather.asmx?wsdl";
var service = SOAP.connect(strURL);
var sCountryName = "United States";
var sCityName = "New York";
var result = {
soapType: "xsd:string",
CountryName: sCountryName,
CityName: sCityName
//soapValue:
};
var results = service.GetWeather(result);
This works when I copy the code directly, but when I try and replace it with my code, I get "service is undefined" error message:
var strURL = "http://dev-dc:40570/branches/GHIS/XXXXXXX/_vti_bin/lists.asmx?wsdl";
var service = SOAP.connect(strURL);
var sPageURL = "http://devdc:40570/branches/GHIS/XXXXXXX/Other%20Client%20Documents/XXXXXXX.pdf";
var sCheckoutToLocal = "false";
var sLastModified = "";
var result = {
soapType: "xsd:string",
pageURL: sPageURL,
checkoutToLocal: sCheckoutToLocal,
LastModified: sLastModified
};
var results = service.CheckOutFile(result);
Since this didn't work, I tried method 2 for calling the webservice:
var oAuthenticator ={ UsePlatformAuth: "true"};
var cURL = "http://www.webservicex.net/globalweather.asmx";
var oRequest = {"http://www.webserviceX.NET:GetWeather":{CityName:"New York",CountryName:"United States"}};
var cAction = "http://www.webserviceX.NET/GetWeather";
var ver = SOAPVersion.version_1_2;
SOAP.wireDump = "true";
var response = Net.SOAP.request({cURL:cURL,oRequest:oRequest,cAction:cAction,oAuthenticate:oAuthenticator,bEncoded:false,cVersion:ver});
I got an error with this style though saying that CountryName was not supplied. Using my code, I got a similar error saying that pageUrl was missing or invalid:
var oAuthenticator ={ UsePlatformAuth: "true"};
var cURL = "http://dev-dc:40570/branches/GHIS/XXXXXXX/_vti_bin/lists.asmx?wsdl";
var oRequest = {
"http://schemas.microsoft.com/sharepoint/soap:CheckOutFile":{
pageUrl:"http://dev-dc:40570/branches/GHIS/XXXXXXX/Other%20Client%20Documents/XXXXXXX.pdf",
checkoutToLocal:"false",
lastmodified:""
}};
var cAction = "http://schemas.microsoft.com/sharepoint/soap/CheckOutFile";
var ver = SOAPVersion.version_1_1;
SOAP.wireDump = "true";
var response = SOAP.request({
cURL:cURL,
oRequest:oRequest,
cAction:cAction,
oAuthenticate:oAuthenticator,
bEncoded:false,
cVersion:ver
});
Can someone help me figure out why I cant seem to call this SharePoint web service? I dont care which method I use as long as I can talk to the webservice from within Acrobat's javascript. Also, in case it helps, here is the recommended call when navigating to the webservice manually in the browser:
POST /_vti_bin/lists.asmx HTTP/1.1
Host: dev-dc
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<CheckOutFile xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<pageUrl>string</pageUrl>
<checkoutToLocal>string</checkoutToLocal>
<lastmodified>string</lastmodified>
</CheckOutFile>
</soap12:Body>
</soap12:Envelope>