This project is read-only.

Changing the targetNamespace of generated wsdl

Mar 30, 2010 at 6:05 PM

I downloaded the WSCF.blue v1.0.7 and tried creating a WCF service using a contract first approach. I was able to build the code and publish it to IIS and the generated wsdl looked good. The only thing that I thought was not correct is in the generated wsdl the targetnamespace is "http://tempuri.org". The wsdl from which I started is imported in this wsdl and has the correct namespace. Here is snapshot of generated wsdl:

<wsdl:definitions name="MemberServices" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:i0="http://MemberServicesLibrary/MemberServices" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<wsdl:import namespace="http://MemberServicesLibrary/MemberServices" location="http://ord-w-ihmfe103.corp.trizetto.com/MemberServicesFacets/MemberServices.svc?wsdl=wsdl0"/>
<wsdl:types/>
<wsdl:binding name="CustomBinding_IMemberServices" type="i0:IMemberServices">

Is there a way to set the targetNamespace to something other than http://tempuri.org?

Apr 14, 2010 at 3:18 PM

When building the WSDL using the wizard if you provide a namespace on the first wizard page this will be used as the targetNamespace in your WSDL.

Then when generating your service code the Namespace property of the ServiceContractAttribute on the service interface will also be given that namespace. That should cause the correct targetNamespace to be provided in the WSDL that is automatically generated by WCF.

Cheers,

Alex.