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.
Related
I've built a service and corresponding data model in c#. A third party wants to integrate with service. I'm required to provide xsd-schema.
The "xsd" tool in VS does the job but somehow namespaces is lost in the process. Is it possible to include the namespaces I've defined on my classes(using the DataContract tag) using the xsd-tool? Is there other tools out there to convert a .cs model to xsd?
Update:
The service is rest api based on json used by serveral client. This issue arrised when I wanted to integrate biztalk with this api. I could manuanly add namespace but this is tedious as it's a huge service contract that change alot.
Based on the suggestions from #dbc svcutil turned out to be the solution. Using the datacontract only flag I was able to generate service model containing correct namespace references.
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.
I have .net application which creating salesforce custom object dynamically but when i am using that object in my application it does not access it.
what i want to do is, i want to update the wsdl as soon as custom object created.
You are probably using the Enterprise WSDL, which contains stubs for all objects. If you expect objects to change (as you do here), then you should instead use the Partner WSDL. The Partner WSDL does not contain stubs for objects; instead, the partner WSDL file defines a single, generic object (sObject) that represents all of the objects.
For more information, check out the section called "Using the Partner WSDL" in the Salesforce.com API docs.
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.