How to call a WCF service

Discussion in 'ASP .Net' started by Andy B, Jun 24, 2008.

  1. Andy B

    Andy B Guest

    I have a WCF service project in my solution. I need to call one of the
    services from a web application from inside the same solution. How do I do
    something like this? I can't seem to find the class that has the methods I
    need in it. This is after I added the web reference.
     
    Andy B, Jun 24, 2008
    #1
    1. Advertising

  2. Andy B

    Munna Guest

    On Jun 25, 4:06 am, "Andy B" <> wrote:
    > I have a WCF service project in my solution. I need to call one of the
    > services from a web application from inside the same solution. How do I do
    > something like this? I can't seem to find the class that has the methods I
    > need in it. This is after I added the web reference.


    Hi

    Right click on you project and select "Add service reference"...
    A wizard will popup...
    Click on discover...
    Services on your solution will be populated...
    Select a service and then add

    and in your page... user the proxy name space...

    ServiceReference1.Service1Client myClient = new
    WebApp.ServiceReference1.Service1Client();
    myClient.GetData(4);

    Best of luck

    Munna
    www.munna.shatkotha.com
    www.munna.shatkotha.com/blog
    www.shatkotha.com
     
    Munna, Jun 25, 2008
    #2
    1. Advertising

  3. Andy B

    Andy B Guest

    Hi. I don't have IIS on my dev computer. I have to ftp the website to the
    live server. I noticed that in the service reference, I have the URL set to
    something like http://localhost:8892/Contracts/ContractTemplates.svc. How
    would I make it work on the 2 servers without having to always change the
    references all the time?


    "Munna" <> wrote in message
    news:...
    On Jun 25, 4:06 am, "Andy B" <> wrote:
    > I have a WCF service project in my solution. I need to call one of the
    > services from a web application from inside the same solution. How do I do
    > something like this? I can't seem to find the class that has the methods I
    > need in it. This is after I added the web reference.


    Hi

    Right click on you project and select "Add service reference"...
    A wizard will popup...
    Click on discover...
    Services on your solution will be populated...
    Select a service and then add

    and in your page... user the proxy name space...

    ServiceReference1.Service1Client myClient = new
    WebApp.ServiceReference1.Service1Client();
    myClient.GetData(4);

    Best of luck

    Munna
    www.munna.shatkotha.com
    www.munna.shatkotha.com/blog
    www.shatkotha.com
     
    Andy B, Jun 25, 2008
    #3
  4. Andy B

    Joy Guest

    Hi Andy,
    In Visual Studio 2005, the Web Reference URL's URL Behaviour property by
    default is dynamic. The moment you add a web reference to your application, a
    Key value pair is added under the App Key Settings of your web.config.
    Needless to mention, the key is nothing but the
    WebReferenceName.WebServiceName and the value is the URL for the Web Service.

    I hope it helps.

    regards,
    Joy

    "Andy B" wrote:

    > Hi. I don't have IIS on my dev computer. I have to ftp the website to the
    > live server. I noticed that in the service reference, I have the URL set to
    > something like http://localhost:8892/Contracts/ContractTemplates.svc. How
    > would I make it work on the 2 servers without having to always change the
    > references all the time?
    >
    >
    > "Munna" <> wrote in message
    > news:...
    > On Jun 25, 4:06 am, "Andy B" <> wrote:
    > > I have a WCF service project in my solution. I need to call one of the
    > > services from a web application from inside the same solution. How do I do
    > > something like this? I can't seem to find the class that has the methods I
    > > need in it. This is after I added the web reference.

    >
    > Hi
    >
    > Right click on you project and select "Add service reference"...
    > A wizard will popup...
    > Click on discover...
    > Services on your solution will be populated...
    > Select a service and then add
    >
    > and in your page... user the proxy name space...
    >
    > ServiceReference1.Service1Client myClient = new
    > WebApp.ServiceReference1.Service1Client();
    > myClient.GetData(4);
    >
    > Best of luck
    >
    > Munna
    > www.munna.shatkotha.com
    > www.munna.shatkotha.com/blog
    > www.shatkotha.com
    >
    >
    >
    >
     
    Joy, Jun 25, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Billy Zhang
    Replies:
    7
    Views:
    1,350
    Steven Cheng [MSFT]
    Jul 31, 2008
  2. Simon
    Replies:
    0
    Views:
    1,037
    Simon
    Oct 13, 2009
  3. Cindy Lee
    Replies:
    1
    Views:
    2,180
    Mr. Arnold
    Mar 19, 2010
  4. Curt K
    Replies:
    3
    Views:
    468
    John Saunders [MVP]
    Jun 15, 2007
  5. kellygreer1

    Web Service versus WCF Service (and Books)

    kellygreer1, Nov 8, 2007, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    166
    Andrew Faust
    Nov 9, 2007
Loading...

Share This Page