I have the problem that my WSDL file generated from my WCF service still contains a tempuri value although I did what the various forums say:
1. Put a [ServiceContractAttribute] into the declaring interface
[ServiceContract(Namespace = "www.XXX/Wcf")]
public interface ICaseService
{
[OperationContract]
ServiceGetCaseResponse GetCaseData (ServiceGetCaseRequest request);
}
2. Put a [ServiceBehaviorAttribute] into the implementing class
[ServiceBehavior(Name="CaseService", Namespace="www.XXX/Wcf")]
public class CaseService : ICaseService
{
public ServiceGetResponse GetCaseData(ServiceGetCaseRequest request)
{
// do some stuff here...
}
}
3. Put a "bindingNamespace" attribute into the web.config
contract="HaWcfCoreServices.ICaseService"
bindingNamespace="www.XXX/Wcf"
bindingConfiguration="Binding_CaseService"
name="WCFEndPoint">
In my opinion all the facts for removing the tempuri should be given. There is no difference if I host with the Wcf-testhost or the IIS.
The WSDL-file:
-
-
........
http://127.0.0.1:9998/CaseService.svc?wsdl=wsdl0 in the browser tells me this:
.....
How can I get the tempuri.org removed?
Thank you for any idea!
Greetings,
Harry
Jerry OBrienPosted Jan 1, 2013, 11:51 AM
HarryPosted Feb 17, 2011, 5:17 PM
Now I think I have the solution:
In my implementing class I had to state this:
[ServiceBehavior(Name="CaseService", Namespace="www.XXX/Wcf/CaseService", ConfigurationName = "CaseService")]
public class CaseService : ICaseService
{
...
}
The name has to be the same as in the web.config:
contract="ICaseService"
bindingNamespace="www.XXX/Wcf/CaseService"
bindingConfiguration="Binding_CaseService"
name="WCFEndPoint">
the the tempuri is gone...???!!!
I hope this will still work tomorrow!
Thank you very much for your support!
Harry
Guest UserPosted Feb 17, 2011, 4:11 PM
namespace CSCorner1
{
///
/// Summary description for Service1
///
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
All I needed to do to remove the tempuri from the wsdl was change the WebService attribute.
HarryPosted Feb 17, 2011, 3:41 PM
Given following servies and classes:
[ServiceContract(Name="CaseService", Namespace = "www.XXX/Wcf/CaseService")]
public interface ICaseService
{
[OperationContract]
ServiceGetCaseResponse GetCaseData (ServiceGetCaseRequest request);
}
implementing class
[ServiceBehavior(Name="CaseService", Namespace="www.XXX/Wcf/CaseService")]
public class CaseService : ICaseService
{
public ServiceGetResponse GetCaseData(ServiceGetCaseRequest request)
{
// do some stuff here...
}
}
web.config
contract="HaWcfCoreServices.ICaseService"
bindingNamespace="www.XXX/Wcf/CaseService"
bindingConfiguration="Binding_CaseService"
name="WCFEndPoint">
Do I have to assign the same attribute values also to the request- and response-classes? e.g.
[DataContract(Name="CaseService", Namespace="www.XXX/Wcf/CaseService"]
public class ServiceGetCaseRequest : ServiceBaseRequest
{
...
}
[DataContract(Name="CaseService", Namespace="www.XXX/Wcf/CaseService"]
public class ServiceGetCaseResponse : ServiceBaseResponse
{
...
}
What's with the base classes (ServiceBaseResponse, ServiceBaseRequest)? Do they also have to have the [DataContract(Name=..., Namespace)] attribute?
I hardly can't remember a combination I did not try yet...do you have any idea more?
Thank you very much!
Harry
Guest UserPosted Feb 17, 2011, 2:14 PM
HarryPosted Feb 17, 2011, 1:42 PM
just tried it, but still the same result: tempuri.
Do I just to need to adjust the namespace in the class or also in the interface and/or web.config.
Think I alredy tried every possible combination :-(
What if the service returns a class (e.g. ServiceGetCasesResponse.cs): what about its [DataContract(Namespace=...)] value?
Kind regards,
Harry
Guest UserPosted Feb 17, 2011, 12:04 PM
[ServiceBehavior(Name="CaseService", Namespace="www.XXX/CaseService")]