Hi,
I'm trying to create a web service client in C# but I get stuck at one of
the first steps.
When adding a Web reference to the Visual Studio project; I get this error
(this is a translation, the English terms might not be exact) :
"Error in the custom tool : Impossible to import WebService/Schema.
Impossible to import binding 'cmsserverbinding' (it's the name of the binding
in my WSDL file) from namesapce 'urn:cms. Impossible to import operation
'GetRubriques'. The schema with targetNamespace='urn:cms' has an invalid
syntax. The attribute 'name' may not be present."
Here's the WSDL file of the Web Service I'm trying to reach :
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:si="http://soapinterop.org/xsd"
xmlns:tns="urn:cms" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:cms">
<types><xsd:schema elementFormDefault="qualified" targetNamespace="urn:cms">
<xsd:complexType name="Rubrique">
<xsd:all>
<xsd:element name="id_rubrique" type="xsd:string" />
<xsd:element name="nom" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="Groupe">
<xsd:all>
<xsd:element name="id_groupe" type="xsd:string" />
<xsd:element name="nom" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<xsd:element name="Rubriques">
<xsd:complexType name="tabRubriques">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType="cms:Rubrique[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="Groupes">
<xsd:complexType name="tabGroupes">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="cms:Groupe[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>
<xsd:element name="string1" type="xsd:string">
</xsd:element>
<xsd:element name="string2" type="xsd:string">
</xsd:element>
</xsd:schema>
</types>
<message name="listeRubriquesResponse"><part name="parameters"
element="tns:Rubriques" /></message>
<message name="listeRubriquesRequest"><part name="parameters"
element="tns:string1" /></message>
<message name="listeGroupesResponse"><part name="parameters"
element="tns:Groupes" /></message>
<message name="listeGroupesRequest"><part name="parameters"
element="tns:string2" /></message>
<portType name="cmsserverPortType">
<operation name="getGroupes"><input
message="tns:listeGroupesRequest"/><output
message="tns:listeGroupesResponse"/></operation>
<operation name="getRubriques"><input
message="tns:listeRubriquesRequest"/><output
message="tns:listeRubriquesResponse"/></operation>
</portType>
<binding name="cmsserverBinding" type="tns:cmsserverPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getGroupes">
<documentation>Liste des groupes du CMS</documentation>
<soap:operation soapAction="urn:cms#getGroupes" style="document"/>
<input><soap:body use="literal" namespace="urn:cms"/></input>
<output><soap:body use="literal" namespace="urn:cms"/></output>
</operation>
<operation name="getRubriques">
<documentation>Liste des rubriques du CMS</documentation>
<soap:operation soapAction="urn:cms#getRubriques" style="document"/>
<input><soap:body use="literal" namespace="urn:cms"/></input>
<output><soap:body use="literal" namespace="urn:cms"/></output>
</operation>
</binding>
<service name="cmsserver">
<port name="cmsserverPort" binding="tns:cmsserverBinding">
<soap:address
location="http://localhost/cms_test/backend/webservice/webservice.php"/></port>
</service>
</definitions>
I can't see what "name" attribute the error message refers to. I've tried to
remove each of them but removing the "name" attribute of an element either
generates another error message or doesn't change anything.
I've got the feeling that DotNet is particularly capricious when it comes to
web service description schemas.
For instance, the same WSDL is fully accepted by a web service client
written in PHP...