Software Links
Getting Started
- A Globus Primer
- Globus Is Modular!
- Quickstart
- Installing GT
- Platform Notes
- GT Developer's Guide
- GT User's Guide
- Migrating Guides
Reference
Manuals
Common Runtime
Security
- GSI C
- GSI Java
- Java WS A&A
- C WS A&A (coming soon)
- CAS
- Delegation Service
- MyProxy
- GSI-OpenSSH
- SimpleCA
Data Mgt
WS MDS
Execution Mgt
Name
globus-wsrf-cgen — Generate Stubs/Skeletons in C
Synopsis
globus-wsrf-cgen [-help] [-dr]
[-s PACKAGE-NAME] [-sn SERVICE-NAME] [-d DIRECTORY] [-flavor FLAVOR] [-lang [ c | cpp ]]
[-p PREFIX-MAP-FILE] [-P NAMESPACE=PREFIX]
[-n NAMESPACE-FILE] [-N NAMESPACE]
[-g NAMESPACE-FILE] [-G NAMESPACE] [-gg]
[-np] [-nb] [-nk] [-ns] [-nc] [-no-sources] [-nt] [-nf FUNCTION]
[-extra-cppflags CPPFLAGS] [-extra-ldflags LDFLAGS] [-extra-libs LIBS]
SCHEMA-FILENAME...
Description
The globus-wsrf-cgen tool generates C-language bindings from
WSDL and XML Schema files. The input SCHEMA-FILENAME
value should be either a WSDL document containing a service description or an
XML schema file containing type definitions.
If a WSDL Schema file is specified as input, globus-wsrf-cgen generates a GPT source package containing client stubs, service skeleton and stubs, and type bindings for included schema types. If an XML Schema file is specified as input, it generates a GPT source package containing type bindings. A full description of the generated files is part of the WSDL to C mapping document.
The full set of command-line options to globus-wsrf-cgen are:
| -help | Display a help message and exit |
| -dr | Dry-run: parse the command-line options and display the command-line arguments to the globus-wsdl-parser program. |
-s PACKAGE-NAME | Use PACKAGE-NAME_bindings as
the name for the generated GPT package |
-sn SERVICE-NAME | Use SERVICE-NAME as the
name of the service instead of the name in the WSDL schema
document. |
-d DIRECTORY | Generate the GPT source package in
DIRECTORY, creating it if does not
exist. |
-flavor FLAVOR | Build the package using the FLAVOR
GPT flavor |
-lang LANG | Create the service implementation file with the extension
matching LANG, either "c" or "cpp".
See the limitations section
for more details. |
-p PREFIX-MAP-FILE | Use the contents of
PREFIX-MAP-FILE to define the
set of strings to prepend to elements, attributes, and types
in various XML namespaces.
See the
namespace handling section of this document for more
details. |
-P NAMESPACE=PREFIX | Prepend element, attribute, and type names in the XML
namespace NAMESPACE
with the string PREFIX.
See the
namespace handling section of this document for more
details. |
-n NAMESPACE-FILE | Generate bindings for schemas in the XML namespaces
contained in the NAMESPACE-FILE.
See the
namespace handling section of this document for more
details. |
-N NAMESPACE | Generate bindings for schemas in the XML namespace
NAMESPACE.
See the
namespace handling section of this document for more
details. |
-g NAMESPACE-FILE | Do not generate bindings for schemas in the XML namespaces
contained in the NAMESPACE-FILE.
See the
namespace handling section of this document for more
details. |
-G NAMESPACE | Do not generate bindings for schemas in the XML namespace
NAMESPACE.
See the
namespace handling section of this document for more
details. |
| -gg | Do not generate bindings for core WSRF namespaces. (Used internally only) |
| -np | Do not generate a GPT package. Only create source files from the schemas. Implies -nb. |
| -nb | Do not attempt to run configure and make dist on the generated GPT source package. |
| -nk | Do not generate a skeleton service implementation. Used in Makefiles for packages that want to generate the types at build time, but already contain a full implementation of the service. |
| -ns | Do not generate service bindings and skeletons. Useful for creating types- or client-only packages. |
| -nc | Do not generate client bindings. Useful for creating types- or service-only packages. |
| -nt | Do not generate type bindings. Useful for creating separate service or client bindings that depend on a common types package. |
| -no-sources | Delay generating C source files until the package is built. By default the package Makefile contains a list of source files. This option delays the creation of the files and the list until build time. This can be used to avoid storing dynamic files in a version control system. |
-nf FUNCTION | Do not generate an implementation of
FUNCTION. This is useful if extra
semantic information is needed to serialize or deserialize
a particular data type (for example, the wsnt:TopicExpressionType
requires different processing based on the value of the Dialect
|
-extra-cppflags CPPFLAGS | Add CPPFLAGS to the preprocessor
command-line for this package. |
-extra-ldflags LDFLAGS | Add LDFLAGS to the linker
command-line for this package. |
-extra-libs LIBS | Add LIBS to the libraries to
link with this package. |
Namespace Handling
XML and WSDL schemas generally contain a
targetNamespace attribute which distinguishes
operations, elements, attributes, type, etc from others with the same name.
The C language does not define namespaces.
globus-wsrf-cgen instead uses prefixes to distinguish
similarly-named data types and functions. There are two ways to define
a namespace prefix with globus-wsrf-cgen. The
-P command-line option defines a single namespace prefix,
and the -p command-line option instructs
globus-wsrf-cgen to load a set of prefix definitions
from a file (one per line).
For example, consider the namepace http://counter.com
from the sample CounterService. In the schema for that service, there is
an element named Value. the command-line option
-P http://counter.com=counter_ will cause
globus-wsrf-cgen to generate bindings for that element
with the name counter_Value.
If a service is built from several namespaces it might make sense
instead to use the -P parameter instead. Using the same
service as the previous example, we could instead create a file containing
http://counter.com=counter_ http://another.counter.com=another_counter_
to generate C prefixes for multiple namespaces.
A service may be composed of operations and data types from multiple namespaces. By default globus-wsrf-cgen generates bindings for all namespaces except those used by the core WSRF specifications. These are (along with their C prefixes):
Table 1. WSRF Core Namespaces and C Prefixes
| http://www.w3.org/XML/1998/namespace | xml_ |
| http://www.w3.org/2001/XMLSchema | xsd_ |
| http://www.w3.org/2005/08/addressing | wsa_ |
| http://docs.oasis-open.org/wsrf/r-2 | wsr_ |
| http://docs.oasis-open.org/wsrf/rw-2 | wsrw_ |
| http://docs.oasis-open.org/wsrf/bf-2 | wsbf_ |
| http://docs.oasis-open.org/wsrf/rp-2 | wsrp_ |
| http://docs.oasis-open.org/wsrf/rpw-2 | wsrpw_ |
| http://docs.oasis-open.org/wsrf/rl-2 | wsrl_ |
| http://docs.oasis-open.org/wsrf/rlw-2 | wsrlw_ |
| http://docs.oasis-open.org/wsrf/sg-2 | wssg_ |
| http://docs.oasis-open.org/wsrf/sgw-2 | wssgw_ |
| http://docs.oasis-open.org/wsn/b-2 | wsnt_ |
| http://docs.oasis-open.org/wsn/bw-2 | wsntw_ |
| http://docs.oasis-open.org/wsn/t-1 | wstop_ |
| http://schemas.xmlsoap.org/ws/2002/12/policy | wsp_ |
| http://schemas.xmlsoap.org/ws/2002/07/utility | wsu_ |
| http://schemas.xmlsoap.org/ws/2004/04/trust | wst_ |
| http://www.w3.org/2000/09/xmldsig# | ds_ |
| http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd | wsse_ |
| http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd | wsseu_ |
| http://schemas.xmlsoap.org/ws/2004/04/sc | wsc_ |
| http://schemas.xmlsoap.org/ws/2004/09/enumeration | wsen_ |
Often it is enough for a package to contain bindings for
the namespaces unique to the service and compile against other packages
which contain the bindings for the other namespaces. This control can
be done positively via the -N and
-n command-line options.
For example, to generate bindings for the
http://counter.com namespace only,
pass the command-line option -N http://counter.com. To
generate for both the http://counter.com nd
http://another.counter.com namespaces, either pass
multiple -N options with one namespace each, or create
a file containing:
http://counter.com http://another.counter.com
and pass the name of the file to globus-wsrf-cgen as the parameter to the
-n command-line option.
Examples
Here is a brief example of the globus-wsrf-cgen command. For more details, see the tutorials in the C WS Core developer documentation.
Create bindings for a service in the http://counter.com namespace:
%globus-wsrf-cgen-d counter\-N http://counter.com\-s counter\-P http://counter.com=counter_\$GLOBUS_LOCATION/share/schemas/core/samples/counter_service.wsdlCreating Bindings Package A new package has been created at /home/griduser/counter/counter_bindings-1.2.tar.gz To install, use the following command: $GLOBUS_LOCATION/sbin/gpt-build /Users/bester/tmp/foo/counter/counter_bindings-1.2.tar.gz <flavor>%
Limitations
- This program only generates bindings from document/literal style WSDL schemas. IBM developerworks has an article describing the different WSDL schema styles.
-
The bindings generated when
-lang cppis used are ANSI-C. However, all C++ keywords are avoided and no constructs that differ between C and C++ are used. This command-line option merely creates a makefile which compiles the service implementation with the C++ compiler. - Not all XML Schema constructs are supported. In particular, abstract types, substitution groups, and nested sequences are not implemented.