Resolving a Cannot convert type error
Associated product(s): Product name: Authenticate
Views: 77 | Created: 14 weeks ago | Last updated: 13 weeks ago
Type mismatch errors occur when an attempt to instantiate an object from the Authenticate WSDL is made after adding a web reference to a .Net project. Below is an example of the error:
Unable to generate a temporary class (result=1).
error CS0030: Cannot convert type 'Auth_WSDL_Test.AuthWSDL.SearchTerm[]' to 'Auth_WSDL_Test.AuthWSDL.SearchTerm
Amending the WSDL document to resolve type mismatch
In order to resolve the current issue when consuming the Authenticate Pro Web WSDL in .Net please follow the steps below:
1. Locate the copy of the QAS WSDL in the .Net Project, this exists in the Web References folder:

2. Open the QAS.wsdl file in a text editor and make the changes as noted below:
Change:
<s:element name="QASearch">
<s:complexType>
<s:sequence>
<s:element name="Country" type="s0:ISOType" />
<s:element name="Engine" type="s0:EngineType" />
<s:element minOccurs="0" name="Layout" type="s:string" />
<s:element minOccurs="0" name="QAConfig" type="s0:QAConfigType" />
<s:element minOccurs="0" maxOccurs="1" name="Search" type="s:string" />
<s:element minOccurs="0" maxOccurs="unbounded" name="SearchSpec" nillable="true" type="s0:SearchType" />
</s:sequence>
</s:complexType>
</s:element>
To:
<s:element name="QASearch">
<s:complexType>
<s:sequence>
<s:element name="Country" type="s0:ISOType" />
<s:element name="Engine" type="s0:EngineType" />
<s:element minOccurs="0" name="Layout" type="s:string" />
<s:element minOccurs="0" name="QAConfig" type="s0:QAConfigType" />
<s:element minOccurs="0" maxOccurs="1" name="Search" type="s:string" />
<s:element minOccurs="0" maxOccurs="unbounded" name="SearchSpec" type="s0:SearchType" />
</s:sequence>
</s:complexType>
</s:element>
Change:
<s:complexType name="SearchType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="SearchTerm" type="s0:SearchTerm" />
</s:sequence>
</s:complexType>
To:
<s:complexType name="SearchType">
<s:sequence>
<s:element maxOccurs="unbounded" name="SearchTerm" type="s0:SearchTerm" />
</s:sequence>
<s:attribute minOccurs="0" name="Dummy" type="s:string" />
</s:complexType>
Save the QAS.wsdl file and close the editor
Select the properties of the QAS Web Reference within Visual Studio:

3. Change the ‘Web Reference URL’ to point to the local amended version of the WSDL e.g. C:\Proj\Web References\Proj\QAS.wsdl

4. Right click on the QAS web reference and select ‘Update Web Reference’ in order for the Reference.vb stub class to be refreshed:

Now you will be able to instantiate objects in .Net which are exposed in the QAS.wsdl
Rating
Was this document helpful?
What can we do to improve this information?
Send to friend