1

Background:

I've recently added internal authentication of user requests to a web service with a custom FaultException being thrown in the event of a failed authentication.

The FaultException custom type has been marked up:

[DataContract(Namespace = ConstantConfig.ServiceNamespace, Name = "AuthenticationError")]
public class AuthenticationError

The Service Interface methods have been marked up:

[OperationContract]
[FaultContract(typeof(AuthenticationError), Namespace = ConstantConfig.ServiceNamespace)]
ClientReport GetClientReport(DateTime from, DateTime to);

The interface itself has been marked up:

[ServiceContract(Namespace = ConstantConfig.ServiceNamespace)]
public interface IClientReportService

The implementation of the interface has been marked up:

[ServiceBehavior(Namespace = ConstantConfig.ServiceNamespace)]
public class ClientReportService : IClientReportService

The web.config and the app.config are all pointing at the copy/pasted service namespace.

And yet, despite all of this, I am still getting a tempuri.wsdl getting generated. Here is a reprsentative excerpt from the wsdl:

Main:

<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://webservice.company.com/ClientReportService" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:i0="http://tempuri.org/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ClientReportService" targetNamespace="http://webservice.company.com/ClientReportService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:import namespace="http://tempuri.org/" location="http://localhost:4319/ClientReportService.svc?wsdl=wsdl0" />
<wsdl:types>
<xsd:schema targetNamespace="http://webservice.company.com/ClientReportService/Imports">
    <xsd:import schemaLocation="http://localhost:4319/ClientReportService.svc?xsd=xsd0" namespace="http://webservice.company.com/ClientReportService" />
    <xsd:import schemaLocation="http://localhost:4319/ClientReportService.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
</xsd:schema>
</wsdl:types>

Tempuri:

<wsdl:operation name="GetClientReport">
  <soap:operation soapAction="http://webservice.company.com/ClientReportService/IClientReportService/GetClientReport" style="document" />
  <wsdl:input>
    <soap:body use="literal" />
  </wsdl:input>
  <wsdl:output>
    <soap:body use="literal" />
  </wsdl:output>
  <wsdl:fault name="AuthenticationErrorFault">
    <soap:fault use="literal" name="AuthenticationErrorFault" namespace="" />
  </wsdl:fault>
</wsdl:operation>

I'm guessing there is something that I have not marked up or marked up incorrectly, but am at a loss to find it.

Any suggestions?

1
  • I am currently thinking that because the namespace on this element is empty: <wsdl:fault name="AuthenticationErrorFault"> <soap:fault use="literal" name="AuthenticationErrorFault" namespace="" /> </wsdl:fault> when the WSDL is autogenerated, the whole block is being placed into tempuri. Anyone know how to make sure that the namespace is populated?
    – Mohammed
    Feb 26, 2013 at 10:31

2 Answers 2

3

try this

<endpoint address=""
                          binding="basicHttpBinding"
                          bindingNamespace="http://my.namespace.com"
                          contract=""/>
            </service>
1
  • Thank you for the response, but I'm assuming by endpoint you are meaning this: <endpoint name="BasicEndpoint" address="" binding="basicHttpBinding" bindingConfiguration="BasicBinding" contract="company.client.ClientReportService.IClientReportService" bindingNamespace="webservice.company.com/ClientReportService"> We already have this marked up. Unless i need a blank endpoint?
    – Mohammed
    Feb 25, 2013 at 17:05
3

As it turns out the error was entirely mine.

In the web config the service name did not match the service name on the actual service.

Actual service (inside the markup for the .svc file):

Service="Company.Client.Framework.ReportService.ClientReportService"

Broken Web Config

<service name="Company.Client.ReportService.ReportService">

Corrected Web Config:

<service name="Company.Client.ReportService.ClientReportService">

After I corrected this and regenerated the WSDL, tempuri vanished.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.