这是this question的后续行动。如何让WCF与此Web服务交谈?
如建议by @Benjamin here,我想为我的wsdl现在添加一个服务引用(而不是web引用)。这里是URL到WSDL问题:
的问题是,Visual Studio生成一个空的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 {
}
当我尝试使用手动生成的代码svcutil,我得到以下内容:
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.
May这是否也与尝试通过添加Web引用而不是服务引用来使用服务时出现问题有关(请参阅我的other question)?
我想那个wsdl有问题,但我找不到究竟是什么。
由于这是已被其他人使用的第三方服务,我不认为他们会愿意更改他们的服务,那么是否有任何解决方法让.NET与该Web服务通信?
奇特。 http://soapclient.com/soaptest.html在该WSDL上表现完美。我的猜测是某处某处反对标记? –
2009-12-23 20:12:30
如果你仔细观察(查看源代码),带有额外空间的消息显示空间。 – smaclell 2009-12-23 20:25:08