I am showing a WCF service in SharePoint 2010 using the Service Factory class and cannot completely get rid of the tempuri.org namespace in the generated WSDL.
That's what I'm doing:
Svc file in ISAPI folder
<%@ServiceHost
Language="C#"
Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressBasicHttpBindingServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
Service="MyService, [...]"
%>
Service agreement
using System.ServiceModel;
namespace MyService
{
[ServiceContract(Namespace="http://myname.com")]
interface IMyService
{
[OperationContract]
string GetSomeDefinition();
}
}
Service implementation
using System;
using System.ServiceModel;
using System.ServiceModel.Activation;
using Microsoft.SharePoint.Client.Services;
namespace MyService
{
[ServiceBehavior(Namespace = "http://myname.com")]
[BasicHttpBindingServiceMetadataExchangeEndpointAttribute]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
class MyService : IMyService
{
public string GetSomeDefinition()
{
return result;
}
}
}
Wsdl
<wsdl:definitions name="MyService" targetNamespace="http://myname.com" [...]>
<wsdl:import namespace="http://tempuri.org/" location="http://localhost/_vti_bin/myservice.svc/mex?wsdl=wsdl0" />
[...]
</wsdl:definitions>
, WSDL . http://myname.com http://tempuri.org. , bindingNamespace . Factory, . web.config : http://localhost/...
Web.config
<system.serviceModel>
<services>
<service name="MyService.MyService">
<endpoint address="http://localhost/_vti_bin/myservice.svc" binding="basicHttpBinding" contract="MyService.IMyService" bindingNamespace="http://myname.com" />
</service>
</services>
</system.serviceModel>
2010-10-07 :
MultipleBaseAddressBasicHttpBindingServiceHostFactory ServiceHost. , .