Copy link to clipboard
Copied
I'm trying to build a SOAP request into a form in Acrobat DC, but I can't get the input parameter for the SOAP request to work.
I'm using the examples on the Acrobat SDK site, and this is my code. The debugger throws an exception at the indicated line but doesn't say why.
var cURL="http://mysite/_layouts/AppNumberService/NumberService.asmx?WSDL"
var oParam = "AppName";
var response = Net.SOAP.request(
{
cURL: cURL,
oRequest: {
"http://tempuri.org/:IncrementandFetchNumber": {
application:oParam << Exception here
}
}
});
var result = response["http://tempuri.org/:IncrementandFetchNumber"]["IncrementandFetchNumberResult"];
The SOAP request uses a SOAP service on our SharePoint site. This is the sample request and response format displayed when I go tot he asmx page for this service.
Request:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<IncrementandFetchNumber xmlns="http://tempuri.org/">
<application>string</application>
</IncrementandFetchNumber>
</soap:Body>
</soap:Envelope>
RESPONSE:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<IncrementandFetchNumberResponse xmlns="http://tempuri.org/">
<IncrementandFetchNumberResult>string</IncrementandFetchNumberResult>
</IncrementandFetchNumberResponse>
</soap:Body>
</soap:Envelope>
The SOAP service does work from other application (e.g. InfoPath) and if use the following code in Acrobat, it does list the SOAP services.
var service = Net.SOAP.connect(cURL);
for(var i in service) console.println(i);
So I'm not sure what I'm doing wrong. Any ideas?
1 Correct answer
I found a solution. I think SharePoint web services have some peculiarities that require the use of XML to build the request. This code worked. This is partially based on this site.
var cURL="http://mysite/_layouts/AppNumberService/NumberService.asmx?WSDL"
var oParam = "myApp";
var oAuthenticator = { UsePlatformAuth:"true"};
var ver = SOAPVersion.version_1_2;
var oRequest = {
soapValue:"<IncrementandFetchNumber xmlns='http://tempuri.org/'>" +
"<application>" + oParam + "</application>" +
"</Increm
...Copy link to clipboard
Copied
What is the console message in full? It may have more info than you realise.
Copy link to clipboard
Copied
Line 13 does refer to "application:oParam" line (I took some comments and test code out of what I pasted above.
The Icelandic(?) SOAPError run comes after I resume, when it gets to the "var result" line.
Exception in line 13 of function top_level, script Field:Mouse Up
SOAPError: þÿ
SOAP.request:13:Field soap:Mouse Up
Copy link to clipboard
Copied
Hmm, the error tells us something. Firstly, it isn't a syntax error, it's an error from the SOAP.request method, which is therefore being called. Second, the characters of the error are þÿ which is 0xfe, 0xff. This (feff) is characteristic of Unicode, and is a byte order marker. My guess is that the error message you might have seen is in Unicode, but is being processed as ASCII.
For example the Unicode (UTF-16) string feff0042004100440000 would mean "BAD" but if misinterpreted as ASCII it would be just þÿ.
That's not a solution, but maybe someone can take that and run with it. Also, check the server logs. It might be that the request is in error but is logged.
Copy link to clipboard
Copied
I found a solution. I think SharePoint web services have some peculiarities that require the use of XML to build the request. This code worked. This is partially based on this site.
var cURL="http://mysite/_layouts/AppNumberService/NumberService.asmx?WSDL"
var oParam = "myApp";
var oAuthenticator = { UsePlatformAuth:"true"};
var ver = SOAPVersion.version_1_2;
var oRequest = {
soapValue:"<IncrementandFetchNumber xmlns='http://tempuri.org/'>" +
"<application>" + oParam + "</application>" +
"</IncrementandFetchNumber>"};
var cAction = "http://tempuri.org/IncrementandFetchNumber";
var response = SOAP.request(
{
cURL: cURL,
oRequest: oRequest,
cAction: cAction,
oAuthenticate:oAuthenticator,
bEncoded:false,
cVersion:ver
});
var result = response["http://tempuri.org/IncrementandFetchNumberResponse"]["http://tempuri.org/IncrementandFetchNumberResu..."];
console.println(result);
Copy link to clipboard
Copied
What parameters need to be configured when I have namespace requirements

