Newer Version Available
Step 3: Import the WSDL File Into Your Development Platform
After you have the WSDL file, import it into your development platform so that your development environment can generate the necessary objects for use in building client Web service applications in that environment. This section provides sample instructions for WSC and Microsoft Visual Studio. For instructions about other development platforms, see your platform's product documentation.
Instructions for Java Environments (WSC)
Java environments access the API through Java objects that serve as proxies for their server-side counterparts. Before using the API, you must first generate these objects from your organization's WSDL file.
Each SOAP client has its own tool for this process. For WSC, use the wsdlc utility.
The basic syntax for wsdlc is:
This command generates an output jar file based on the specified WSDL file. After the output jar file is created, reference it along with the WSC .jar file (for example, force-wsc-57.0.0-uber.jar) in your Java program to create a client application.
Instructions for Microsoft Visual Studio
Visual Studio languages access the API through objects that serve as proxies for their server-side counterparts. Before using the API, you must first generate these objects from your organization's WSDL file.
After you have the proxy classes for the server-side objects, ensure that you specify whether you have set any values on non-string fields. For more information, see Implementation Considerations.
Visual Studio provides two approaches for importing your WSDL file and generating an XML Web service client: an IDE-based approach and a command-line approach. This walkthrough describes how to import your WSDL file through the IDE.
An XML Web service client is any component or application that references and uses an XML Web service. It isn’t necessarily a client-based application. In fact, in many cases, your XML Web service clients can be other Web applications, such as Web Forms or even other XML Web services. When accessing XML Web services in managed code, a proxy class and the .NET Framework handle all of the infrastructure coding.
To access an XML Web service from managed code:
- Name your project Walkthrough or change the using directive in the following sample to your_project_name.web_reference_name. Then, add a Web reference to your project for the XML Web service that you want to access. The Web reference creates a proxy class with methods that serve as proxies for each exposed method of the XML Web service.
- Add the namespace for the Web reference.
- Create an instance of the proxy class and then access the methods of that class as you would the methods of any other class.
You can add either a .NET 2.0 style Web reference or a .NET 3.0 style Service reference, depending on your version of Visual Studio and preferred developer environment. A .NET 3.0 style reference uses services like SoapClient instead of SforceService.
- In the Project menu, select Add Service Reference, select Advanced, and then select Add Web Reference.
- In the URL box of the Add Web Reference dialog box, type the URL to obtain the service
description of the XML Web service you want to access, such as:
C:\WSDLFiles\enterprise.wsdl
- To retrieve information about the XML Web service, click Go.
- In the Web reference name box, rename the Web reference to sforce, which is the name you use for this Web reference.
- To add a Web reference for the target XML Web service, click Add Reference.
- Visual Studio retrieves the service description and generates a proxy class to interface between your application and the XML Web service.
Unfortunately, in the definition of the SObject class, Visual Studio doesn’t wrap Case and Event to class references in the System.Xml.Serialization.XmlIncludeAttribute that are part of the SObject definition. To work around this problem in Visual Studio, edit the XmlIncludeAttribute settings for Case and Event, as shown in the example. These edits don’t apply to C# and only apply when using the enterprise version of the WSDL.