Entering content frame

Component documentation Proxy Generator Usage Through Java API Locate the document in its SAP Library structure

Purpose

This component describes how to use the proxy generator from Java code.

Features

All proxy generator configurations are passed to the generator using the configuration container class:

com.sap.engine.services.webservices.jaxrpc.wsdl2java.ProxyGeneratorConfig

This class provides properties for configuring the proxy generation process. Here is the process that describes the actual generation:

This graphic is explained in the accompanying text

ProxyGeneratorConfig config = new ProxyGeneratorConfig(“c:/workdir/wsdlfile.wsdl”,“c:/results/wsdlclients/”,“mypackage”);

ProxyGenerator generator = new ProxyGenerator();

generator.getnerateProxy(config);

// Returns generated files (.java + configuration files).

File[] files = config.getAllGeneratedFiles();

 

You can see that the proxy generation is a simple process. Here is the list of properties that can be set to the ProxyGeneratorConfig class:

·        public void setWsdlLocation(String wsdlLocation) - sets the WSDL location

·        public void setTargetDir(String targetDir) - sets an output directory

·        public void setOutputPackage(String outputPackage) - sets an output package

·        public void setCompile(boolean compile) - compiles an option

·        public void setJarName(String jarName) - if this option is set, it creates a JAR file

·        public void setInterfacesOnly(boolean interfacesOnly) - generates Web service interfaces only

·        public void setAdditionalMethods(boolean additionalMethods) - adds RPC style methods

·        public void setJaxRpcMethods(boolean jaxRpcMethods) - adds JAX-RPC methods

·        public void setProxy(String proxyHost, String proxyPort) - sets an HTTP proxy for parsing the WSDL

·        public void setLocationMap(Hashtable locationMap) - this is used when a WSDL structure is downloaded

·        public void setAdditionalClassPath(String additionalClassPath) - additional classpath that must be used

·        public void setJarExtensions(String[] jarExtensions) - sets file extensions of files put in the JAR file

·        public void setCustomServiceName(String customServiceName) - sets a custom name of the generated service

·        public void setUriToPackageMapping(Properties uriToPackageMapping) - sets the default mapping from schema namespace to java package

·        public void setLogicalPortName(String logicalPortName) - sets the name of the file where the logical ports are stored. The default is lports.xml.

·        public void setLogicalPortPath(String logicalPortPath) - sets the location where the logical port file is stored. This option is used only when interfaces are generated.

Invoke these methods after the generation process:

·        public File[] getGeneratedSEIFiles() - returns SEI interface files that are generated

·        public File[] getGeneratedServices() - returns service files that are generated

·        public File[] getAllGeneratedFiles() - returns all generated files, including the lports.xml file and the type mapping file

·        public Properties getUriToPackageMapping() - returns the used namespace to package mapping.

 

Leaving content frame