locked
Access wsdl RRS feed

  • Question

  • How I can access the wsdl from  web  browser?
    This is my first service application.Thats why I ask this question?
    Can you help me to create a WCF service?
    Thanks in advance.........
    Saturday, October 31, 2009 8:46 AM

Answers

  • WCF Service Samples

    The samples in this section cover service hosting, behaviors, and error handling in a Windows Communication Foundation (WCF) service.

    In This Section

    Service: Behaviors Samples
    Covers samples that show how to configure the instancing behavior and concurrency, and use attributes to define permissions.

    Service Hosting Samples
    Covers samples that show services that are self hosted, Web hosted, and hosted as an NT Service.

    Multiple Endpoints
    Shows how to configure multiple endpoints in a single contract.

    Multiple Contracts
    Demonstrates how to implement more than one contract on a service and how to configure endpoints for communicating with each of the implemented contracts.

    Addressing
    Demonstrates a how to specify endpoints using relative or absolute addressing.

    Service Description
    Demonstrates how a service can retrieve its service description information at runtime.

    Imperative
    Demonstrates how to define a WsHttpBinding for a service using code.

    Service Interoperability Samples
    Shows how non-WCF clients can interoperate with a WCF service.

    WCF Security Samples
    Demonstrates service security functionality.

    OperationContextScope
    Demonstrates how to send extra information on a WCF call using headers.

    Multiple Endpoints at a Single ListenUri
    Demonstrates a service that hosts multiple endpoints at a single ListenUri.

    ConcurrencyMode Reentrant
    Demonstrates the necessity and implications of using ConcurrencyMode.Reentrant on a service implementation.
    • Marked as answer by Bin-ze Zhao Friday, November 6, 2009 7:13 AM
    Saturday, October 31, 2009 10:34 AM
  • Create a new WCF Service Library project and add the following code to it:

    [System.ServiceModel.ServiceContract]
    public interface IMyFirstService
    {
        [System.ServiceModel.OperationContract]
        void MyFirstOperation();
    }
    
    
    public class MyFirstService : IMyFirstService
    {
        public void MyFirstOperation()
        {
            // some logic goes here
        }
    }

    You'll also need a config file populated with the following content:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>
        <services>
          <service name="MyFirstService" behaviorConfiguration="myFirstServiceBehavior">
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:40000/myFirstService.svc"/>
              </baseAddresses>
            </host>
            <endpoint address="myFirstEndpoint" binding="basicHttpBinding" contract="IMyFirstService">
            </endpoint>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="myFirstServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>

    After setting it up, you can run the service - WCF Service Host helper app will kick in and host the service automatically. All you have to do now is navigate your browser to http://localhost:40000/myFirstService.svc?wsdl and you'll be able to see your service's wsdl document. 

    Hope this helped!

    Regards,
    Stipe-Ivan
    • Marked as answer by Bin-ze Zhao Friday, November 6, 2009 7:14 AM
    Sunday, November 1, 2009 1:52 AM

All replies

  • WCF Service Samples

    The samples in this section cover service hosting, behaviors, and error handling in a Windows Communication Foundation (WCF) service.

    In This Section

    Service: Behaviors Samples
    Covers samples that show how to configure the instancing behavior and concurrency, and use attributes to define permissions.

    Service Hosting Samples
    Covers samples that show services that are self hosted, Web hosted, and hosted as an NT Service.

    Multiple Endpoints
    Shows how to configure multiple endpoints in a single contract.

    Multiple Contracts
    Demonstrates how to implement more than one contract on a service and how to configure endpoints for communicating with each of the implemented contracts.

    Addressing
    Demonstrates a how to specify endpoints using relative or absolute addressing.

    Service Description
    Demonstrates how a service can retrieve its service description information at runtime.

    Imperative
    Demonstrates how to define a WsHttpBinding for a service using code.

    Service Interoperability Samples
    Shows how non-WCF clients can interoperate with a WCF service.

    WCF Security Samples
    Demonstrates service security functionality.

    OperationContextScope
    Demonstrates how to send extra information on a WCF call using headers.

    Multiple Endpoints at a Single ListenUri
    Demonstrates a service that hosts multiple endpoints at a single ListenUri.

    ConcurrencyMode Reentrant
    Demonstrates the necessity and implications of using ConcurrencyMode.Reentrant on a service implementation.
    • Marked as answer by Bin-ze Zhao Friday, November 6, 2009 7:13 AM
    Saturday, October 31, 2009 10:34 AM
  • Hi,

    If you are hosting your service in IIS then right click your svc file and choose view in browser. Else copy your endpoint and add a ?wsdl add the end and paste the resultant string in your browser and you'll be able to access it.
    http://thoughtorientedarchitecture.blogspot.com/
    • Proposed as answer by Haripraghash Saturday, October 31, 2009 2:59 PM
    Saturday, October 31, 2009 2:58 PM
  • Create a new WCF Service Library project and add the following code to it:

    [System.ServiceModel.ServiceContract]
    public interface IMyFirstService
    {
        [System.ServiceModel.OperationContract]
        void MyFirstOperation();
    }
    
    
    public class MyFirstService : IMyFirstService
    {
        public void MyFirstOperation()
        {
            // some logic goes here
        }
    }

    You'll also need a config file populated with the following content:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.serviceModel>
        <services>
          <service name="MyFirstService" behaviorConfiguration="myFirstServiceBehavior">
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost:40000/myFirstService.svc"/>
              </baseAddresses>
            </host>
            <endpoint address="myFirstEndpoint" binding="basicHttpBinding" contract="IMyFirstService">
            </endpoint>
          </service>
        </services>
        <behaviors>
          <serviceBehaviors>
            <behavior name="myFirstServiceBehavior">
              <serviceMetadata httpGetEnabled="true"/>
            </behavior>
          </serviceBehaviors>
        </behaviors>
      </system.serviceModel>
    </configuration>

    After setting it up, you can run the service - WCF Service Host helper app will kick in and host the service automatically. All you have to do now is navigate your browser to http://localhost:40000/myFirstService.svc?wsdl and you'll be able to see your service's wsdl document. 

    Hope this helped!

    Regards,
    Stipe-Ivan
    • Marked as answer by Bin-ze Zhao Friday, November 6, 2009 7:14 AM
    Sunday, November 1, 2009 1:52 AM