Copy link to clipboard
Copied
What is the best way to send receive data from a wsdl webservice?
I have two webservice within an asmx file, one to get and one to post data to and from an MSSQL db.
Is there a way to send and receive data in captivate using my webservice?
The data will come from a Captivate variable and also be stored into a Captivate variable.
The header of my asmx webservice file:
<wsdl:definitionsxmlns:s="http://www.w3.org/2001/XMLSchema"xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"xmlns:tns="http://tempuri.org/"xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"targetNamespace="http://tempuri.org/"xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
the asmx url is: http://xxxxxxx.asmx?WSDL
The 2 service within are:
<s:element name="AddUser">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="UserScore" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="UserLevel" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="UserChar" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
and
<s:element name="LookupUser">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="UserName" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
Copy link to clipboard
Copied
I managed to do so within an HTML file using jquery. How can I add the same js into a captivate "Execute JS"?
I did the following inside Captivate but it doesn't populate my db:
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js';
document.getElementsByTagName('head')[0].appendChild(script);
$(document).ready(function () {
var wsUrl = "http://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.asmx?op=AddStudent";
var soapRequest = '<?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> \
<AddStudent xmlns="http://tempuri.org/"> \
<StudentName>Tim</StudentName> \
<StudentScore>440</StudentScore> \
<StudentLevel>4</StudentLevel> \
<StudentChar>M2</StudentChar> \
</AddStudent> \
</soap:Body> \
</soap:Envelope>';
$.ajax({
type: "POST",
url: wsUrl,
contentType: "text/xml",
dataType: "xml",
data: soapRequest,
success: processSuccess,
error: processError
});
});
function processSuccess(data, status, req)
{
if (status == "success")
$("#response").text($(req.responseXML).find("AddStudentResult").text());
}
function processError(data, status, req)
{
alert("Error" + req.responseText + " " + status);
}
Copy link to clipboard
Copied
All is good managed to GET/POST to a WebService via embded Jquery.