Use C# web service on MAC clinet

Discussion in 'Mac Programming' started by uhs61074, Feb 24, 2008.

  1. macrumors newbie

    Joined:
    Feb 22, 2008
    #1
    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
     
  2. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    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).
     
  3. thread starter macrumors newbie

    Joined:
    Feb 22, 2008
    #3
    [uhs61074]: Thanks for reply.

     
  4. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #4
    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.
     
  5. macrumors 65816

    Joined:
    Jan 13, 2008
    #5
    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.
     
  6. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #6
    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.
     
  7. macrumors 65816

    Joined:
    Jan 13, 2008
    #7
    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.)
     
  8. thread starter macrumors newbie

    Joined:
    Feb 22, 2008
    #8
    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
     
  9. macrumors 6502a

    #9
    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.
     
  10. macrumors 68020

    Krevnik

    Joined:
    Sep 8, 2003
    #10
    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.
     
  11. macrumors regular

    Joined:
    Jul 23, 2002
    Location:
    OR
    #11

    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. :)
     
  12. macrumors regular

    satyam90

    Joined:
    Jul 30, 2007
    Location:
    Bangalore, India
    #12
    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......
     
  13. thread starter macrumors newbie

    Joined:
    Feb 22, 2008
    #13

    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.
     
  14. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #14
    Just use Java, plenty of libraries out there to make this easy.
     
  15. macrumors 68000

    dernhelm

    Joined:
    May 20, 2002
    Location:
    middle earth
    #15
    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.
     
  16. macrumors 68020

    Krevnik

    Joined:
    Sep 8, 2003
    #16
    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

    Sample/Tutorial for using Core Foundation and Web Services Core to access a SOAP server
     
  17. macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #17
    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.
     
  18. macrumors member

    Joined:
    Feb 27, 2008
    Location:
    NY
    #18
    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.
     
  19. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #19
    Another option, PHP + NUSOAP. Not saying it's the best solution but it does work well on the Mac.

    b e n
     
  20. macrumors 68020

    Krevnik

    Joined:
    Sep 8, 2003
    #20
    Not as a client, really. If you wanted to run the server on a Mac it would be a pretty good and inexpensive one.
     
  21. macrumors 6502a

    Joined:
    Sep 3, 2005
    Location:
    Cramlington, UK
    #21
    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
     

Share This Page