WCF REST Service not visible in WCFTestClient
Asked Answered
A

3

17

I have successfully configured 3 endpoints for my prototype service. The endpoints are basicHttpBinding, wsHttpBinding, and webHttpBinding. The only glitch I have at the moment is in the WCFTestClient. When I point it to my service it lists the first two, but not the webHttpBinding. I can test the REST endpoint through my browser and it works just fine. Here's my config:

 <system.serviceModel>
    <services>
      <service behaviorConfiguration="serviceBehaviour" name="VMDServices.VMDService">
        <endpoint binding="webHttpBinding"
                  address="rest" behaviorConfiguration="webBehaviour" contract="VMDServices.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint binding="basicHttpBinding"
                  address="basic" bindingConfiguration="basicBinding" contract="VMDServices.IService1">
        </endpoint>
        <endpoint binding="wsHttpBinding"
                  address="ws" bindingConfiguration="wsBinding" contract="VMDServices.IService1">
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
      </service>
    </services>

    <bindings>
      <basicHttpBinding>
        <binding name="basicBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None"></security>
          <readerQuotas maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
      <wsHttpBinding>
        <binding name="wsBinding" transactionFlow="true">
          <security mode="None"></security>
          <reliableSession enabled="true" ordered="true" />
        </binding>
      </wsHttpBinding>
    </bindings>

    <behaviors>
      <endpointBehaviors>
        <behavior name="webBehaviour">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="serviceBehaviour">
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true">
    </serviceHostingEnvironment>
  </system.serviceModel>

Is there any reason why I can't see the webHttpEndpoint in the WCFTestClient tool?

Cheers, Dany.

Ataman answered 20/9, 2011 at 1:43 Comment(1)
WCF Test Client is for SOAP based services - anything BUT webHttpBinding ....Continuous
R
23

It's because web endpoints (unlike SOAP ones) do not expose metadata, so the test client doesn't know about it when it downloads the WSDL for the service. Unlike SOAP, which has well-defined formats for exposing metadata (WSDL, MEX), web (a.k.a. REST) endpoints do not.

That's the short story. If you want to know more details, I wrote a blog post about it at http://blogs.msdn.com/b/carlosfigueira/archive/2012/03/26/mixing-add-service-reference-and-wcf-web-http-a-k-a-rest-endpoint-does-not-work.aspx

Rubbish answered 20/9, 2011 at 2:59 Comment(3)
That's my initial thought... then I found this knowledgebaseworld.blogspot.com/2010/06/… - this guys somehow got it listed on his WCFTestClientAtaman
That endpoint actually cannot be used to be called with JSON (or plain-old XML): it doesn't have the <webHttp/> behavior on it. And I also tried exactly the same scenario as he did, and when I browsed to the WSDL page, I could only see two <wsdl:port> elements (one for basic, one for ws), none for the webHttpBinding endpoint.Rubbish
Yup - he didn't have webHttp behaviour on it, which is something I have in mine since I need it to interact with jQuery.Ajax() calls.Ataman
S
1

The following is a list of features not supported by WCF Test Client:

• Types: Stream, Message, XmlElement, XmlAttribute, XmlNode, types that implement the IXmlSerializableinterface, including the related XmlSchemaProviderAttribute attribute, and the XDocument and XElement types and the ADO.NET DataTable type.

• Duplex contract.

• Transaction.

• Security: CardSpace , Certificate, and Username/Password.

• Bindings: WSFederationbinding, any Context bindings and Https binding, WebHttpbinding (Json response message support).

Source: http://msdn.microsoft.com/en-us/library/bb552364.aspx

Schreiner answered 16/1, 2012 at 9:33 Comment(0)
S
-1

try adding the "mexHttpBinding" endpoint that exposes the metadata

Symptom answered 20/9, 2011 at 6:4 Comment(1)
That will not work - webHttpBinding endpoints are not exposed in the service metadata.Rubbish

© 2022 - 2024 — McMap. All rights reserved.