Reputation: 6442
I'm adding a Service Reference in Visual Studio from a third party WSDL, but it's not creating the proxy classes, just a file with an empty namespace:
The WSDL address is 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 {
}
How can I fix it?
UPDATE:
I ran the command
SvcUtil.exe /t:code "http://wwwh.cnj.jus.br/sgt/sgt_ws.php?wsdl" /d:D:\test
and got the following errors:
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.
Upvotes: 0
Views: 2351
Reputation: 6442
It worked when I added a Web Reference
instead of a Service Reference
.
Upvotes: 1