我加入來自第三方的WSDL在Visual Studio中的服務引用,但它不是創建代理類,只是一個空的空間文件:服務引用生成空命名空間
的WSDL地址是http://wwwh.cnj.jus.br/sgt/sgt_ws.php?wsdl
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18052
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace MyApp.MyServiceReference {
}
我該如何解決?
UPDATE:
我跑的命令
SvcUtil.exe /t:code "http://wwwh.cnj.jus.br/sgt/sgt_ws.php?wsdl" /d:D:\test
,得到了以下錯誤:
Error: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter Error: Referenced type ' http://schemas.xmlsoap.org/soap/encoding/:Array ' is only valid for encoded SOAP. XPath to Error Source: //wsdl:definitions[@targetNamespace=' http://wwwh.cnj.jus.br/sgt/sgt_ws.php ']/wsdl:portType[@name='sgt_ws_methodsPort']
Error: Cannot import wsdl:binding Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace=' http://wwwh.cnj.jus.br/sgt/sgt_ws.php ']/wsdl:portType[@name='sgt_ws_methodsPort'] XPath to Error Source: //wsdl:definitions[@targetNamespace=' http://wwwh.cnj.jus.br/sgt/sgt_ws.php ']/wsdl:binding[@name='sgt_ws_methodsBinding']
Error: Cannot import wsdl:port Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace=' http://wwwh.cnj.jus.br/sgt/sgt_ws.php ']/wsdl:binding[@name='sgt_ws_methodsBinding'] XPath to Error Source: //wsdl:definitions[@targetNamespace=' http://wwwh.cnj.jus.br/sgt/sgt_ws.php ']/wsdl:service[@name='sgt_ws_methodsService']/wsdl:port[@name='sgt_ws_methodsPort']
Warning: No code was generated. If you were trying to generate a client, this could be because the metadata documents did not contain any valid contracts or services or because all contracts/services were discovered to exist in /reference assemblies. 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.
可能重複http://stackoverflow.com/questions/1408509/sometimes-adding-a-wcf-service-reference-generates-an-empty-reference-cs –