3

I'm looking into generating a web-service conforming to the WSDL found at:

http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl

When I run with svcutil.exe like this:

svcutil.exe /language:C# /out:GamigoServices.cs http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl

I get these errors:

Error: Cannot import wsdl:binding
Detail: The given key was not present in the dictionary.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:binding[@name='DefaultAccountServiceServiceSoapBindi
ng']


Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is depend
ent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:binding[@name='DefaultAccountServiceServiceSoapBindi
ng']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://connection.ga
mes.gamigo.com/v_1_0']/wsdl:service[@name='AccountService']/wsdl:port[@name='Acc
ountServicePort']

I also tried a tool, Wscf:Blue, which gives me the same errors (it's a WCF VS plugin which, supposably, would do yet a lot more for me once I get past this step).

On the other hand, if I use wsdl.exe (which I don't want because I want to use WCF, and, as far as I understand, I need to use svcutil.exe for WCF, but I just tried wsdl.exe in my attempts to narrow down the source of the problems) like this:

wsdl.exe  http://assets.cdn.gamigo.com/xml/connection-service/1.0.10/account.wsdl /serverInterface

there are no errors.

I've been trying all kinds of things with local copies of the WSDL (and the types.xsd which it references), commenting out sections etc. to narrow down the problem. However, it really boils down to exactly what the error message is referring to, the definition of that binding. I've also googled, but the few references to this kind of error are not helpful at all. Besides, I'm particularly puzzled by the fact that wsdl.exe seems perfectly fine with that WSDL. I also used http://xmethods.net/ve2/WSDLAnalyzer.po# to validate the WSDL, no errors were shown.

So, now I'm at the point where I really got no idea how to proceed. As the whole issue is somewhat time-critical - by next week I should really start with implementation -, I might end up using the code generated by wsdl.exe and going for the older technology obsoleted by MS, but for several (obvious) reasons I'd rather not go that route. So if anyone has any idea what to do to make svcutil.exe work with that, I'd be grateful. I might add that while I cannot modify the definition, I might be able to convince the publisher of that WSDL to perform certain edits or at least publish a second version for my purposes.

Many thanks,

Max

Vienna,

Austria

max
  • 123
  • 7

2 Answers2

2

step1. Stare at your WSDL file

step2. ensure that the wsdl:portType "aligns with" wsdl:binding (i.e. all operations are defined in a corresponding way under portType and binding).

step3. Thank me for the best advice ever when dealing with svcUtil errors such as "the given key was not present in the dictionary" :-)

joedotnot
  • 4,810
  • 8
  • 59
  • 91
  • Still useful 2 years later ! under wsdl:portType my Operation had 3 parameters input, output, fault. But under wsdl:binding same Operation only had 2 parameters input and output, specifically fault was missing. Soon as i added a fault element, the error "Cannot import wsdl:binding Detail: The given key was not present in the dictionary." was gone ! – joedotnot Oct 08 '19 at 09:35
-2

Svcutil.exe is used for the WCF service. If its a web service wsdl.exe will work fine. I think you are using the svcutil.exe for the web service so it is giving error.

dhinesh
  • 4,676
  • 2
  • 26
  • 44
  • I'm following the ideas and instructions in http://blogs.msdn.com/dotnetinterop/archive/2008/09/24/wsdl-first-development-with-wcf.aspx – max Sep 22 '11 at 13:38
  • MSDN quite clearly states that for such purposes I am to turn to WCF these days: http://msdn.microsoft.com/en-US/library/a1tx28sw(v=VS.100).aspx – max Sep 22 '11 at 13:39
  • @max: wsdl.exe can be used for both wcf and web services, however svcutil.exe can only be used for wcf services. – dhinesh Sep 22 '11 at 13:41
  • @max: If you want any way want to have the wcf service. Create the proxy of the service using the wsdl.exe and then build a wcf service using the proxy interface. i.e create a wrapper around the web service and then use it. – dhinesh Sep 22 '11 at 13:43
  • What I need to do is to implement said WSDL specification as a webservice and expose it over http, but not host it inside IIS. So, do you have any pointers how I would go about taking the code generated by wsdl.exe and expose it via WCF? @dhinesh – max Sep 30 '11 at 11:24
  • Get the code generated from wsdl.exe, then create a wcf service and create same number of methods and in the implementation of the methods call the methods from the cs generated in the wsdl. i.e create wcf and call the webservice from inside the wcf – dhinesh Oct 03 '11 at 13:26
  • but I am supposed to develop a webservice conforming to the WSDL provided - so the code generated by wsdl.exe is just an interface, not a proxy. – max Oct 03 '11 at 15:24
  • @max: then inherit that interface into the service and make a wcf service. – dhinesh Oct 05 '11 at 09:11