[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 782
  • Last Modified:

Instantiating a web service error Cannot implicit convert type

I'm using c#, .net.  When I instantiate this service:

viviendo.ResidentService RS= new viviendo.ResidentService();
viviendo.PizzaSales RSA= new viviendo.PizzaSales();

Then try to access it:
try
{
RSA = RS.getCustomer("123456789");
}
I get error:  Cannot implicitly convert type Viviendo.CustomerResult to PizzaSales

I've been stuck on this for a few days.  Any help would be appreciated.  I need to access the data returned for the data element FacName.
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
javierpdx
Asked:
javierpdx
  • 2
1 Solution
 
käµfm³d 👽Commented:
The error is fairly explanatory:  You are trying to assign the result of the function to a variable of the wrong type. The compiler is expecting to see this:

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

try 
{
    RSA = RS.getCustomer("123456789");
}

Open in new window


If you mouse over the function within the IDE, VS will show you what the return type of the function is.
0
 
javierpdxAuthor Commented:
Thank you!  I appreciate the help.
0
 
javierpdxAuthor Commented:
0

Featured Post

Automating Your MSP Business

The road to profitability.
Delivering superior services is key to ensuring customer satisfaction and the consequent long-term relationships that enable MSPs to lock in predictable, recurring revenue. What's the best way to deliver superior service? One word: automation.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now