+15 votes
by (100 points)

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>

6 Answers

+10 votes
by (100 points)

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.

+9 votes
by (100 points)

Don't know if you have fixed the issue already:(

I gave a try with svcutil.exe to generate proxy class for the service. Proxy was not generated but gave some errors. Attached is the errors I got on the console. enter image description here cent percent I believe, it is problem with the service because a similar question was found in another post that was fixed by modifying the service. Review your code in the service, you will certainly be able to fix this issue.

Add Service Reference error “Cannot import wsdl:portType

+6 votes
by (100 points)

I had the same issue sometime back in my project, apparently the issue was that the folder where the reference files were generated was read only and the hence the files were not overwritten , try removing the read only folder attribute for that folder and the entire project and then reopen the solution.It should successfully generate now.

+1 vote
by (100 points)

There is an explanation of the new browser string for IE11 here:

http://blogs.msdn.com/b/ieinternals/archive/2013/09/21/internet-explorer-11-user-agent-string-ua-string-sniffing-compatibility-with-gecko-webkit.aspx

This will help you decide what to put into your expression to detect IE11.

0 votes
by (100 points)

containerView?.setNeedsLayout() needs to be called after whatever I change.

0 votes
by (100 points)

I think this is what you're looking for:

for (let i = 0; i < data.numChanges; i++) { 
  console.log("Try number #" + i);
  this.enemy.image = 'images/items/glasses/glasses.png';
  // Wait 2 seconds, and show this image:
  setTimeout(() => this.enemy.image = oldImage, 2000);
  setTimeout(() => ...some code, 1000)
}

Basically, you wrap your code in setTimeout(() => ..some code, 2000) . The 2000 is the time to wait in ms therefore 2000ms == 2s.

...