views:

321

answers:

2

This is a follow up of this question.

As suggested by @Benjamin here, I am trying to add a service reference for my wsdl now (in stead of a web reference). Here is the url to the wsdl in question:

https://eu.link.fiatauto.com/tsi/DDUWsAut.php?wsdl

The problem is that Visual Studio generates an empty codefile:

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3603
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace test.ServiceReference1 {

}

When I try to manually generate the code using svcutil, I get the following:

C:\temp>svcutil https://eu.link.fiatauto.com/tsi/DDUWsAut.php?wsdl
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'https://eu.link.fiatauto.com/tsi/DDUWsAut.
php?wsdl' using WS-Metadata Exchange or DISCO.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.Se
rviceModel.Description.XmlSerializerMessageContractImporter
Error: The ' ' character, hexadecimal value 0x20, cannot be included in a name.
Parameter name: name
XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:ddu']/wsdl:portT
ype[@name='dduPortType']


Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is de
pendent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='urn:ddu']/wsdl:port
Type[@name='dduPortType']
XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:ddu']/wsdl:bindi
ng[@name='dduBinding']


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='urn:ddu']/wsdl:bindi
ng[@name='dduBinding']
XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:ddu']/wsdl:servi
ce[@name='ddu']/wsdl:port[@name='dduPort']


Generating files...
Warning: No code was generated.
If you were trying to generate a client, this could be because the metadata docu
ments did not contain any valid contracts or services
or because all contracts/services were discovered to exist in /reference assembl
ies. Verify that you passed all the metadata documents to the tool.

Warning: If you would like to generate data contracts from schemas make sure to
use the /dataContractOnly option.

Maybe this has also something to do with the fact that there are problems when trying to use the service by adding a web reference in stead of a service reference (see my other question)?

I guess there's something wrong with that wsdl, but I can't find what exactly.

As this is a third party service which is already used by others, I don't think they will be willing to change their service, so are there any workarounds to let .NET talk to that web service?

+3  A: 

There's a bug in the WSDL. The final part in the dduAbortRequest message has a space at the end of the name. That's probably just a bug. Tell them about it, and they'll fix it, and they'll thank you for telling them.

The WSDL is just plain invalid as-is.

<message name="dduAbortRequest">
    <part name="Ticket" type="xsd:string"/>
    <part name="ServiceId" type="xsd:string"/>
    <part name="LoginId" type="xsd:string"/>
    <part name="DocId " type="xsd:string"/> <!-- Should be "DocId" -->
</message>
John Saunders
Damn, I have really been looking for something like that in the file, but couldn't find it, thanks!
fretje
Also an issue for the message 'dduRollbackRequest'. If you open up the endpoint directly with IE you will not see this issue.
smaclell
Yes indeed, I saved the file and removed the spaces, and now svcutil generates the code fine. I'll have to check tomorrow at work if this will solve the other problem (the dduLogin method ==> http://stackoverflow.com/questions/1953132/whats-the-problem-with-this-web-service-method). I'll keep you posted ;-)
fretje
I got it to work, after I implemented my own Custom TextMessageEncoder (apparently the encoding of the service was ISO-8859-1). Still interested though in a solution to my other question (http://stackoverflow.com/questions/1953132/whats-the-problem-with-this-web-service-method).
fretje
A: 

Disclaimer: This is probably not a direct answer to your question BUT I just wasted 3 hours trying to fix this same error message - so I want to post this here too.


This Warning: No code was generated error message can also be triggered by lack of permissions to the app pool user on the C:\Windows\Temp directory (yes really!).

If you're getting this error I first suggest you switch to the command line if you're trying to use the 'Add Service Reference' dialog. Run this command with Fiddler open for your service URL.

 svcutil.exe https://dev.example.com/ShoppingCartWS/WCF/ShoppingCartWCF.svc?wsdl

If you see any of the requests come back as 500 (in red) and the following response:

ReadResponse() failed: The server did not return a response for this request.                                                                            

Then check C:\Windows\Temp and just add whatever user your app pool is running at to have permissions.

This is where I found the solution - many thanks!.

Simon_Weaver