3 Replies Latest reply on Apr 3, 2013 2:56 AM by Alolika Lanke

    webservice not call From SB1 Device

      Hello ,

       

      I am trying to call simple webservice From SB1 device. My code for webservice

      WebMethod

          <WebMethod()> _

      Public Function HelloWorld() As String

              Return "Hello World"

          End Function

       

      This is my webmethod

      html5 code as follows :

      index.html

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
         "http://www.w3.org/TR/html4/loose.dtd">

      <html lang="en">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <title>Test application - TSD</title>
      <!-- NPAPI.JS WILL BE INCORPORATED IN ASL.JS -->
      <!--<META HTTP-Equiv="scanner" Content="enabled">-->
      <!--<META HTTP-Equiv="scanner" Content="Start"> -->
      <!--<META HTTP-Equiv="scanner" Content="DecodeEvent:url('javascript:decodeEvent(%s, %s, %s);')">-->
      <!-- <META HTTP-Equiv="scanner" Content="DecodeEvent:url('http://127.0.0.1/address?data=%s&param=%s)')">-->
      <!--<META HTTP-Equiv="push" Content="detected:url('http://127.0.0.1/address?data=%s&param=%s;');">-->
       
      <link href="../css/asl.css" rel="stylesheet" type="text/css" media="screen, projection" />
      <script type="text/javascript" src="../app1/js/cfg.js"></script>
      <script type="text/javascript" src="../src/asl.js"></script>
      <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
      <script type="text/javascript" language="JavaScript" src="../src/XMLHttpRequest.js"></script>

          <script type="text/javascript" language="javascript">
         
        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 =
               '<?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> ' +
                     '<HelloWorld xmlns="http://localhost/HelloWorld/Service/" /> ' +
                  '</soap:Body> ' +
               '</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 + "<br>\n";
                  }
              }

      </script>
      </head>

       

      When i click on button webservice does not call . Please help me .

      It is shows result in browser.