Note that there are some explanatory texts on larger screens.

plurals
  1. POReturning object from webservice via controller class returns an empty object
    primarykey
    data
    text
    <p>I'm building my objects with data from my database and so far so good</p> <pre><code> public static List&lt;ImageData&gt; GetAllImageData(Guid UserId) { List&lt;ImageData&gt; imageDataList = new List&lt;ImageData&gt;(); try { SqlCommand cmd = DBHandler.getCommand("sp_Get_AllImagesForWebUser"); DBHandler.AddParameter(ref cmd, "@UserId", UserId); foreach (DataRow row in DBHandler.ExecuteSP(cmd).Tables[0].Rows) { LogWriter.Print("imagedatacontroller() new Guid(row[ImageId].ToString()): " + new Guid(row["ImageId"].ToString()), LogLevel.DEBUG); imageDataList.Add( new ImageData(new Guid(row["ImageId"].ToString()), new Guid(row["UserId"].ToString()), row["ImagePath"].ToString(), (int)row["PatientId"], row["BodyPart"].ToString(), row["ReasonForVisit"].ToString(), row["Diagnosis"].ToString(), Convert.ToBoolean(row["ConsentForResearch"]), Convert.ToBoolean(row["ConsentForEducation"]), Convert.ToBoolean(row["ConsentForStorage"])) ); } } catch (Exception e) { LogWriter.Print("Exception: ImageDataController-&gt;GetAllImageData() " + e, LogLevel.EXCEPTION); } return imageDataList; } </code></pre> <p>Then I have a webservice (.ASMX) that exposes the function and returns the List of ImageData</p> <pre><code> [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public List&lt;ImageData&gt; GetImageDataFromUser(string UserId) { return ImageDataController.GetAllImageData(new Guid(UserId)); } </code></pre> <p>But the problem is that the two Guid attributes of ImageData (ImageId and UserId) is a only-zero value Guid and I can't figure out why. I've validated with my LogWriter that its a valid and the correct Guid, but as soon as I try and expose it through my webservice its a only-zero guid.</p> <p>This is how my SOAP looks like</p> <pre><code>&lt;ArrayOfImageData xmlns="http://172.18.67.166:147/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;ImageData&gt; &lt;ImageId&gt;00000000-0000-0000-0000-000000000000&lt;/ImageId&gt; &lt;UserId&gt;00000000-0000-0000-0000-000000000000&lt;/UserId&gt; &lt;ImagePath&gt;C:\inetpub\wwwroot\Omegapoint\data\UploadedImages\0416f1aa-9b57-4ba8-be54-398ffa9d7139.PNG&lt;/ImagePath&gt; &lt;PatientId&gt;0&lt;/PatientId&gt; &lt;CreationDate&gt;2013-03-17T22:08:10.1964107+01:00&lt;/CreationDate&gt; &lt;Bodypart/&gt; &lt;ReasonForVisit/&gt; &lt;Diagnosis/&gt; &lt;ConsentForResearch&gt;false&lt;/ConsentForResearch&gt; &lt;ConsentForEducation&gt;false&lt;/ConsentForEducation&gt; &lt;ConsentForStorage&gt;false&lt;/ConsentForStorage&gt; &lt;/ImageData&gt; &lt;/ArrayOfImageData&gt; </code></pre> <p>But the ImageId should be: </p> <pre><code>0416f1aa-9b57-4ba8-be54-398ffa9d7139 </code></pre> <p>And the UserId should be: </p> <pre><code>4bcd23a9-2815-42ef-b9ea-671b2aa08aa3 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload