svcutil support for WS-Addressing and WS-Policy - svcutil.exe

I'm using schema-first web service development approach by hand-coding WSDL/XSD and then feeding it to svcutil tool to generate .NET data and service contracts. I've tried to introduce WS-Addressing into my WSDL by including "UsingAddressing" element both directly into binding and as WS-Policy import. Policy import is ignored, but I get the following error, when "UsingAddress" is included directly into WSDL binding: "WSDL extension element "UsingAddressing" from namespace 'http://www.w3.org/2006/05/addressing/wsdl' was not handled".
According to MSDN, "UsingAddressing" element is supported by WCF (http://msdn.microsoft.com/en-us/library/ms996497.aspx), so is it so, that this element is not supported by svcutil?

For anyone coming across this, I had the same problem trying to generate a proxy with svcutil. I had to generate the proxy via VS2017 and it worked.

Related

oData client limit classes

I am currently testing oData client in combination with Dynamics AX 7. The metadata file coming from AX is over 900'000 lines big and if i use the default oData client and auto generate a C# class file it won't build because of too many string literals (.net error).
Now i'm looking for a way to tell the client generator which classes to generate (by entity name for example) and which not (about 95% isn't needed on the client-side).
Sadly limiting the metadata on AX side is not an option.
We had a similar issue, where we had to modify the available $metadata information from an ODATA service.
In our case we used the DataServiceContext generator and pointed to the original server URI but used Fiddler as a Proxy inbetween. By using a breakpoint in Fiddler we could serve our modifed $metadata xml to the DataServiceContext generator in Visual Studio. Works fine when you used sparingly and if the API is stable.
Yes using VS2015 will solve your "too many strings" error, but you will still have a problem where Visual Studio 2015 will crash if you open the huge file that is generated or accidentally step into the oData client file while debugging.
To get around this issue, I edited the T4 templates which auto-generate the oData client classes so that they create multiple files, so you do not end up with one huge 1 million+ line file. Using the updated T4 templates, it will generate the same code, but will split into a new file every 5MB.
The updated T4 templates can be found here:
https://github.com/batetech/D365FO-oData-T4-MultiFile-Templates

WCF Service Library Configuration (App.config) And Webapplication Config(Web.config) Issue

I have a Service Client Library project which has its own
app.config
.
This project is referenced in my Web Application. The problem is My web application throws following exception
Could not find endpoint element with name 'HttpEndPoint' and contract 'ServiceLibReference1.IDalService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element.
There is nothing wrong with the service. If i directly refer my service in the web application it works fine as client configurations get added to the web.config. But my requirement is to keep it in a separate library project.
The reason for the exception is service configurations are not added to the web.config. Should i always add them manually? Should not VS add corresponding configurations into web.config whenever a service library is referenced? or am i missing something ?
thanks
Service libraries are, by design, intended to be used by (potentially) multiple different applications. Therefore, they don't use the app.config file included in the template - they will use the config file (web/app) of the application that is referencing them. This promotes code reuse - if you have certain methods that you are always using across multiple applications, it's easier to put them in a separate class library assembly. One benefit of that design is that you only need to change the code in one place to make the change effective for all using applications.
So yes, you will always need to add the service configuration to the specific application configuration file. Unfortunately, VS does not know to do this.

Generate proxy classes from wsdl in IDL

I would like to generate proxy classes/code from a WSDL for IDL. So that I may communicate with a SOAP service.
Anyone know any tutorials or have any clue on how it can be done?
Try to use WseWsdl3 - see http://msdn.microsoft.com/en-us/library/aa529578.aspx .
If WseWsdl3.exe is unable to create the proxy class, there is still a way.
If you can run your service as a regular ASP.NET web application in IIS, it creates temporary ASP.NET files where the proxy class is nicely generated for you.
You can find it in folder:
C:\Windows\Microsoft.NET\Framework\vMAJOR.MINOR.BUILD\Temporary ASP.NET Files\YOUR_WEB_APP.
There are some subfolders with random names, go to most recent one and look something like "App_WebReferences.XXXX.0.cs".

HTTP unsupported Media type issue

i use WCF with ios application, and when request for some method, IIS returns me 415 error, Not Supported Media Type.
Proxy class are generated through wsdl2objc, the same call from windows application works fine
The problem is probably in your WCF service configuration, specifically the binding you're using. I suppose you have configured it to use either custom binding or WSHttpBinding, but in either way the service expects application/soap+msbin1 mime type, but the requests made by the generated classes from wsdl2objc are with text/xml. I'm not quite sure how to fix it, but start by configuring your service for the standard BasicHttpBinding and give it a try. Also revert all changes you've made on the generated code from wsdl2objc.
Btw WSHttpBinding uses SOAP 1.2 and I'm not sure if wsdl2objc can work with it (i have tested it only with BasicHttpBinding).

Create web service using external WSDL through Add Service Reference

I have an ASP.NET MVC3 project in .NET 4 which needs to act as a SOAP server to receive notifications from another website.
I have created web services before, but I don't know how to set up a way to receive these notifications where the WSDL is provided by the external website.
I know I can create a service and get that to produce its own WSDL, but I'm assuming there must be an easy way to add a service reference, and then create a service that uses the objects/methods generated by it.
How do I do this?
Thanks
You can use the svcutil tool from visual studio commands line, to create the required configuration and proxy files

Resources