ServiceStack WSDL does not include all types - asp.net-mvc-4

I created a web service within my MVC application. All contracts are using the same namespace. AssemblyInfo.cs also maps the ContractNameSpace with ClrNameSpace.
The generated WSDL does not define my contract types.
This is my second project with ServiceStack. However, the results are different.
Does contracts have to reside in a different assembly in order to ServiceStack to generate WSDL correctly?

The issue was fixed in the latest ServiceStack release: https://github.com/ServiceStack/ServiceStack/issues/306

Make sure you're not using a dodgy tool like WCFStorm. I was getting the same issue even with the current ServiceStack release. I switched to soapUI and everything works expected.

The Types in the WSDLs and XSDs are determined by the Request + Response DTO's used in your services, i.e. they need to be used by your services to be included.
Also be sure to read through the SOAP limitations to make sure there isn't anything you've missed.
If you still think it's an issue, submit an stand-alone project, via gist or pull-request that shows the issue.

Your question is identical to the issue I was having so I'll post my solution here:
I've downloaded the source code and done some investigation on my own. I'm not sure how recent this change is but it appears that in order for your DTO's and Response objects to be included in the wsdl you need to add a query string like "?includeAllTypes=true".
I'm also using the ServiceStack BasicAuthProvider setup which is causing AssignRoles and UnAssignRoles to be added to the Service automatically. The request and response objects for those calls are still failing to make it into the wsdl and causing "Add Service Reference" to fail. Fortunately we aren't making use of them so if I can find another configuration setting to remove them all should be working correctly.

Related

Difference between Elmah and Elmah.Contrib.WebApi

I am confused between Elmah and Elmah.Contrib.WebApi. And which one is best option for Web API. Iam already using Nlog for exception logging along with Tracing in Web API. So How Elmah is different from all of them. What is the exact need to going for Elmah??
Thanks in Advance
I find that it is useful for catching errors that you did not catch and log yourself. I am using it for a MVC application and it sends me an email when I have an issue that I need to resolve. I can be proactive and I am working on errors before I can hear from the user.
Elmah addresses your default application error logging. However when you're using Web API, for example ASP.NET MVC Web API, you need some extra logic to log your Web API errors within your Elmah data store.
There are a few ways to address this requirement, one being to use the Elmah.Contrib.WebApi package.
Once the package is imported to your project remember to follow any implementation requires, i.e. startup filter registry (as noted here)

wcf service calling an ASMX web service which returns IPropertyChangedEventHandler

Ok this is kind of a complicated situation so let me start by laying out what I'm trying to do.
I have a WCF web service that is using DataContractFormat to serialize requests as JSON. One of the clients of the web service generates a reference file using my wsdl and uses the soap endpoint on his end to make calls back and forth. Until now, this has been working great because we have had the ability to provide support for SOAP and also REST/JSON requests.
Our current project required us to include methods from RSA which exposes their webservice with a wsdl. So we are basically doing SOAP calls to them, and generating a reference file on our end and then using the classes and methods generated in our web service.
The problem we are getting is that the client is getting build errors in reference to not being able to serialize IPropertyChangedEventHandler which is included in all of RSA's classes. What I suspect is the problem is that RSA's classes are all defined using the System.Xml.Serialization methods and my web service is written to use the DataContractFormat instead of XMLSerializerFormat so it doesn't know how to serialize the classes. How do I get around this without completely rewriting the reference file using DataContract? Or is there possibly something else I might be overlooking?
Let me know if you need more details.
A coworker was able to figure out how to generate the RSA wsdl without the PropertyChangeEventHandler in the methods. We were able to get the reference file to generate without PropertyChanged by changing the svcmap file under the Service Reference folder
<EnableDataBinding>false</EnableDataBinding>
After changing this, we updated the service reference and all the PropertyChanged stuff was gone and we no longer got build errors.

WCF WSDL Page Missing

I have been following along with the Aaron Skonnard videos on creating a WCF service. I have completed the tutorial found here and when finished the WSDL page that would normally be available to a consumer of this service is not found (page states that "Endpoint is not found").
I have found many references to this issue including adding a 'mex' endpoint, adding httpGetEnabled, etc. but nothing seems to work. I believe this is because the tutorial removes the service files from the website code behind and instead uses a reference to another project.
I like the way the service is created with this tutorial but need to know how to get this WSDL page to display properly so others can consume my service. Is this no longer the correct way to create services in .NET 4?
I don't think REST based services (WebAPI) create a WSDL at all. I beleive the WSDL is only for the SOAP based WCF services.

WCF service exposed as ASMX won't accept parameters

I have a server/client application developed in Delphi 2006. The client is Win32 and the Server is a .net 1.1 webservice.
We are in the process of updateing this project, but it has to be done in small steps. I started with the server and created a WCF project in VS2010(C# .net 4.0). The first step is to get the server running in WCF without changing the client. So I used the facade pattern, created a similar interface to the old delphi Webservice added a reference to the old .net 1.1 dll and in my implementation I just called the old .net 1.1 code.
Next step updating the proxy class on the client. This failed. The WSDL importer didn't understand the basicHttpBinding correctly, so the proxy class that was genereated couldn't replace the existing proxy.
After a bit of research I found this blog post.
http://kjellsj.blogspot.com/2006/12/how-to-expose-wcf-service-also-as-asmx.html
This worked, the ASMX WSDL was no different than the old .net 1.1 so everything appered ok.
But it wasn't. When testing the new service I discovered that all my parameters was blank/null on the server. I tried with Fiddler on the client and the parameters is present in the XML that is sent to the server.
So I'm stuck. Any thoughts on how to solve this would be much appreciated. Is there any code that could be interresting to see then let me know.
I ran into a similar problem with a web service asmx... certain data was losing their values. If you are using hierarchical data, you may need to declare the internal or inherited objects using an XmlInclude attribute. For example, if you have a User class that is used in your service and a Customer sub class, you may need to declare the Customer class to the service if it is not used directly in a web method. You would do this as follows.
[XmlInclude(typeof(Customer))]
public class Service : WebService
Of course, it may be nothing to do with this, so good luck if that's the case. :)
Confirm that the parameter names in the new service match the names in the old service. If you have changed the parameter names, they will not map from the XML so will be null in the executing code.
Add KnownType attribute to the sub classes

How to setup spring.net dependency injection for a web service?

I have been handed a wsdl file + a number of xsd type definition files - the service I need to code against is not ready yet and I need to put together a fake service (so called a stub or mock) in order to be ready when the real thing comes along.
My question is - once I get the interface I need to implement from the wsdl, how do I setup dependency injection so that whenever the new service comes along I can add a service reference or a web reference and just edit the spring.net config file to swap in the service I want in the consumer? Is it even possible?
I found this article, specific to WCF, It's pretty good but he seems to have access to the service code and he's doing dependency injection on the service side rather than on the consumer side - in my case I will most likely just get a url, I will have to swap it with the fake local one and go from there.
Also is there a way of doing this only dependent on the way I consume the service but not on the way the service was put together? I mean, I shouldn't care less which technology was used to develop the service as long as I get a url to the wsdl.
Any pointers appreciated!
Just create an interface which maps to the webservice methods and use that on the client side. It doesn't matter if it's a local service, webservice, or whatever.
I've done what you are trying to do before, you can read about it here.