I'm looking for an example in C# how to programmatically create WSDL file based on XSD files where WSDL file contains 1 main XSD file, which contains several import directives to subsequent XSD files. After that WCF service should be invoked based on created WSDL file. The service contract is known.
I've spent a lot of time on internet trying to find something but no luck so far.
There is a program that comes with .net sdk called wsdl.exe You could invoke this program using the methods of the Process class.
See this:
http://msdn.microsoft.com/es-es/library/e8zac0ca.aspx
And this:
http://msdn.microsoft.com/en-us/library/7h3ystb6(v=vs.100).aspx
Related
I set custom configuration in APP.config.
When I convert the application to DLL and use in within another application, the dll in not running because it can not access to my custom config. Instead it tries to search in new application APP.config.
You cannot access the app.config (or the actualy properly named assemblyname.exe.config/assemblyname.dll.config) from a DLL. A DLL does not read a configuration file and thus doesn't provide the respective mechanisms.
The only way to use the .NET configuation mechanisms from a DLL is to copy the relevant configuration sections to the executing application's configuation file.
The application will then read the configuration and the DLL will be provided with the current values. I've done this several times successfully.
I'm trying to build a core with the routing service technology (in wcf .net) that discover its clients automatically with DiscoveryService and then write them into the config file with specific filters so that the core will be able to route messages between the clients.
I succeeded to discover the clients with DiscoveryService, but i'm trying to open new config file with the RoutingConfiguration object, and add the new endpoints I discovered through the RoutingConfiguration.filterTable property but it doesn't work. I also tried to look for examples in other sites but i didn't find anything similar.
I don't know if i'm making a mistake, or if I didn't understand well how to open new configuration file and edit it at runtime programatically.
I have wcf client. It uses .NET 3.5.
When I compile the client I get two files:
client.exe and
client.exe.config.
The second file contains configuration for the wcf client.
In my case I need to prevent the user sitting on the computer to see the urls and change some other parameters from the config file.
So the requirements are, the end user not to see and modify the data stored in the config. The config file contains the same data as app.config. I need to forbid the person using the program to see the end point urls so easy.
Also I have a lot of configuration there so I do not like to code in the moment.
Is there any solution for the problem (embedded app.config of something else)?
Edit: I do not need configurable options. The config file is automatically created when adding service reference from the studio.
Regards
You can also create your proxies programatically instead of using the service reference feature.
Every parameter in the serviceModel config section can be represented in code as well.
The ChannelFactory class will help you create proxies to the service.
You can easily encrypt entire parts of your config files - and not just web.config in web scenarios, but also application config's in stand-alone apps.
Check out some resources on how to do this:
Encrypting web.config values
Encrypting passwords in .NET app.config file
Encrypting the app.config file for Winforms application
Is it possible to make a WCF reference in a Silverlight DLL private? The option is greyed out and when you edit the Reference.vb file manaully, when running, it complains about not being able to serialize because it is not public.
I don't want the service to be exposed outside of the DLL. Is this possible?
Even though it is generated, you can hack that file up as much as you like, within reason.
What you need to do is declare your generated proxy as internal. You can either do that manually, or you can use the /internal (short form is /i) flag when using svcutil to generate your proxy. (Note that VS doesn't use svcutil when you add a service reference).
thanks for any assistance.
I'm creating a wcf web service for an external client.
The client is requesting a copy of the wsdl.
I currently am waiting on being able to provide the client with access to the service.
when I go to my local webserver running the service (http://localhost/Services.svc?wsdl) I am shown
the wsdl, the data provided contains the method signatures (from the .svc code behind),
but does not contain the included model objects (Customer, Order, ext).
To get those objects, I can find the references in the shown data and go to the url
For me to provide all needed information to the client, so that they have the entire wsdl
should I provide the main schema and also each of the imported schemas?
or is there any other way of accomplishing this (other then the client hitting a server)
ie: is there a way of packaging all of them within one file?
(Seems like something would be available to extract each of those files?)
If I were to give a .zip with each of the files, would that be enough?
Thanks,
Steven
WCF packages up its WSDL and XSD (XML schema to describe the data being sent around) into various pieces, as you've already noticed. Those are referenced from your main WSDL with additional href's.
Or even better: you can run the "svcutil -metadata" command on the command line against the DLL or EXE which contains your service implementation - this will create all the needed files (typically several WSDl and several XSD) in the directory where you run the svcutil command. That's usually a more reliable way than piecing together the WSDL and XSD files from the ?wsdl URL (you usually end up missing one or two files).
Marc
If you manually downloaded each and every sub-WSDL and XSD referenced, then yeah, it would work; but it's cumbersome, to say the least.
An option worth looking into would be to use Christian Weyer's WCF extensions for flattening your WSDL so that WCF generates everything in a single file, then giving that to your client.