Scott Moniz
Scott Moniz

Reputation: 660

WCF Contract First - Creating a Service from a WSDL / Large Amount of XSDs

I am familiar with creating a WCF service bottom up (service first), however, I have been tasked with trying to create a WCF service from a set of WSDLs (Contract-First).

I have been given a folder named 'Schema' which contains a set of WSDLs and a bunch of subfolders containing XSD files (lots of nesting, lots of XSDs, some XSDs are named the same). Most of what I have seen suggests to put all the XSDs in the same folder - but I cannot do that.

When running the command svcutil *.wsdl *.xsd /language:c# /out:"c:\temp\test.cs" I receive the error "The input path '*.xsd' doesn't appear to refer to any existing files which I suppose makes sense as there are no .xsd in the Schema folder.

  1. Is this the correct command (should I be generating with /dataContract)?
  2. How can I generate when I have this complex structure of subfolders, nested xsds and am unable to put all the XSDs in 1 directory?

Update:

I gave up on using svcutil and used wscf.blue as a user had suggested. I am now running into an issue hosting the service. I created a WCF Service Library named eFileServiceLibrary.

Service Class:

 public class Service1 : ICourtRecordMDEPort
    {

        public RecordFilingResponse RecordFiling(RecordFilingRequest request)
        {
            throw new NotImplementedException();
        }
}

Contract Class:

 [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace="urn:oasis:names:tc:legalxml-courtfiling:wsdl:WebServicesProfile-Definitions-4.0", ConfigurationName="ICourtRecordMDEPort")]
    public interface ICourtRecordMDEPort
    {
              ....

App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <services>
      <service name="eFileServiceLibrary.ICourtRecordMDEPort">
        <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8733/Design_Time_Addresses/eFileServiceLibrary/ICourtRecordMDEPort/" />
          </baseAddresses>
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint address="" binding="basicHttpBinding" contract="eFileServiceLibrary.ICourtRecordMDEPort">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <!-- Metadata Endpoints -->
        <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
        <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>

When F5ing the Service Library I receive: WCF Service Host cannot find any service metadata. This may cause the client application to run improperly. Please check if metadata is enabled. Do you want to exit?

It seems the mex endpoint is there and the behaviour has servicemetadata enabled. I have also tried to add a name attribute to my behavior and referencing that from the service tag's behaviourconfiguration attribute - still no luck.

Any insight is greatly appreciated

Upvotes: 1

Views: 1233

Answers (0)

Related Questions