Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Impossible to add web reference

I'm tryin to use soap service in Visual Studio 2010 with c#. I go ad try new service reference but I always get that error

Custom tool error: Failed to generate code for the service reference 'easyZM'. Please check other error and warning messages for details. path\Service References\serviceTest\Reference.svcmap

with those warning:

Warning 13 Custom tool warning: Cannot import wsdl:portType

Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter

Error: Cannot find definition for http://schemas.xmlsoap.org/wsdl/:putDkm. Service Description with namespace http://schemas.xmlsoap.org/wsdl/ is missing.

Parameter name: name

XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:Easy']/wsdl:portType[@name='EasyPort'] path\Service References\serviceTest\Reference.svcmap

I have no idea what to do. I have looked at that question What does this WCF error mean: "Custom tool warning: Cannot import wsdl:portType" but none of solutions provided there worked for me.

Path to wsdl: https://ews.zav-mb.si/easy/wsdl/easy.wsdl

Any ideas?

Can somebody else try and report his results?

I found out that problem is likely with the wsdl file itself. But I have no idea how to fix it.

<definitions xmlns:tns="urn:Easy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="Easy" targetNamespace="urn:Easy">
<types>
    <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Hello">
    <xsd:element name="fileName" type="xsd:string"/>
    <xsd:element name="fileContent" type="xsd:string"/>
    <xsd:element name="fileSize" type="xsd:int"/>
    <xsd:element name="easyDocRef" type="xsd:string"/>
    <xsd:element name="message" type="xsd:string"/>
    <xsd:element name="result" type="xsd:boolean"/>
    </xsd:schema>
</types>

<message name="putDkm">
    <part name="fileName" type="tns:fileName"/>
    <part name="fileContentBase64Encoded" type="tns:fileContent"/>
    <part name="fileSize" type="tns:fileSize"/>
</message>
<message name="putDkmResponse">
    <part name="result" type="tns:result"/>
    <part name="message" type="tns:message"/>
    <part name="easyDocref" type="tns:easyDocRef"/>
</message>
<!--  get stuff  -->
<message name="get">
    <part name="easyDocRef" type="tns:getEasyDocRef"/>
</message>
<message name="getResponse">
    <part name="result" type="tns:result"/>
    <part name="message" type="tns:message"/>
    <part name="fileContentBase64Encoded" type="tns:fileContent"/>
    <part name="fileName" type="tns:fileName"/>
</message>
<portType name="EasyPort">
    <operation name="putDkm">
        <input message="putDkm"/>
        <output message="tns:putDkmResponse"/>
    </operation>
    <operation name="get">
        <input message="get"/>
        <output message="tns:getResponse"/>
    </operation>
</portType>
<binding name="EasyBinding" type="tns:EasyPort">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="putDkm">
        <soap:operation soapAction="urn:putDkmAction"/>
        <input>
            <soap:body use="encoded" namespace="urn:Easy" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </input>
        <output>
            <soap:body use="encoded" namespace="urn:Easy" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </output>
    </operation>
    <operation name="get">
        <soap:operation soapAction="urn:getAction"/>
        <input>
            <soap:body use="encoded" namespace="urn:Easy" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </input>
        <output>
            <soap:body use="encoded" namespace="urn:Easy" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
        </output>
    </operation>
</binding>
<service name="EasyService">
    <port name="EasyPort" binding="tns:EasyBinding">
        <soap:address location="https://ews.zav-mb.si/easy/index.php"/>
    </port>
</service>
</definitions>
like image 850
gabrjan Avatar asked Sep 22 '26 10:09

gabrjan


1 Answers

Definitely there's a problem with WSDL. I had the same warning. Then I changed

<portType name="EasyPort">
    <operation name="putDkm">
        <input message="putDkm"/>
        <output message="tns:putDkmResponse"/>
    </operation>
    <operation name="get">
        <input message="get"/>
        <output message="tns:getResponse"/>
    </operation>
</portType>

to

<portType name="EasyPort">
    <operation name="putDkm">
        <input message="tns:putDkm"/>
        <output message="tns:putDkmResponse"/>
    </operation>
    <operation name="get">
        <input message="tns:get"/>
        <output message="tns:getResponse"/>
    </operation>
</portType>

(See the namespace) After that the build was successful, however no client code had been generated. I'm not going to fix everything, but may I suggest you to firstly create a service prototype with the same interface, generate its WSDL and compare the result with what you have at the moment.

like image 136
JustAndrei Avatar answered Sep 24 '26 04:09

JustAndrei