How to call a webservice from windows phone 6.5? - c#

I have the following problem, I try to call an web service from
an Windows phone 6.5 while its connected to active sync to my desktop computer,
in development debug environment.
So I dont have wlan connected on the phone, maybe that is the problem?
But when its connected to my desktop pc, by USB (Windows Mobile Device Center) i can
browse the web and I can acess the ?wsdl meta data on the phone - to the web service.
The webservice is running on my computer as an windows service.
I use an simple web reference to my local webservice:
private void button2_Click(object sender, EventArgs e)
{
var method = new MobileCashier.TestReference.YvesTransfer();
method.Timeout = 30000;
bool bResult, bResultSpec;
method.TestConnection(out bResult,out bResultSpec);
MessageBox.Show(bResult.ToString());
MessageBox.Show(bResultSpec.ToString());
method.Dispose();
}
But when I run it on the phone in debug mode (or not debug) I get this error:
"No connection could be made because the target machine actively refused it"
If I run the windows exe app on my desktop computer(the same as I deploy on the phone), or from another desktop computer then there is no problem.
Maybe I need wlan to make it accept the calls?
Can some one help me please?

Yes you do need Wlan activated on your cell to access a local webservice, you should essentially be in the same network of your desktop machine.
I would rather use any other wlan connected machine to test my webservice on another machine, and be sure of it, may be write a small testbed app to check the webservice.
you can also open your webservice wsdl page on your phone, and see if it opens well, now your code must be able to call your webservice from your desktop's hosted webservice.

Related

view website running on local machine via android

I have a webservice in c# ,I want to access it via my android device through adhoc , I am able to get it in emulator using 10.0.2.2; but can't see on android device, Kindly suggest me any method to access that.
This is online webservice on w3school i am able to access it via my android device
private final String NAMESPACE = "http://www.w3schools.com/webservices/";
private final String URL = "http://www.w3schools.com/webservices/tempconvert.asmx";
private final String SOAP_ACTION = "http://www.w3schools.com/webservices/CelsiusToFahrenheit";
private final String METHOD_NAME = "CelsiusToFahrenheit";
This is url of my local webservice http://localhost:63693/Notif.asmx
unable to access via android phone , though in emultor it is working
http://10.0.2.2:63693/Notif.asmx
If you are running your webservice on localhost then you can run it in emulator using address http://10.0.2.2:63693/Notif.asmx.
And if you want to run it live on phone then either you have to host your service on some Server.
For accessing localhost service on live phone, the phone and service(machine on which service is being hosted locally) must run on same Private network. You need to then call the Private address of machine from android app. With Private address, I mean IPv4 address of machine.
E.g., http://192.168.1.180:63693/Notif.asmx
You can get IPv4 of machine from ipconfig command in cmd.
If you want to access the website on your device then your PC and your android device should be on same network and same subnet.
Then yourIP:port in address in url you can access your website on your android device
You also need to turn windows feature on . Go to -> Control Panel -> Add or Remove Program -> Turn Windows feature on or off -> .Net framework 4.5 advanced service -> WCF Services -> HTTP Activation . Enable this and Restart ur PC .
Use adhoc on android and connect your machine to it, simply use MachineIP:PortNo/Webservice.asmx
For custom IP - Enable IIS in turn features on or off .Run inetmgr via administrator and add your website there after that right Click edit bindings use IP or hostname whatever you want.

connect with a android emulator to the localhost webservice [C#]

i have a emulator (from Xamarin Studios, its a android) now i develop a app for this emulator, they must be connect to the web Service (localhost), which i write with C# in Visual Studio. But the emulator dont connect to the localhost and dont can see the site. I want to write a webservice with any functions (connect to database, select, update and so on) and i want that the app can connect to this web service and can be use the function.
i hope someone can help me.
greetz
Your Android emulator's localhost will be the Android emulator itself. You will need to connect to your webservice using the actual IP address of your machine. If you are running your webservices using the VS host, keep in mind that it will not serve to non-local addresses by default.
Host that service in your IIS
then call by HTTP methods with url like
http://localhost(or Ip address)/Urservicename.svc/ServicefunctionName

WCF Service reference not working on other PC

I have a Windows Store - Metro app that connects with a Net TCP WCF Service running on same PC (hosted in a console application) but on Desktop mode of Windows 8. I have added a reference of WCF Service inside metro app and everything works fine.
I package my store/metro app and WCF Service and try out on another PC which don't have Visual Studio installed so I don't recompile the code, I just install the metro app package and run the executable of WCF Service. WCF Service starts fine but when I launch my metro app it give me error (see the image below)
It seems that for some reason metro app when installed on other PC is unable to find the service reference. I have tried many things after googling but nothing works. Any ideas/hint/suggestion would be greatly appreciated.
Windows Store Apps generally cannot use the loopback address, except for 1) communication within the SAME process, or 2) for development purposes. From How to enable loopback and troubleshoot network isolation:
Network communications using an IP loopback address cannot be used for interprocess communication (between two different apps) in a Windows Store app since this is restricted by network isolation. Network communication using an IP loopback address is allowed within an app within the same process for communication purposes.
A developer may want to use loopback for testing or debugging purposes, even though that capability will not be available for customers. For example, an app may want to download data from a web service from a Windows Store app. For development purposes, the developer wants to test the app on a single computer that is configured with the web service locally on 127.0.0.1.
Loopback is permitted only for development purposes. Usage by a Windows Store app installed outside of Visual Studio is not permitted.
In a production scenario, you will likely have to install the WCF service on a separate machine. Note that you will have to enable the "private network" capability in your application manifest (on the client app) to enable local network access.

Problems accessing Web Service using Parallels (OSX, Win 7)

I am currently running Windows 7 through Parallels on my Mac(mountain lion). I developed a web service using Visual Studios 2010. I am able to access the web service when I "Start program without debugging" but I still can't access the web service through another web browser (Chrome, Firefox, Safari).
Here is what I have done so far:
At first I thought it was something wrong with my network connection between OSX and Win 7 so I bridged the network through airport between OSX and Win 7. But for some reason the IP addresses are still different MAC (192.168.1.121) WIN 7(192.168.1.131). So I guess this could still be the problem.
The next thing I did was changed how Visual Studios starts the program from Visual Studio Development Server to Local IIS Server as was suggested through something that I found on the internet.
So my question is how can I access the webservice through another web browser using parallels?
for some reason the IP addresses are still different MAC (192.168.1.121) WIN 7(192.168.1.131)
Yes, it is supposed to be so, because they are different machines and have to have different IPs
Do you able to access the service from browser started in the same VM using address 127.0.0.1?
If yes, do you able to access it from Mac using IP-address of Win7?
If 2 fails, then you should try to disable Firewall in Win7 VM, most likely it blocks access to service.

Windows Mobile Pocket PC 2003 application "remote name cannot be resolved" exception when apppemt to connect web service

I'm developing a mobile application (on visual strudio 2005 sp1) and I get this exception when I try to reach the web service(written on sap). But this is not all.
When I run the app on emulator on computer(connecting internet with cable) it works fine. Also I installed the app to mobile device and no problem BUT only with cradle, I mean only works when it connected to computer with cable of cradle.
Problem starts if the app try to connect web service via wireless connection of our customer's internet.(unplugging from cradle).
I figured out that if I write the WSDL link in IP form, device connects to web service(on wireless)(but not via code, by copying link to text file and clicking to it) but on other form device can't find web service's page. I added the IP of web service to hosts file but problem still exists.
I solved this problem by taking web service address from sap transaction sicf.

Categories

Resources