troubleshooting Question

ASP.NET SOAP response - class/property access

Avatar of askasp
askasp asked on
.NET ProgrammingASP.NETWCF
57 Comments1 Solution1699 ViewsLast Modified:
I have created a service reference for a soap wsdl and trying to work with the generated proxy classes. This is what I have so far. Just pasting snippets as an example

reference.cs file
    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace=".....")]
    public partial class PER_NAME : object, System.ComponentModel.INotifyPropertyChanged {

    private string nAMEField;

      /// <remarks/>
        public string NAME {
            get {
                return this.nAMEField;
            set {
                this.nAMEField = value;

Client Code
ServiceReference1.Service_PortTypeClient serv = new ServiceReference1.Service_PortTypeClient();

serv.ClientCredentials.UserName.UserName = "....";
serv.ClientCredentials.UserName.Password = ".....";

ServiceReference1.ServiceRequest req = new ServiceReference1.ServiceRequest ();

req.ID= "...";
req.OPERATION = "....";

ServiceReference1.ServiceResponse person = new ServiceReference1.ServiceResponse ();
person = serv.GetMethod(req);

When I intercept the response and load it into an xml document I can see the response but I couldn't figure out how to access to the objects through generated proxy classes. How can I get the value of NAME after receiving the response?

I keep getting System.NullReferenceException probably because I am not initiating and assigning them correctly. Finally below is the generated xsd.  I also attached the structure of xsd if it helps

<xs:element cust:entityName="Names" name="PER_NAME">
      <xs:documentation xml:lang="en">Names - Names</xs:documentation>
        <xs:element cust:label="Name" minOccurs="0" maxOccurs="1" name="NAME">
            <xs:documentation xml:lang="en"> Name, Name </xs:documentation>
            <xs:restriction base="xs:string">
              <xs:maxLength value="50" />
Join our community to see this answer!
Unlock 1 Answer and 57 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 57 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros