none
WCF Rest service to be consumed by an android client. Can somebody please post a easy helpful solution for the same problem step by step. RRS feed

  • Question

  • <p>Hi I want to make a WCF Rest service to be consumed by an android client. Can somebody please post a easy helpful solution for the same problem step by step.</p><p>As far as I see Web.config:</p><br />

    <service name="ServifyCoreModulesService.Service1">
            <endpoint address="" behaviorConfiguration="restfulBehavior"
              binding="webHttpBinding" bindingConfiguration="" contract="ServifyCoreModulesService.IService1" />
            <host>
              <baseAddresses>
                <add baseAddress="http://localhost/service1" />
              </baseAddresses>
            </host>
          </service>

    App.config:

    <client>
        <endpoint
          name="endpoint1"
          address="http://localhost/ServifyCoreModulesService/Service1.svc"
          binding="webHttpBinding"
          bindingConfiguration=""
          behaviorConfiguration="restfulBehavior"
          contract="ServifyCoreModulesService.IService1" >

          <metadata>
            <wsdlImporters>
              <extension
                type="Microsoft.ServiceModel.Samples.WsdlDocumentationImporter, WsdlDocumentation"/>
            </wsdlImporters>
          </metadata>

          <identity>
            <servicePrincipalName value="host/localhost" />
          </identity>
        </endpoint>
        </client>

    I am getting issue with metadata. I dont understand all of these tags does anybody have a start to finish tutorial on this ? Or any clue about why i should configure in a particular way?


    • Edited by Angad27 Sunday, July 20, 2014 2:36 AM
    Sunday, July 20, 2014 2:36 AM

Answers

  • Hi,

    For the WCF Rest Servicce, we can not create a client by using the add service reference. We should use the Jquery, HttpWebRequest, HttpClient and so on to call it.

    Then we should also add the following for the service config file:

    <endpointBehaviors>
        	<behavior name="restfulBehavior">
        	  <webHttp />
        	</behavior>
    </endpointBehaviors>
    

    For more article on WCF Rest Service and android, please try to refer to the following:
    http://fszlin.dymetis.com/post/2010/05/10/Comsuming-WCF-Services-With-Android.aspx .

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, July 21, 2014 11:16 AM
    Moderator