Solved

Accessing an array through a WSDL

Posted on 2013-12-18
4
268 Views
Last Modified: 2013-12-18
Part of this is working.  I can get the MyID to show and FirstName, but do I return an ArrayOfPizzaSales value for FacName based on strMyID?

viviendo.ResidentService RS= new viviendo.ResidentService();
viviendo.CustomerResult RSA = new Viviendo.CustomerResult();
vividendo.PizzaSales PS = new viviendo.PizzaSales();

strMyID = tbMyID.Text;
try
{

RSA = RS.getCustomer(strMyID);

litMyID.Text = RSA.MyID;
litFirstName.Text = RSA.FirstName;

litFacType.Text = PS.FacName; //not working.
}

Thanks!

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="https://viviendo.mysite.net/Greek/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="https://viviendo.mysite.net/Greek/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:s="http://www.w3.org/2001/XMLSchema">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Provide Customer Lookup</wsdl:documentation>
<wsdl:types>
<s:schema targetNamespace="https://viviendo.mysite.net/Greek/" elementFormDefault="qualified">
<s:element name="getCustomer">
<s:complexType>
<s:sequence>
<s:element name="MySchoolid" type="s:string" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element><s:element name="getCustomerResponse">
<s:complexType>
<s:sequence><s:element name="getCustomerResult" type="tns:ABCDPatron" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element><s:complexType name="ABCDPatron">
<s:sequence>
<s:element name="MYSCHOOLID" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="FirstName" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="LastName" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="Contracts" type="tns:ArrayOfPizzaSales" maxOccurs="1" minOccurs="0"/>
<s:element name="Exception" type="s:string" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
<s:complexType name="ArrayOfPizzaSales">
<s:sequence>
<s:element name="PizzaSales" type="tns:PizzaSales" maxOccurs="unbounded" minOccurs="0" nillable="true"/>
</s:sequence>
</s:complexType>
<s:complexType name="PizzaSales">
<s:sequence>
<s:element name="Term" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="FacType" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="FacName" type="s:string" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="getCustomerSoapIn">
<wsdl:part name="parameters" element="tns:getCustomer"/>
</wsdl:message>
<wsdl:message name="getCustomerSoapOut">
<wsdl:part name="parameters" element="tns:getCustomerResponse"/></wsdl:message><wsdl:portType name="ResidentServiceSoap">
<wsdl:operation name="getCustomer"><wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Information Lookup</wsdl:documentation>
<wsdl:input message="tns:getCustomerSoapIn"/><wsdl:output message="tns:getCustomerSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ResidentServiceSoap" type="tns:ResidentServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getCustomer">
<soap:operation style="document" soapAction="https://viviendo.mysite.net/Greek/getCustomer"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output><soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ResidentServiceSoap12" type="tns:ResidentServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getCustomer">
<soap12:operation style="document" soapAction="https://viviendo.mysite.net/Greek/getCustomer"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ResidentService">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Provide Customer Lookup</wsdl:documentation>
<wsdl:port name="ResidentServiceSoap" binding="tns:ResidentServiceSoap"><soap:address location="https://viviendo.mysite.net/abcd/ws/residentservice.asmx"/>
</wsdl:port><wsdl:port name="ResidentServiceSoap12" binding="tns:ResidentServiceSoap12">
<soap12:address location="https://viviendo.mysite.net/abcd/ws/residentservice.asmx"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Open in new window

0
Comment
Question by:javierpdx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39727541
How did you generate the ResidentService, CustomerResult, and PizzaSales classes?
0
 

Author Comment

by:javierpdx
ID: 39727560
I'm trying to access the web serviced share with me.  I didn't actually create this WSDL or classes in the WSDL.

When I debug, add a toggle point to RSA = RS.getCustomer(strMyID); in VS I can see the field and records being returned that I want when I mouse over and drill down.    So I thought I could just use litFacType.Text = PS.FacName but I am getting a NULL value.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39727616
Well, this line:

vividendo.PizzaSales PS = new viviendo.PizzaSales();

Open in new window


...just creates a new instance of a class within your program. It's not actually talking to the webservice. Talking to the web service occurs in this line:

RSA = RS.getCustomer(strMyID);

Open in new window


When you call the functions on the proxy object, you are actually making calls out to the webservice. Any data classes (e.g. PizzaSales) just hold data; they don't actually communicate with the webservice itself.

So the reason you are getting the null error is because the class doesn't actually have any data in it. You need to populate it by calling one of the service's functions.
0
 

Author Closing Comment

by:javierpdx
ID: 39727668
Thanks for helping me think that one out.  I was able to call a service function and populate it.  I appreciate it!
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These instructions are based on installing Owncloud on your new raspberry pi connected with a usb HDD. What do you need Part A? A Raspberry Pi, model B. A boot SD card for the Raspberry Pi. A usb HDD An Ethernet cable to connect to the lo…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question