I have couple of WSDLs to refer from my project.
For the decoupling concerns I need to map the classes defined in service reference to my own classes.
Is there is any way or tool to generate these mapper classes instead of copy pasting?
AutoMapper is a convention-based mapping tool with a fluent API. It's specifically designed to handle mapping concerns in situations like this.
I've used it on a number of projects and been very happy with it.
You can use the Web Services Description Language Tool to generate the C# classes needed to interact with the web service.
wsdl /out:myProxyClass.cs http://host/WebService.asmx?WSDL
Or you can use the newer ServiceModel Metadata Utility Tool:
svcutil /t:code http://host/WebService.svc /out:myProxyClass.cs /config:myProxyClass.config
If necessary you can then modify these classes yourself.
Related
I'm looking for a way to communicate between different C# (only) apps via gRPC. Is there any way to provide service definitions and contracts by C# interfaces and POCO classes (attributed by ProtoMember, etc.), instead of creating a proto file and generating a code out of it? I need this to work on .net framework 4.7.2, i.e. working with grpc.core rather than grpc.dotnet.
PS: The main idea why I want this is to avoid the code generation part which seems to be excessive here. Also need to be able to specify custom attributes to my POCO classes, like DisplayAttribute and stuff.
Alright, looks like I found the answer https://github.com/grpc/grpc-dotnet/issues/68
protobuf-net.Grpc seems like the lib I was looking for
You can also check ServiceStack gRPC which provides code-first development.
I was able to download and include both the partner and enterprise WSDLs into my VS .NET 2010 project. In the Web References folder, all that appears is a Reference.map file, which, when I expand, exposes a few other .datasource files but no class stubs.
After including a reference to both APIs, I can not create an instance of my Salesforce classes (both native [such as Account] and custom). I need to do this for an upsert().
Is there something I am missing? Please help.
You don't typically need both the Partner and the Enterprise WSDL in the same project.
The Enterprise WSDL will be tailored to the schema of the generating Org and will have classes for Account, Contact etc and include properties for custom fields.
The Partner WSDL is designed to work with any Org, so it doesn't have specific classes. Instead you use a generic sObject and access XML Elements for the field values.
I am working with integrating an MVC4 application with WCF services. At present, I generate a service reference from the WCF services endpoint using svcutil.
I have a number of services eg. a BooksServiceReference and CarsServiceReference. An issue I have is that both service references share the same entities but my code treats them differently as they have different namespaces. For example, both references have a Price entity which is the same, only a different namespace.
What I want to do but unsure in doing is the follows. Use T4 mapping to take each class in the service reference file and generate a DTO object for it. So at this point, I have my own DTO object for all classes in the service reference.
Next step, exclude the common entities via a T4 configuration file that are common to both service references. I believe this will be manual and I am fine with this.
For the common entities to, I create a separate T4 configuration file which generates these in to one DTO file.
I have only done some brief work with T4 generation so would appreciate any assistance with the above?
We have several .Net webservices that we use a java client for. Each webservice has it's own namespace, but they all use a lot off common classes. When these are exposed as WSDLs, then generated into Java code, we get a lot of duplicates in Java of the same .Net classes.
Is there a way in .Net to define a set of WebService objects to be exported under a shared namespace (in XML)? Or can we when we use wsimport in Java to generate just one instance of each duplicate class?
From service side, one of the option could be to have specially crafted single WSDL describing all services. See this article for how to do it (applicable for asmx services).
On side note, for .NET clients, its quite simple to use wsdl tool with sharetypes options to have common types generated once and re-used among multiple service proxies. Hopefully, similar tools/options perhaps exist at java client side.
The -p option of wsimport allows you to override the namespace specified in the WSDL to a package that you specify. If you specify the same package for each WSDL you'll only end up with one instance of each class.
Here's my problem:
I am creating a Blackberry application that access's my data via a web service.
The web service is using entity framework which was created for my web application.
I use the SUN wireless toolkit stub generator to create the code and classes to access the web service from the Blackberry application. The stub generator does not like dates and fields that return collections so I usally have to create new classes manually that deal with this.
Idea:
I want to be able to generate these classes automatically from my entity framework model?
What is the best way to do this?
I would like to make this generic. Something similar to the POCO generator would be ideal
Thanks
From what I know about Entity Framework, it has some XML-based schema description. You can write relatively simple XSLT transformation, which will transform this XML into a set of classes suitable for transmitting over the wire.