I'm trying to build a web service using WCF. Since the service will ultimately be consumed by non-.net languages, I've been attempting to test it using "Add Web Reference" or using WSDL.exe instead of the svcutil way. I've been getting the following errors though:
From WSDL.exe - Error: Unable to import binding BasicHttpBinding_IEchoService from namespace http://tempuri.org. - - Unable to import operation Echo. - - The element http://tempuri.org/:Echo is missing.
From Add Service Reference and Add Web Reference: Metadata contains a reference that cannot be resolved: link to wsdl. The WSDL document contains links that could not be resolved. There was an error downloading http://localhost:8080/EchoService.svc?xsd=xsd0 The underlying connection was closed.
This simplified example has the same issue as the primary service.
Here's the service's Web.Config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="EchoBehaviorConfiguration">
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="EchoService">
<endpoint address=""
behaviorConfiguration="EchoBehaviorConfiguration"
binding="basicHttpBinding"
contract="IEchoService" />
<endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding" />
</service>
</services>
<bindings>
<basicHttpBinding>
</basicHttpBinding>
<mexHttpBinding></mexHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Here's the contract/interface:
[ServiceContract]
public interface IEchoService
{
[OperationContract]
string Echo(string message);
}
And here's the WSDL that is generated:
<wsdl:definitions name="EchoService" targetNamespace="http://tempuri.org/">
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="http://localhost:8080/EchoService.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="http://localhost:8080/EchoService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="IEchoService_Echo_InputMessage">
<wsdl:part name="parameters" element="tns:Echo"/>
</wsdl:message>
<wsdl:message name="IEchoService_Echo_OutputMessage">
<wsdl:part name="parameters" element="tns:EchoResponse"/>
</wsdl:message>
<wsdl:portType name="IEchoService">
<wsdl:operation name="Echo">
<wsdl:input wsaw:Action="http://tempuri.org/IEchoService/Echo" message="tns:IEchoService_Echo_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/IEchoService/EchoResponse" message="tns:IEchoService_Echo_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IEchoService" type="tns:IEchoService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Echo">
<soap:operation soapAction="http://tempuri.org/IEchoService/Echo" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="EchoService">
<wsdl:port name="BasicHttpBinding_IEchoService" binding="tns:BasicHttpBinding_IEchoService">
<soap:address location="http://localhost:8080/EchoService.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The service is currently hosted locally via IIS7. I have attempted both HTTP and HTTPS and have the same issue. If I try to chang the binding from basicHttpBinding to webHttpBinding, nothing changes in the WSDL.
Any ideas on where I'm going wrong?
UPDATE: I have the configuration now setup that if the service is running under Cassini instead of IIS, I can add service or web references to my test project. I cannot save the wsdl and use WSDL.exe to generate the proxy classes though.
So now I have 3 issues:
Other than doing an aspnet_regiis to install and register WCF 4 with IIS, is there anything else I may have to do?
Any idea what I need to do in order to get it working with WSDL.exe?
After doing an ASMX service and comparing the WSDLs generated, they are dramatically different which makes me question how compatible WCF is at this point with non-.net languages.