webservice not call From SB1 Device

A Alolika Lanke 3 years 6 months ago
3 3 0

Hello ,
 
I am trying to call simple webservice From SB1 device. My code for webservice
WebMethod
    _
Public Function HelloWorld() As String
        Return "Hello World"
    End Function
 
This is my webmethod
html5 code as follows :
index.html
 

Test application - TSD  
          asl.options([   {    title: "quit",    callback: function(){     asl.exit();   }   }   ]);  asl.back();       asl.title('App B - Hello World');         var iCallID;
        function OnClickTestBtn()        // Check to see if the return value can stop the submit process or not.        {            var xmlhttp = new XMLHttpRequest();            xmlhttp.open("POST", "http://localhost/Helloworld/Service.asmx?wsdl", true);
            xmlhttp.onreadystatechange = function()            // This is a calling back function that xmlhttp.send(sXML) will            // trigger this function to be called repeatedly.            {                if (xmlhttp.readyState == 4)                // xmlhttp.readyState:                // 0 means Uninitialized - open() has not been called yet.                // 1 means Loading - send() has not been called yet.                // 2 means Loaded - send() has been called, ...                // 3 means Interactive - Downloading, ...                // 4 means Completed - Finished with all operations.                {                    AddDebugMsg(xmlhttp.responseText);                }            }
            xmlhttp.setRequestHeader("SOAPAction", "http://localhost/HelloWorld/Service/HelloWorld");            xmlhttp.setRequestHeader("Content-Type", "text/xml");
            var sXML =         '' +         ''" rel="nofollow">http://schemas.xmlsoap.org/soap/envelope/">' +            ' ' +               ' ' +            ' ' +         '';            xmlhttp.send(sXML);
            window.event.returnValue = false;   // Set to false to keep debugging            return (false);                    //    info on the screen.        }
        function AddDebugMsg(sMsg) {            if (document.getElementById("m_divDebugMsg") != null) {                document.getElementById("m_divDebugMsg").innerHTML += sMsg + "\n";            }        }

 
When i click on button webservice does not call . Please help me .
It is shows result in browser.

Please Register or Login to post a reply

3 Replies

S Sushil Gusain

Hi,
Same problem i have also faced, now i have a solution for this problem.
1) Go to the IIS and select the Publish file, right click and go to properties.
2) Go to HTTP headers menu and add customHTTP Headers -
   Custom Header Name : Access-Control-Allow-Origin
    Custom Header Value : *
In my case it work fine..

A Alolika Lanke

Thank you,
Done

A Alolika Lanke

Hello Sushil,

Thanks For reply but it is not working in my case. webservice not shows result.
IF anybody knows please help.

Thank you,
Alolika

CONTACT
Can’t find what you’re looking for?