I am having problems gaining access to a clients web service online.
If I have the wsdl file, can I do "something" in VS2010 with it so I can add it as a reference and start my C# coding?
Thanks Paul
When you go to "Add Service Reference", the textbox that allows you to enter a URL, can also take a path on your local filesystem to a wsdl.
Additionally, while not the optimal route, you can also use the wsdl.exe/svcutil.exe utility (bundled with VS) to generate a proxy class. Adding a reference is the better way to go, but this is an additional option.
Adding the Service Reference as a local path worked for me like a charm. I would have voted +1 for xelco52, but my rep is too low...
Only 1 issue; one of my members of the class I've added does not work. I wonder if I need to use the sledgehammer...?
If you have the WSDL file, under one of your projects in VS, right-click the References project folder and choose Add Service Reference. Click the Advanced button, and in the new dialog click Add Web Reference. Now, go find the WSDL file, either where you saved it or where you downloaded it, enter its location in the textbox, and click Go. VS will digest the WSDL and produce a class that is the service client, and others as necessary to implement custom types accepted by the service.
It's usually a good idea, if you have downloaded the WSDL, to include it as an item in the project that has the web reference; that allows it to be easily traversed as a reference source, and to be located should you need to recreate the web service classes.
Related
Working on a system and need to update a WCF service. The issue I am having is that the service file is a .map file. Using Visual Studio I would have assumed that I could just right click it from solution explorer and update the service from there, but there is no such option.
The .map file itself is an xml containing the Service endpoints and what not. It is also grouped with (could be a plugin "VScommands" that did this grouping) a .cs file of the same name containing the auto-generated code to use the service.
I'm unsure what other information I should provide but if someone could point me in the right direction it would be much appreciated.
So to get around this issue I had to manually enter in the inforamtion I needed. Did this by using the svcutil.exe tool provided by microsoft.
Real late update, decided to just remove the entire service reference and re-add it.
I created a WCF service (the regular templete one) and tried to access the service. after that everything was fine. after i renamed (using refactoring the name of IService and Service) OSDataService and IOSDataService i got the following error while accessing the srv file :
how can i rename it without getting this error?
i tried also changing it in the web.config file and still the same problem.
Anybody had this problem?
You have to view the markup of the service file and change this in the directive to be the new name because it doesn't change automatically
Right click on the service name, then chose "view markup" and then change the "Class" attribute to be the new name.
Do you have a .svc-file? Have you updated the markup in that file if you have one?
Do a search in the whole solution after the old service name and you will moste likely find the file that need to be updated.
Well solved it:
you need first to rename the Iservice on the solution explorer, then refactor the service and refactor again all the data (VS2010 will tell you what to do) only then rename the service name (on the solution explorer)
You must update the reference in the client. Or update the stubs manually, but I wouldn't recommend that.
I have changed my app name and namespaces as well from FooXXX to FooYYY.
VS applied changes to all files. I've checked all namespaces, names etc, project compiles but when I want to deploy it to emulator or to a device it crashes straight away. No warring, no message, no exception. Only spash screen is shown and then OS gets back to start screen.
I made a copy of this solution and I've changed all names, namspaces again and now app compiles and deploys, but I have two messages:
Message 2 Could not find schema information for the element 'http://schemas.microsoft.com/client/2007/deployment:Deployment.Parts'.
Message 1 Could not find schema information for the element 'http://schemas.microsoft.com/client/2007/deployment:Deployment'.
Any clue what casuses the crash?
Check the "Startup Object" in the project properties page. The sometimes requires manually being set/corrected when the namespace of the app is changed.
I had the same problem but it was due to the WCF RIA Services link.
In the project properties change the WCF RIA Services link to
Save and close the tab
Change to the previous link
Save
I got a problem like this and it was a problem inside WMAppManifest.xml file under Properties. Look at the TokenId, default page etc...
To resolve this, I actually just restarted VS2012.
Application is a C# .Net 3.5 WCF Service.
I'd like during the build process to dynamically add some build information to the final binary and assemblies that can then be read programatically and sent back to the WCF client when it sends a GetVersionInfo request to the web service.
.Net assembly versioning isn't enough. I want to include additional string data that contains the state of the system at the time the application was built.
I'm thinking that I'd do this by adding a post build event to call a script to update the app.config file with the data I want. Does this sound about right, or should I be considering some other approach?
Update
I'd additionally like this string to appear in the "Special Build Description" property of the final exe. I.e. I'd like to right click on the file and see this information in the version tab for the file.
Thanks in advance.
I suspect a pre-build event may be more appropriate than post-build... have you considered adding a buildinfo.xml file (or similar) to be built into the assembly as an embedded resource? You could then load it with Assembly.GetManifestResourceStream. That way you don't need to worry about fitting in with existing files or anything like that - just overwrite buildinfo.xml with a new file in the pre-build step.
You have to decide how important it is that the information you want to exchange is tied to the executable file itself.
Updating the config file during the built is a workable model, but it places the information in a location where it could be altered by anyone with access and a text editor.
Updating information after a build in a compiled assembly is certainly possible, but it's fragile and breaks down if you ever decide to sign the assemblies. It's also a lot of work, since there's no built it support for re-writing assembly files in this manner.
An alternative you should consider, is creating your own custom assembly-level metadata attributes and assigning them during the build process. You could even place them in a separate code file (or append them to AssemblyInfo.cs) as part of you build.
You could also consider creating an embedded resource (an XML file, for instance), and retrieving it from the assembly manifest at runtime.
Either of the above approaches would require you to use a pre-build custom step rather than a post-build step.
Personally, I find the metadata attributes a convenient approach if there isn't a lot of data. Otherwise, I would consider using an embedded resource file.
My next project is going to be using Windows Communication Foundation to host Managed Windows Services, so I have been trying to follow a HOWTO on msdn - How to: Host a WCF Service in a Managed Windows Service. Sounds like a perfect match.
All was well until it started mentioning an App.Config file but without outlining how it got generated in the first place.
As I have posted there, there is probably some assumed prior knowledge (perhaps from another tutorial), but I couldn't find the answer after some searching.
Thanks in advance.
Are you talking about item #5? The app.config file is generated by you. You can add the item to your project in VS.NET by right clicking on the project and selecting to add a new config file. Then you can add the section as indicated by the step.