1

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

Scott Moniz
  • 650
  • 11
  • 20
  • I do WSDL top down with all of my structures in XSD. Using the MS standard tooling was like shooting myself in the foot. Try using WCF.Blue found here https://wscfblue.codeplex.com/ it is much more flexible. Also check the XSD schema includes in the WSDL itself. – Namphibian Oct 17 '17 at 22:10
  • I have seen a few of these - and yes, the MS tooling seems to be giving me such a pain. I have had some success by using WSDL and then adding the [ServiceContract] and [OperationContract] tags myself - but man, the hours ive spent so far is unfortunate. Looking into wscfblue now – Scott Moniz Oct 17 '17 at 22:20
  • Ok so I have the addin installed and I created a webservice application. When generating I chose to 'Generate .svc' and my Service Method Implementation is to 'Generate a partial service class with calls to partial methods that must be implemented in another file'. Could you direct me on next steps? Your help is very appreciated. – Scott Moniz Oct 17 '17 at 23:36
  • What I did was create a WCF Service Library and use wscf to generate into that library. I am now working on trying to host. Thanks for the wscf blue recommendation – Scott Moniz Oct 18 '17 at 01:02
  • Hey was about to reply. Sounds good so let us know if you have a problem. – Namphibian Oct 18 '17 at 01:03
  • I am running into a new issue on trying to host - will Update my post – Scott Moniz Oct 18 '17 at 01:05
  • Hi Nam - I Updated the post. I really appreciate your help with this one - it's been a challenge thats for sure especially going bottom up to Contract First. Thanks so much for your insight so far. – Scott Moniz Oct 18 '17 at 01:12
  • See this link: https://stackoverflow.com/questions/7687890/wcf-service-host-cannot-find-any-service-metadata Will try check a bit later on the train at the moment and we are loosing cell phone signal regulalry between mountains. – Namphibian Oct 18 '17 at 01:31
  • I took a look but still no luck unfortunately. Do you see anything off in my config or anywhere else for that matter? I feel I am slowly making progress thanks to you - just a few more roadbumps :) – Scott Moniz Oct 18 '17 at 16:47
  • Scott can you provide details on how you are going to host this. My .Net skills are a bit rusty at the moment been on Java for about 2 years non stop now. The .Net service has been running 5 years with no code changes in the last two. – Namphibian Oct 18 '17 at 22:55
  • It will be IIS hosted. Generally I would just create a WCF Service Application but I have had to go the route of WCF Service Library (for the code) and WCF Service Application for the hosting shell. Running the WCF library with a sample project works easily - however, running the wcf library with the above config does not. As always - appreciate your input. – Scott Moniz Oct 19 '17 at 13:25

0 Answers0