Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
pankajpareek
Posts: 68
Registered: ‎09-29-2009
My Device: Not Specified

How to call webservice in HTML in BB browser.

Hello,

              i m new in BB web development.i created one website in VS 2008.i want to call webservice in html page using javascript.My code is working in IE .i enable  javascript in BB browse also but my code is not working in BB browser.How to do that?

could any one point on that...

Thanks

Pankaj Pareek

Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: How to call webservice in HTML in BB browser.

Hi there,

 

We will need to know the device operation system version of the BlackBerry that you are using, as well we will need to see what the code looks like that you are using in IE that does not work on the BlackBerry

 

Cheers, 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
pankajpareek
Posts: 68
Registered: ‎09-29-2009
My Device: Not Specified

Re: How to call webservice in HTML in BB browser.

<html>
<head>
    <title>Hello World</title>
        <script language="JavaScript" type="text/javascript">
            var iCallID;
            function InitializeService()
            {          
                       
             service.useService("http://sys13/PankajTest/test.asmx?wsdl", "Login");
           
            // service.useService("http://localhost:1112/GetPhoneNo/test.asmx?wsdl","Login");
             service.Login.callService("Login","pankaj.pareek","sun123ARC");
            }

            function ShowResult()
            {
              
               document.getElementById("lblResult").innerHTML  = event.result.value;
               var result=event.result.value
               alert(result);
            }
        </script>
</head>
    <body  onload="InitializeService()"  id="service" style="behavior:url(webservice.htc)"  onresult="ShowResult()">
     <label id="lblResult">Result</label>
    </body>
</html>

This is code is working in IE but this is not working in BB browser.
Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: How to call webservice in HTML in BB browser.

Can you please indicate which BlackBerry operating system version you are using?

 

As well, what is the "service" JavaScript object and where is it coming from? 

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
pankajpareek
Posts: 68
Registered: ‎09-29-2009
My Device: Not Specified

Re: How to call webservice in HTML in BB browser.

Hello,

                       I am using BB 9000 simulator.i don't about  OS of this simulator.Could you pointout how to call webservice in BB webdevelopment using VS 2008.

Thanks

Pankaj Pareek.

Please use plain text.
Developer
pankajpareek
Posts: 68
Registered: ‎09-29-2009
My Device: Not Specified

Re: How to call webservice in HTML in BB browser.

Hello,

                   Except  this  i am using this code also.This code calling some Handler.This following code is working for IE not for firebox,BB browser.Coulsd u plz help me...

My code is:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<body>

<script language="javascript" type="text/javascript">
function ajaxFunction()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else if (window.ActiveXObject)
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
else
  {
  alert("Your browser does not support XMLHTTP!");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
   alert(xmlhttp.responseText);
  }
}
xmlhttp.open("GET","http://localhost:1112/GetPhoneNo/demo.ashx?UserId=anita&Pass=suntec123",true);
xmlhttp.send(null);
}
</script>

<form name='myForm'>
<input type='button' onclick='ajaxFunction()' value="Test"  />
</form>
</body>
</html>

Please use plain text.
New Developer
ttklf4
Posts: 43
Registered: ‎07-29-2008
My Device: Not Specified

How to call a web service with JavaScript in BlackBerry browser.

[ Edited ]

Your code should work in a BlackBerry browser from version 4.6 onwards too. But the BlackBerry simulator connects to localhost only with the Visual Studio Plug-in. Otherwise you have to put your handler on an external server.

Please use plain text.
Developer
pankajpareek
Posts: 68
Registered: ‎09-29-2009
My Device: Not Specified

Re: How to call webservice in HTML in BB browser.

Hello,

                  If i am using external server then i have need of intenet to conncet external server.i am unable to connect intenet on my simulator??

so could you help me please?

Thanks

Pankaj Pareek

 

 

 

 

 

 

 

 

 

Please use plain text.
New Developer
ttklf4
Posts: 43
Registered: ‎07-29-2008
My Device: Not Specified

How to connect the BlackBerry simulator to the internet

You have to download the BlackBerry® MDS Simulator and start it first if you want to connect to the internet.

Please use plain text.
Developer
pankajpareek
Posts: 68
Registered: ‎09-29-2009
My Device: Not Specified

Re: How to connect the BlackBerry simulator to the internet

Hello,

                I started MDS emulator from strat menu.First of all command screen comes and looking like this:-

tarted, THREAD = GpakLayerLowerLayerListeningThread:UDP>
<2009-10-20 11:44:04.916 IST>:[40]:<MDS-CS_MDS>:<DEBUG>:<LAYER = SCM, EVENT = Th
e push service is ready to receive requests>
<2009-10-20 11:44:05.010 IST>:[41]:<MDS-CS_MDS>:<DEBUG>:<LAYER = SCM, EVENT = Ad
min. Task- pending push messages>
Oct 20, 2009 11:44:05 AM org.apache.catalina.startup.ContextConfig defaultWebCon
fig
INFO: No default web.xml
Oct 20, 2009 11:44:05 AM org.apache.catalina.core.ApplicationContext log
INFO: AdministrationController (Status):init
Oct 20, 2009 11:44:05 AM org.apache.catalina.core.ApplicationContext log
INFO: D:\Program Files\Research In Motion\BlackBerry Email and MDS Services Simu
lators 4.1.2\MDS
Oct 20, 2009 11:44:05 AM org.apache.catalina.core.ApplicationContext log
INFO: AdministrationController (Statistics):init
Oct 20, 2009 11:44:06 AM org.apache.catalina.core.ApplicationContext log
INFO: D:\Program Files\Research In Motion\BlackBerry Email and MDS Services Simu
lators 4.1.2\MDS
Oct 20, 2009 11:44:06 AM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Oct 20, 2009 11:44:06 AM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
<2009-10-20 11:44:06.791 IST>:[42]:<MDS-CS_MDS>:<DEBUG>:<LAYER = SCM, Web Server
 Started>

 

 

So is it MDS simulator started .Now if i start BB 9000 simulator .it will work? Because i don.t about internet setting. I am working on LAn.so is it any  settings to access intenet because BB support WLAN and wireless.

 

If u tell be briefly abot accessing intenet on simulator then really it will very helpful.

 

 

Thanks

Pankaj Pareek.

Please use plain text.