2

I made a webservice which is supposed to return an entity 'UserProfile'. Most operations return the expected result but I get empty responses when I directly return a generated class.

Service:

List<UserProfile> IMusicOwnerService.getProfiles()
    {
        return context.UserProfileSet.ToList();
    }

Request

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header/>
   <soapenv:Body>
      <tem:getProfiles/>
   </soapenv:Body>
</soapenv:Envelope>

I modified the Model.tt file ( according to this answer ) then this class was generated:

    using System;
    using System.Collections.Generic;
    using System.Runtime.Serialization;  //Template modification test
    [DataContract]//Template modification test
    public partial class UserProfile
    {

        public UserProfile()
        {
            this.LoginSession = new HashSet<LoginSession>();
            this.Playlist = new HashSet<Playlist>();
            this.Friends = new HashSet<UserProfile>();
            this.Song = new HashSet<Song>();
        }

        [DataMember]//Template modification test
        public int Id { get; set; }
        [DataMember]//Template modification test
        public string UserName { get; set; }
        [DataMember]//Template modification test
        public string Email { get; set; }
        [DataMember]//Template modification test
        public string Password { get; set; }
        [DataMember]//Template modification test
        public string Salt { get; set; }

}

No response when sending the request.

https://i.stack.imgur.com/UCEOe.jpg (not enough reputation to post pictures)

Community
  • 1
  • 1
user22015
  • 23
  • 4

0 Answers0