Problem calling web service using jquery

  • 19 September 2015
  • 2 replies
  • 2 views

Badge +3

hi, I am trying to call web service from Nintex form using jqeury but it keeps giving error.

Any ideas on what the problem is below? thanks.The method name is checkEmail.

function checkEmail()

{

var webserUrl = 'http:/www.mywebservice.com/checkcontact.svc?singleWsdl';

var soapMessage = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"><soapenv:Header/><soapenv:Body><tem:CheckEmail><tem:Email>abc@test.com</tem:Email></tem:CheckEmail></soapenv:Body></soapenv:Envelope>'; 

                NWF$.ajax({

                    type: "POST",

                    url: webserUrl,

                    data: soapMessage,

                    contentType: "text/xml",

                    dataType: "xml",

                    success: SuccessOccur,

                    error: ErrorOccur

                });

        function SuccessOccur() {

           alert("worked");

        }

        function ErrorOccur() {

           alert("failed");

}


2 replies

Userlevel 5
Badge +9

What is the error that you get ?

Badge +3

I was not getting any response back from the web service. After some research, I discovered it was because the ajax call was made to web service on different server and cross domain call using ajax is not supported unless something like CORS is implemented on the web service server.

It is working now, thanks.

Reply