Using the WSDL Importer
To use the WSDL importer, choose either:
- File > New > Other > Delphi Projects or C++Builder Projects > WebServices > WSDL Importer
- Component > Import WSDL
Note: The WSDL importer invoked from File > New > Other > WSDL Importer requires that you create an application before you can activate the command, but the WSDL importer invoked from Component > Import WSDL allows you to run the wizard before you create an application.
This topic gives only an overview. For full details about the wizard, see Import WSDL Wizard.
On the WSDL Location of the Import WSDL wizard, either specify the file name of a WSDL document (or XML file), or provide the URL where the WSDL or XML document is published. If the WSDL document is on a server that requires authentication (or must be reached using a proxy server that requires authentication), you need to provide a user name and password before the wizard can retrieve the WSDL document.
You also need to select SOAP versioning and WSDL Import Options in the wizard. The options you choose serve to configure the way the importer generates code. When you complete your selections and click Finish, the WSDL importer displays the code it generates for every definition in the WSDL document that is compatible with the Web Services framework. That is, it only uses those port types that have a SOAP binding.
You can use the WSDL importer when writing either a server or a client application. When writing a server, click the Options button and in the resulting dialog, check the option that tells the importer to generate server code. When you select this option, the importer generates implementation classes for the invokable interfaces, and you need only fill in the bodies of the methods.
Warning: If you import a WSDL document to create a server that implements a Web Service that is already defined, you must still publish your own WSDL document for that service. There may be minor differences in the imported WSDL document and the generated implementation. For example, if the WSDL document or XML schema file uses identifiers that are also keywords, the importer automatically adjusts their names so that the generated code can compile.
When you click Finish, the importer creates new units that define and register invokable interfaces for the operations defined in the document, and that define and register remotable classes for the types that the document defines.
As an alternate approach, you can use the command line WSDL importer instead. For a server, call the command line importer with the -Os option, as follows:
WSDLIMP -Os -P -V MyWSDLDoc.wsdl
WSDLIMP -Os -C -V MyWSDLDoc.wsdl
For a client application, call the command line importer without the -Os option:
WSDLIMP -P -V MyWSDLDoc.wsdl
WSDLIMP -C -V MyWSDLDoc.wsdl
Tip: The command line interpreter includes some options that are not available when you use the WSDL importer in the IDE. For details, see the help for WSDLIMP.