Last post Sep 14, 2015 05:00 AM by Li Wang
Sep 13, 2015 01:17 PM|sjw2011|LINK
I'm very new to SOAP and C# but I trying to learn by building a simple SOAP web client. I've create a web form with a single button and listbox. Clicking the button sends a SOAP call to the web services, returns a simple result and displays in the list box.
That method (getCountRegisteredSubscribers) doesn't require input and returns an int. Next I want to return information about subscribers using another method called getSubscriber. This method does require input (subscriber name) and will return several results.
I'm passing the subscriber name using a var but all I get back is 'WebApplicaiton2.WebReference.Subscriber' in my listbox. Any suggestions would be appreciated!
public partial class WebForm1 : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
protected void Button1_Click(object sender, EventArgs e)
var subName = "subscriber 1";
WebApplication2.WebReference.SMFAdmin ws = new WebApplication2.WebReference.SMFAdmin();
ListBox1.Items.Add("" + ws.getSubscriber(subName));
Sep 13, 2015 01:28 PM|Ken Tucker|LINK
You should add a property name to the string instead of the returned results because you will only see the type name.
For example (I assume Count is a int property returned)
Sep 13, 2015 01:40 PM|sjw2011|LINK
Thanks for the reply, ws.getCountRegisteredSubscribers works no problem, I get an int in my listbox. It's ws.getSubscriber(subName) that's causing me grief. All I get back in my list box is 'WebApplication2.WebReference.Subscriber'. Any ideas on that one?
Sep 14, 2015 05:00 AM|Li Wang|LINK
As @Ken Tucker mentioned, you will only see the type name if you don't add property name after object. According to your code, service return a
Single object(Subscriber type object) to your form. Please check which property do you want to display. For example, if there is a property named SubscriberName, you could use below code to display it.
ListBox1.Items.Add("" + ws.getSubscriber(subName).SubscriberName);