How can I do WCF for this web service?

This is a continuation of this issue .

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

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

The problem is that Visual Studio generates an empty code file:

//------------------------------------------------------------------------------ // <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 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.

Perhaps this is also due to the fact that when trying to use the service there are problems when adding a web link instead of a link to the service (see my other question )?

I assume that something is wrong with this wsdl, but I can not find what exactly.

Since this is a third-party service that is already being used by other users, I don’t think they will want to change their service, so are there any workarounds that allow .NET to communicate with this web service?

+4
source share
2 answers

There is an error in WSDL. The final part of the dduAbortRequest message has a space at the end of the name. This is probably just a mistake. Tell them about it, and they will fix it, and they will thank you for telling them.

WSDL is simply not valid 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> 
+3
source

Disclaimer: this is probably not a direct answer to your question, but I just spent 3 hours fixing the same error message - so I want to post it here too.


This Warning: No code was generated error message may also be caused by a lack of permissions for the application pool user in the C:\Windows\Temp directory (yes indeed!).

If you get this error, I first suggest that you go to the command line if you are trying to use the "Add Service Link" dialog. Run this command with the open Fiddler file for your service URL.

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

If you see that any of the queries returns as 500 (in red) and the following response:

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

Then check the box C:\Windows\Temp and just add the user for which your application pool is running to have permissions.

That's where I found the solution - thank you very much! .

0
source

All Articles