Ask a questionAsk a question
 

AnswerJSON enabled WCF Service understanding

  • Wednesday, November 04, 2009 8:59 PMdev14 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    After trying to make my first WCF, I ended up with a lot of questions.

    VS 2008 (Calling service using javascript):
    1. Are the JSON enabled WCF services remotely accessable ?
    2. Do we need to create a proxy in our local machine to comsume remote WCF service?
    3. If Yes, why are we doing a JSON enabled service?
    4. How do the service know the return path to return the JSON object?(the application from which we call the service)

    VS 2005 (Calling service using javascript):
    1. Can we invoke the service from VS 2005 environment?

    Thanks in advance.

Answers

  • Wednesday, November 04, 2009 9:52 PMStipe-Ivan Latkovic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Ok, here we go :)

    VS 2008:
    1) Yes, what's the point of having a service if nobody can access it...
    2) Yes
    3) JSON is a format of communication, just like XML
    4) Well, the communication is done via HTTP requests. Below that, there are sockets. Each socket is defined by its ip and a port it uses to communicate with outside world (a service in this case).

    VS 2005:
    1) Yes, you only need to have the latest versions of .NET Framework installed (i.e. if you want to use the built in AJAX functionality - a web service can be accessed from a number of different frameworks as long as they follow the rules of communication).

    You should check out the following article: Calling Web Services From Client Script

    Hope this helped!

    Regards,
    Stipe-Ivan
  • Friday, November 06, 2009 11:38 PMStipe-Ivan Latkovic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You can download the Windows SDK, it contains SvcUtil.exe. Regarding the other question, you have to have a proxy of some kind. You can have a classic proxy, created by SvcUtil or you can use self-crafted proxy e.g. that will invoke your REST service and parse the received data.

    Regards,
    Stipe Ivan

All Replies

  • Wednesday, November 04, 2009 9:52 PMStipe-Ivan Latkovic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Ok, here we go :)

    VS 2008:
    1) Yes, what's the point of having a service if nobody can access it...
    2) Yes
    3) JSON is a format of communication, just like XML
    4) Well, the communication is done via HTTP requests. Below that, there are sockets. Each socket is defined by its ip and a port it uses to communicate with outside world (a service in this case).

    VS 2005:
    1) Yes, you only need to have the latest versions of .NET Framework installed (i.e. if you want to use the built in AJAX functionality - a web service can be accessed from a number of different frameworks as long as they follow the rules of communication).

    You should check out the following article: Calling Web Services From Client Script

    Hope this helped!

    Regards,
    Stipe-Ivan
  • Thursday, November 05, 2009 2:34 PMdev14 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ivan,

    Thanks for answering my quiries and posting some useful information.

    I posted a question couple of days ago -->  http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/748c904c-aaba-40c4-ad84-c97e7cded12e

    The only thing I missed was adding a proxy on my local machine, because I had different understanding about JSON before.

    After using Firebug the response was trying to hit ""POST http://localhost:4007/WCFService.svc/HelloWorld""  which never existed in my local machine.

    In VS 2008 it is simple to add a WCF proxy by adding web reference.

    1. I was wondering how do we do it for VS2005. because there is no svutil.exe in vs2005
    2. Is there any way that we can communicate with WCF services without adding a proxy in the client application.

    I couldn't test the service because i'm working from different location. so I keep the question open.

    Thanks.

  • Friday, November 06, 2009 11:38 PMStipe-Ivan Latkovic Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You can download the Windows SDK, it contains SvcUtil.exe. Regarding the other question, you have to have a proxy of some kind. You can have a classic proxy, created by SvcUtil or you can use self-crafted proxy e.g. that will invoke your REST service and parse the received data.

    Regards,
    Stipe Ivan