PDA

View Full Version : Use C# web service on MAC clinet




uhs61074
Feb 24, 2008, 11:30 PM
Hello

1)Is it possible to use web service created in C# (.net 2.0) to use on MAC machine using apple script or any other language.?

2) Is it possible to write something similar to window service on MAC ?

3) Does Applescript parse the xml file ?

4) what are the systme variable in MAC

5) How to edit registry if MAC has something similar to Registry in Window OS?



Thanks in Advance.
regards



Cromulent
Feb 25, 2008, 03:50 AM
Hello

1)Is it possible to use web service created in C# (.net 2.0) to use on MAC machine using apple script or any other language.?

2) Is it possible to write something similar to window service on MAC ?

3) Does Applescript parse the xml file ?

4) what are the systme variable in MAC

5) How to edit registry if MAC has something similar to Registry in Window OS?



Thanks in Advance.
regards

1. What is this C# web service?

2. No idea what it is you are talking about. If you could provide some more information it would be helpful.

3. I believe you can use Applescript to parse XML. Not entirely sure. If not there is a Cocoa framework for this I think, or you can always use Python which is nice and easy.

4. The what variable?

5. No registry on Macs. Nothing even remotely similar to it either (thank God).

uhs61074
Feb 25, 2008, 10:30 AM
[uhs61074]: Thanks for reply.

1. What is this C# web service?

[uhs61074]:A web service allows a site to expose programmatic functionality via the Internet. Web services can accept messages and optionally return replies to those messages. communication can be done by XML.(i.e i can deply logic of calulater on one server (IIS server -Microsoft prodcut) - one can call that program by providing URL and attach parameter to that) and you will get the result in xml - to ur browser.)
http://www.c-sharpcorner.com/UploadFile/ashok_kp/IntroductionToWebServicesT11252005045531AM/IntroductionToWebServicesT.aspx



2. No idea what it is you are talking about. If you could provide some more information it would be helpful.

[uhs61074]: It is a program that runs without any ineteraction of user like running in background -it can be configured that this program start when computer start or user can manually start stop and resume. This kind of programing is usefull when we want to do excute logic on specific time interval up to user logs off. (i.e keep checking speific folder if some files are added or removed OR on specific interval download some files from server - same way like dispalying current date time on bottom system status bar of machine.

3. I believe you can use Applescript to parse XML. Not entirely sure. If not there is a Cocoa framework for this I think, or you can always use Python which is nice and easy.
[uhs61074]: I am new to MAC. I am not sure which language is powerfull to do programin on MAC OS

4. The what variable?
[uhs61074]: In Windows operating system - There are some default system folder where programs are installed and where user profile is stored.
You can visit this site: http://www.wilsonmar.com/1envvars.htm

5. No registry on Macs. Nothing even remotely similar to it either (thank God).

Cromulent
Feb 25, 2008, 11:13 AM
[uhs61074]: Thanks for reply.

1. I'm well aware of what a web service is in general. I'm just wondering what the C# web service is that you are talking about. You make it sound like something specific, is it based around the same technology as ASP.NET?

2. Yes. It is called a daemon in the Unix world.

3. Any of them. C / C++ / Objective-C / Python / Ruby / Applescript / Java etc etc.

4. The same as pretty much any Unix system. They are pretty easy to look up if you do a search for Mac OS X Environment Variables.

kuwisdelu
Feb 25, 2008, 11:13 AM
1)Is it possible to use web service created in C# (.net 2.0) to use on MAC machine using apple script or any other language.?

C# is a Microsoft language. It won't work on a Mac.

2) Is it possible to write something similar to window service on MAC ?

From your description, yes you can write something like that for a Mac, but not in C#. And it won't be able to automatically run once a user logs in unless the user gives it permission to always run on startup in System Preferences.

3) Does Applescript parse the xml file ?

I don't know...it may be able too. But Applescript isn't meant to be a real programming language. It's a simple automation language for users to tell their computer how to do some kind of repetitive task that they don't feel like doing or otherwise automate their computing experience.

4) what are the systme variable in MAC

From your description, I think you just need to look up at how Unix works. System and cross-user applications are just stored up in the /Applications directory, and user information and files are stored in the /Users/username directory.

5) How to edit registry if MAC has something similar to Registry in Window OS?

Again, no such thing as a registry on a Mac, thank god.

If you want to program exclusively and at best for a Mac, look into Objective-C and the Cocoa framework. That's what most OS X applications are written in. If you're very used to C#, you can use C or C++ instead, as those will work if compiled for Mac. You're best bet if you really want to be cross-platform with the least trouble is Java.

Cromulent
Feb 25, 2008, 11:17 AM
C# is a Microsoft language. It won't work on a Mac.

Not quite true. Mono is an open source clone of the .NET frameworks and includes a C# compiler and works quite well on Mac OS X by all accounts.

kuwisdelu
Feb 25, 2008, 11:26 AM
Not quite true. Mono is an open source clone of the .NET frameworks and includes a C# compiler and works quite well on Mac OS X by all accounts.

Hmm, I am wrong, then. I didn't think any such frameworks were available for OS X. Well, won't work as well or without as much trouble on a Mac. :rolleyes:

(I'm not the biggest of fan of C# anyway.)

uhs61074
Feb 25, 2008, 12:55 PM
Hmm, I am wrong, then. I didn't think any such frameworks were available for OS X. Well, won't work as well or without as much trouble on a Mac. :rolleyes:

(I'm not the biggest of fan of C# anyway.)

Thanks for reply.so overall based on all reply - we cant use webservice made in .net - Or need to convert in Java and then use Java web service from MAC client ?

i have some query at
http://forums.macrumors.com/showthread.php?p=5031696#post5031696

any of you have some information it will be great.
I am new to MAC - i have devloped one app in Windows and now same need to do in MAC - so checking how possible it is.

regards

AlmostThere
Feb 25, 2008, 05:44 PM
Thanks for reply.so overall based on all reply - we cant use webservice made in .net - Or need to convert in Java and then use Java web service from MAC client ?


Just to clear this up because it isn't clear from your post - I can't tell if you are running the server or writing the client (or both). "Use" a web service, to me, suggests you are the client, as does your thread title. "Run" a web service suggests you are running a server.

Your server needs to run Windows if you have written the server code in .NET. If you want to run the web service server on a Mac, you will need to rewrite it (ignoring Mono for simplicity).

Your client needs to be developed using something other than .NET, such as Java, to run on your Mac. A Mac client can use a remote web service built using .NET.

Krevnik
Feb 25, 2008, 09:52 PM
Your client needs to be developed using something other than .NET, such as Java, to run on your Mac. A Mac client can use a remote web service built using .NET.

As some more information, .NET web services use the SOAP standard. Apple provides some documentation on how to use SOAP web services as a client.

numero
Feb 25, 2008, 10:21 PM
1)Is it possible to use web service created in C# (.net 2.0) to use on MAC machine using apple script or any other language.?

2) Is it possible to write something similar to window service on MAC ?

3) Does Applescript parse the xml file ?

4) what are the systme variable in MAC

5) How to edit registry if MAC has something similar to Registry in Window OS?



1) As a previous poster said, both are possible it will just depend on if you are talking about the client side or server side as to how much work it will be.

2) Look up launchd. The short version is that you get your application written and then you create an XML file that gives the path to the executable and some other info like how often to run it (for something that would be scheduled) or whether to restart it if it should crash, in a particular place that the OS scans at startup (or login) and then you have a "service".

3) Don't know on this one. Sure it can parse text if you want to do all of the work yourself, but I don't know if it has an scripting additions that would make it easy. You shouldn't limit yourself to AppleScript. If there is a tool that is built for this then use that instead. Might be easier to whip up a Cocoa app.

4) You probably are looking for Unix environment variables here. Type "echo $PATH" at the command line. If you have Tomcat installed you probably have a $JAVA_HOME defined.

5) No Registry. Sorry. Well, not really sorry. :)

satyam90
Feb 25, 2008, 10:36 PM
If you are using soap protocol for your webservices, you basically need to write "gsoap" functionality to access your webservice. You can't write "soap" functionality directly.
There is a open source product "iFolder"(visit www.ifolder.com). It is similar to what you might be expecting. It has a UI, and back end will be gsoap service that will contact server webservice and so on......

uhs61074
Feb 26, 2008, 12:05 PM
1) As a previous poster said, both are possible it will just depend on if you are talking about the client side or server side as to how much work it will be.

2) Look up launchd. The short version is that you get your application written and then you create an XML file that gives the path to the executable and some other info like how often to run it (for something that would be scheduled) or whether to restart it if it should crash, in a particular place that the OS scans at startup (or login) and then you have a "service".

3) Don't know on this one. Sure it can parse text if you want to do all of the work yourself, but I don't know if it has an scripting additions that would make it easy. You shouldn't limit yourself to AppleScript. If there is a tool that is built for this then use that instead. Might be easier to whip up a Cocoa app.

4) You probably are looking for Unix environment variables here. Type "echo $PATH" at the command line. If you have Tomcat installed you probably have a $JAVA_HOME defined.

5) No Registry. Sorry. Well, not really sorry. :)


Thanks to all for reply.

well i am talking about consuming the web service which is made in .net and deplyed on Window Server.
MAC machine will be client for that web service.


So overall it seems multiple languages need to be used to create one app on MAC. And again it is too hard or still there will be some limitations.

jeremy.king
Feb 26, 2008, 12:45 PM
So overall it seems multiple languages need to be used to create one app on MAC.

Just use Java, plenty of libraries out there to make this easy.

dernhelm
Feb 26, 2008, 12:46 PM
Thanks to all for reply.

well i am talking about consuming the web service which is made in .net and deplyed on Window Server.
MAC machine will be client for that web service.


So overall it seems multiple languages need to be used to create one app on MAC. And again it is too hard or still there will be some limitations.

I'm not sure you understand correctly even now. With Web Services, the client can be a separate physical computer than the server, possibly even running a different OS - and the server need not ever know.

You can use ANY programming language on your make that is capable of using the OS/X system (POSIX, whatever) libraries to open up a TCP/IP connection and making SOAP style calls over HTTP.

There is nothing magic or hard going on here. On the Mac, you can use perl, ruby, Objective-C, Java, Mono (.net), Javascript, or just about anything else you can get a compiler for. Simply take the WSDL from the windows machine (which is an XML file) and make correctly formed HTTP requests to the web service on the windows computer.

You can pick ONE language you like, and use only it - there is no need for "multiple" languages.

Krevnik
Feb 26, 2008, 02:29 PM
You can pick ONE language you like, and use only it - there is no need for "multiple" languages.

Well, plus there is an upshot to using Obj-C in this case... Apple has documentation for calling SOAP services from Obj-C, and how to do so pretty easily.

EDIT: Posting some links to information and samples on how to use WebServicesCore.framework on OS X 10.2 and later to access Soap in C and Obj-C apps.

Web Services Core Programming Guide (http://developer.apple.com/documentation/Networking/Conceptual/UsingWebservices/1_intro_folder/chapter_1_section_1.html#//apple_ref/doc/uid/TP30000985-CH204-DontLinkElementID_3)

Sample/Tutorial for using Core Foundation and Web Services Core to access a SOAP server (http://developer.apple.com/internet/webservices/webservicescoreandcfnetwork.html)

Monkaaay
Feb 27, 2008, 09:48 AM
There is a lot of incorrect knowledge transfer going on in this thread. If you see the poster asking about C# web services and you don't fully understand what those are, offering your "knowledge" is probably a bad idea.

If there is a web service running on a remote server, whether it be written in .NET or Java, you can use it from a Mac client regardless of whether you use Objective-C, C++, or Java (among others). As long as your programming language can send a HTTP request and interpret an XML response, you'll be able to interact with .NET and Java web services.

sadilak
Feb 27, 2008, 10:34 AM
Yes you can, what you could always do is to return a typed dataset or
a regular dataset. For Non microsoft consumers, the data will be interpreted as an XML string . It is upto you to parse and get the info needed.

lazydog
Feb 27, 2008, 12:07 PM
Another option, PHP + NUSOAP. Not saying it's the best solution but it does work well on the Mac.

b e n

Krevnik
Feb 27, 2008, 01:01 PM
Another option, PHP + NUSOAP. Not saying it's the best solution but it does work well on the Mac.

b e n

Not as a client, really. If you wanted to run the server on a Mac it would be a pretty good and inexpensive one.

lazydog
Feb 27, 2008, 01:31 PM
Not as a client, really. If you wanted to run the server on a Mac it would be a pretty good and inexpensive one.

I guess if you're writing an app with a UI then, yes, Php wouldn't be ideal. But for a client tool running from the command line, cronjob or whatever, then it's a pretty good combination. Perhaps not the best, but still worth considering. I can say this because I've just finished a project using PHP/NUSOAP and Microsoft's AdCenter web services. To be honest PHP wouldn't have been my first choice but I had no choice in the matter. And as it turned out it wasn't too bad an experience!

b e n