Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET webservice client null properties in result
    text
    copied!<p>Upon seemingly successfully consuming a web service in a c# console application, inspection of the returned object shows the properties are all null!</p> <p>After much searching for answers, I've tracked the issue down to a namespace problem in the SOAP XML -- using fiddler, my slightly modified SOAP response looks like so:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt; &lt;soapenv:Body&gt; &lt;MyResponse xmlns="http://foo.com"&gt; &lt;FIRST_NM xmlns=""&gt;Michael&lt;/FIRST_NM&gt; &lt;/MyResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p>The only part I added was the:</p> <p>...FIRST_NM <strong>xmlns=""</strong>>Michael... (the bold part) using fiddler. </p> <p>Once I did this as a man-in-the-middle during a debug session -- voila! The FIRST_NM value of "Michael" was displayed to me in my client app for the first time ever. I decided to try this because I noticed that the request going out from my client had such an attribute, and the response did not.</p> <p>OK, so diagnosis completed. I am turning to the step where I make it work. Assuming I have no control over the server side of things, I tried opening up the Reference.cs file and making some changes, such as changing this:</p> <pre><code>[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Order=3)] public string FIRST_NM { get { return this.fIRST_NMField; } set { this.fIRST_NMField = value; this.RaisePropertyChanged("FIRST_NM"); } } </code></pre> <p>to this:</p> <pre><code>[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, Namespace="http://foo.com", Order=3)] public string FIRST_NM { ... </code></pre> <p>I added <strong>Namespace="http://foo.com",</strong> to the XmlElementAttribute. My thinking was that without the xmlns="" that the namespace "http://foo.com" was inherited from parent "MyResponse" tag and I'd get a match.</p> <p>That, however, did not work. Any direction you all could point me in would be greatly appreciated.</p>
 

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