Taking control of WSDL/XSD from WCF-SVCUtil (Annotations, Schema Namespaces, and Schema Locations) - wcf

In the WSDL that is generated from a WCF service, there are a few problems that I'd like to take control of a little more. First, is there a way to add annotations to the xsd files generated with the WSDL without using surrogates?
I've taken care of adding annotations to the WSDL itself thanks to the following articles:
http://msdn.microsoft.com/en-us/library/system.servicemodel.description.iwsdlexportextension.aspx"
http://www.codeproject.com/Articles/29980/Exporting-Annotations-from-WCF
I was able to add annotations to data members through agillior, however they used surrogates which I would rather not use.
http://agilior.pt/blogs/bruno.camara/archive/2006/10/01/6.aspx
I would use Thoranin's solution except I want to apply the annotations to data members not parameters
http://thorarin.net/blog/post/2010/08/08/Controlling-WSDL-minOccurs-with-WCF.aspx
Second, I want to explicitly name the namespaces for the xsd files generated from the WSDL. I was able to take control over the namespace of the wsdl using the ServiceBehaviorAttribute: [ServiceBehavior(Namespace="http://mysite.com/HelloWorld")]
but unfortunately I can't find an easy way to specify the namespace of the xsd files :(, is there a simple way to do this/can you point me in the right direction?
-edit-Well I was being silly on the second request. I had forgotten to set the namespaces for my wcf files which is what maps to the xsd namespaces. My bad :) .
Lastly, when the wsdl imports an xsd, it uses a path similar to http://localhost:8080/HostDevServer/HelloWorldService.svc?xsd=xsd0
which seems to break the wsdl2java ant script by apache. I can go in and manually change them to the local files but it's just such a pain :). Is there any way to have the files generated and then have a local reference like:
HelloWorldService.xsd,HelloWorldService1.xsd etc?
Any feedback would be appreciated.

WCFExtras ftw:
I decided that instead of having my own attributes and classes put documentation/annotation into the WSDL and XSD files I would just give into the hype and let WCFExtras take care of it. That being said I do wish that the Xml comments would be split into different lines instead of having them all on the same line. (Just to make reading the xml files easier). Plus WCFExtras takes care of the surrogate problem perfectly :) !
Ended up writing a program to solve the third issue. It pretty much grabs the metadata files using svcutil then goes in and finds all the imports, and reassigns them to the files downloaded based of off the namespaces.

Related

Get extention point contribution as text

Is there a way to get the raw XML text which another plugin has contributed to an extension point?
The normal way to access data that is contributed to an extension point is to use IConfigurationElement objects:
IConfigurationElement[] configElems = Platform.getExtensionRegistry()
.getConfigurationElementsFor(LANGUAGES_EXTENTION_POINT_ID);
But I already have JAXB parser for the kind of data that is contributed to this extension point. I'd like to use that one instead of Eclipse's classes.
EDIT 1: An alternative would be to use some kind of Eclipse-configuratoin-to-JAXB bridge library. But I don't find any.
EDIT 2: It's probably possible to find the plugin.xml of the contributing plug-in and read that manually... Probably not a good idea.
EDIT 3: I think I will do this: Instead of contributing the data directly clients get to give a file name. I then read that file using my old parser.
No, I don't see anything that would give you the XML.
getConfigurationElementsFor gives you information extracted from many different plugin.xml files so it is not clear what XML could be returned anyway.
org.eclipse.core.internal.registry.ExtensionRegistry is the extension registry implementation, but a lot of the information that uses comes from org.eclipse.core.internal.registry.RegistryObjectManager.

WSDL Importer not generating list correctly

I have this service: https://mnavwcfservices.stcenergy.com/FlexProcurementService.svc?singleWsdl
I am trying to use this inside Delphi XE5
I have used the WSDL Importer
The generated file is here https://www.stcenergy-online.com/dev/service.txt
Although the top level classes have been generated correctly, the lists are using list of AnyType
How do I get the correct classes to be generated?
One example is ClipMonthSummaryLine - this is in the wsdl file but does not make it into the generated file by the WSDL importer which I think is why the ArrayOfType has come in
This appears to have been caused by the use of interfaces in the C# classes
This is an absolute nightmare for me now as I never have lists of concrete classes but I think I can get round this by creating new classes that use concrete lists and mapping the data
Sir Rufo's response suggested using the Web Services Toolkit as opposed to the default WDSL importer that comes with Delphi. Although this looks very good it has proved to be a total nightmare to use to the point I may have to raise a new question about it. My new problem https://stackoverflow.com/questions/25961758/list-not-loaded-correctly-from-soap-message-wcf may have been caused by the default importer as well, but getting the files generated by the toolkit to work in Delphi is a nightmare and the documentation is not as good as it first appears.

What does .dist used as an extension of some source code file mean?

Examples in the Zend tutorial:
phpunit.xml.dist
local.php.dist
TestConfig.php.dist
.dist files are often configuration files which do not contain the real-world deploy-specific parameters (e.g. Database Passwords, etc.), and are there to help you get started with the application/framework faster. So, to get started with such frameworks, you should remove the .dist extension, and customize your configuration file with your personal parameters.
One purpose I have seen in using .dist extension, is to avoid publishing personal data on VCSs (say git). So, you, as the developer of a reusable app, would use your own configuration file, but put the de-facto get-started config data in a separate .dist-suffixed file. (See Symfony2's documentation, 4th part)

Generating "user" and "developer" documentation from the same codebase using Doxygen

I'm new to Doxygen and I'm trying to document an API I am planning to open source. I'd really like to build two sets of documentation, one for end users of the API and one for those who intend to modify it. Is there a way to tag Doxygen comment blocks in a way such that I can generate "user" and "dev" documentation trees? Is there a better solution to my problem? Thanks!
Depending on how your code is structured, you might be able to get away with using two Doxygen config files each including separate source files. The "user" config file would only list the source files containing the public interface to the API, while the "dev" config file would list all source files for the whole project.
This does mean that all your interfaces (e.g. abstract base classes) will need to be documented with the user in mind, but that is usually not a problem as by definition there is unlikely to be any implementation details in an abstract base class.
All your "dev" documentation then sits in the actual classes implementing the interfaces, which are never seen by the API and can be safely omitted by the "user" Doxygen config file.
Of course if your code isn't structured this way it's not going to work, so the only solution I can think of is to fill your comments with a bunch of conditional statements.
In addition to what Malvineous already said, there is the \internal doxygen command.
\internal lets you hide or show part of the documentation by changing INTERNAL_DOCS in the Doxyfile
More information here: http://www.doxygen.nl/manual/commands.html#cmdinternal

Creating bindable classes from WSDL for Flex 3

Two of our apps are web applications with a Flex 3 front end and a SOAP-style WCF back end. To communicate with the back end, I generate web service client classes through Flex Builder 3. Everything's functional, but maintaining those generated classes has been quite annoying, and I'm looking for a better way to do things (without having to do a major rewrite, of course). Here's the problems:
I use Flex libraries to manage components shared among applications. Some of them are dependent on the generated classes, so I need the WSDL-generated classes in their own library. Flex Builder 3, however, only generates the classes for a Flex application, so I have to generate the files in the application's source tree, then manually move the files every time. This also introduces strange side-effects with the way that Eclipse manages source code (why can't it just monitor the FS like other IDEs do?).
We use data binding in the MXML to declaratively tie data to the UI. I like data binding. Unfortunately, the classes in the WSDL-generated code do not support binding. Therefore, I opted to create a program to alter the ActionScript classes, adding [Bindable] metadata to them. This has to be run every time we regenerate the code.
Flex has a very nasty bug, known about at least since March, which still hasn't been fixed: http://bugs.adobe.com/jira/browse/SDK-19811. I recently discovered this, because it was double-encoding some XML characters like < and & into < and &. Therefore, I also had to add a workaround for that to the ActionScript manipulation program.
The WSDL-code generator in Flex Builder creates a String, Boolean, Int, and other classes which are built-in types! We're always having to delete these source files to prevent the Flex compiler from sometimes balking.
It seems unlikely to me that everyone is just putting up with these issues. There must be some alternative way of generating web service proxy classes for Flex that others are employing. Since I'm time-prohibited from making the communication layer RESTful and rewriting the front end in Silverlight, what do you suggest?
You can use one of several mechanisms to read the WSDL into a program and generate whatever flex code you need.
You can use one of the two ServiceDescription classes to read in a WSDL and examine its contents in terms of an object model;
You can use T4 Templates in Visual Studio with a bit of custom work to expose the WSDL to the template (possibly through the ServiceDescription class, as above)
You can use XSLT to transform the WSDL into the code you'd like
You can write some standalone program to read the WSDL (as XML or an object model) and just emit the text you want for your proxy code.
The bottom line is that, if you're having problems with the automation tools, then there are practical ways of creating your own.
Unfortunatly Flex 3 code generation from WSDL lacks from the Bindable tag, and it is a nightmare to handle that problem manually... especially if you have a complex scenario with lots of Types.
You could just add the tag manually and remove the "generated.webservices" from all variable declarations in order to make the code compile... and then you have another problem:
What if i have to generate de code again? Either i do everything again... or i will have a bunch of runtime only detected bugs...
I used ANT to a small trick:
Add Bindable to all classes;
Remove the full namespace from all variable declarations;
<target name="updateGeneratedCode" >
<replace dir="PATH TO YOUR GENERATED CODE">
<include name="**/*.as"/>
<replacetoken>public class</replacetoken>
<replacevalue><![CDATA[[Bindable]public class]]></replacevalue>
</replace>
<replace dir="PATH TO YOUR GENERATED CODE" value=":">
<include name="**/*.as"/>
<replacetoken>:generated.webservices.</replacetoken>
</replace>
</target>
Note: the replace token ":generated.webservices." may be different in your case, so you may want to replace it by your generated namespace.
It is working for me so far.
Hope it helps someone!
Antonio Inacio