none
Wcf generate a Json Object RRS feed

  • Question

  • Heya,
    I got a lil problem..
    my service :

    namespace Cbu.cs.web
    {
        [ServiceContract]
        public class myServices
        {
            [WebGet]
            [OperationContract]
            public Account CreateAccount()
            {
                return new Account() { Id = Guid.NewGuid(), UserName = "User1", Password = "myPass" };
            }
        }
    }
    
      <system.serviceModel>
        <behaviors>
          <endpointBehaviors>
            <behavior name="Cbu.cs.web.myServicesBehavior">
              <enableWebScript />
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <services>
          <service name="Cbu.cs.web.myServices">
            <endpoint address="" behaviorConfiguration="Cbu.cs.web.myServicesBehavior"
              binding="webHttpBinding" contract="Cbu.cs.web.myServices" />
          </service>
        </services>
      </system.serviceModel>
    When I call my webservice :
    http://localhost/Cbu.cs.web/myServices.svc/CreateAccount

    My result is:
    {"d":{"__type":"Account:#myNamespace","Id":"246c35b2-0216-4961-ac53-8255be7f5678","Password":"myPass","UserName":"User1"}}

    My question is simple ..
    where do you come this 'd' object ?

    I was thinking my ws response will be {"__type":"Account:#myNamespace","Id":"246c35b2-0216-4961-ac53-8255be7f5678","Password":"myPass","UserName":"User1"}

    Can someone tell me why ?
    Thanks
    Cbu
    Wednesday, November 4, 2009 11:36 AM

Answers

All replies