Error adding a Web reference to a VS .NET project

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • glebur

    Error adding a Web reference to a VS .NET project

    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 'cmsserverbindi ng' (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="htt p://schemas.xmlsoap .org/wsdl/soap/"
    xmlns:wsdl="htt p://schemas.xmlsoap .org/wsdl/"
    xmlns="http://schemas.xmlsoap .org/wsdl/" targetNamespace ="urn:cms">

    <types><xsd:sch ema elementFormDefa ult="qualified" targetNamespace ="urn:cms">

    <xsd:complexTyp e name="Rubrique" >
    <xsd:all>
    <xsd:element name="id_rubriq ue" type="xsd:strin g" />
    <xsd:element name="nom" type="xsd:strin g" />
    </xsd:all>
    </xsd:complexType >


    <xsd:complexTyp e name="Groupe">
    <xsd:all>
    <xsd:element name="id_groupe " type="xsd:strin g" />
    <xsd:element name="nom" type="xsd:strin g" />
    </xsd:all>
    </xsd:complexType >

    <xsd:element name="Rubriques ">
    <xsd:complexTyp e name="tabRubriq ues">
    <xsd:complexCon tent>
    <xsd:restrictio n base="SOAP-ENC:Array">
    <xsd:attribut e ref="SOAP-ENC:arrayType"
    wsdl:arrayType= "cms:Rubriq ue[]"/>
    </xsd:restriction >
    </xsd:complexCont ent>
    </xsd:complexType >
    </xsd:element>

    <xsd:element name="Groupes">
    <xsd:complexTyp e name="tabGroupe s">
    <xsd:complexCon tent>
    <xsd:restrictio n base="SOAP-ENC:Array">
    <xsd:attribut e ref="SOAP-ENC:arrayType" wsdl:arrayType= "cms:Groupe[]"/>
    </xsd:restriction >
    </xsd:complexCont ent>
    </xsd:complexType >
    </xsd:element>

    <xsd:element name="string1" type="xsd:strin g">
    </xsd:element>

    <xsd:element name="string2" type="xsd:strin g">
    </xsd:element>

    </xsd:schema>
    </types>

    <message name="listeRubr iquesResponse"> <part name="parameter s"
    element="tns:Ru briques" /></message>
    <message name="listeRubr iquesRequest">< part name="parameter s"
    element="tns:st ring1" /></message>

    <message name="listeGrou pesResponse"><p art name="parameter s"
    element="tns:Gr oupes" /></message>
    <message name="listeGrou pesRequest"><pa rt name="parameter s"
    element="tns:st ring2" /></message>

    <portType name="cmsserver PortType">
    <operation name="getGroupe s"><input
    message="tns:li steGroupesReque st"/><output
    message="tns:li steGroupesRespo nse"/></operation>
    <operation name="getRubriq ues"><input
    message="tns:li steRubriquesReq uest"/><output
    message="tns:li steRubriquesRes ponse"/></operation>
    </portType>

    <binding name="cmsserver Binding" type="tns:cmsse rverPortType">
    <soap:binding style="document "
    transport="http ://schemas.xmlsoap .org/soap/http"/>
    <operation name="getGroupe s">
    <documentation> Liste des groupes du CMS</documentation>
    <soap:operati on soapAction="urn :cms#getGroupes " style="document "/>
    <input><soap:bo dy use="literal" namespace="urn: cms"/></input>
    <output><soap:b ody use="literal" namespace="urn: cms"/></output>
    </operation>
    <operation name="getRubriq ues">
    <documentation> Liste des rubriques du CMS</documentation>
    <soap:operati on soapAction="urn :cms#getRubriqu es" style="document "/>
    <input><soap:bo dy use="literal" namespace="urn: cms"/></input>
    <output><soap:b ody use="literal" namespace="urn: cms"/></output>
    </operation>

    </binding>

    <service name="cmsserver ">
    <port name="cmsserver Port" binding="tns:cm sserverBinding" >
    <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...
Working...