Title: Globus C Web Services Core for Developers
1Globus C Web Services Corefor Developers
- Bill Allcock, ANL
- Joe Bester, ANL
- GlobusWORLD / GridWORLD
- Sep 2006
2Features
- Hosting web services written in C and C
- Implementation of WSRF concepts and port types
- Type, client, and service bindings generator from
WSDL and XML schemas to C - Client APIs and programs
3Service Engine/Container
- API (globus_service_engine) for processing WS
requests within an application - Uses HTTP processor in XIO
- SOAP serializer/deserializer
- Service loading and invocation
- Program for hosting services
- globus-wsc-container
4Service Engine Usage
- globus_service_engine_init()
- To manage connection usage
- globus_service_engine_register_session(),globus_s
ervice_engine_register_process() - For simplicity
- globus_service_engine_register_start(),globus_ser
vice_engine_register_stop()
5WS-Resources
- Resource management API
- create/find/destroy resource
- property management
- lifetime management
- globus_wsrf_core_tools.h includes function to
find resource from EPR used in the current message
6WS-Resource Properties
- Property values associated with a type_info for
serialization information - Property values may be dynamic
- callbacks for attempts to get or set the value
- Apps can be notified when properties change
- Call globus_resource_property_changed() for
dynamic values
7Operation Providers
- Reuse a port type implementation
- Resource Properties
- Operations
- Examples
- wsrpGetResourceProperty
- GetResourceProperty operation
- wsrlScheduledResourceTermination
- SetTerminationTime operation
- CurrentTime, TerminationTime properties
8Notification Consumer
- Callback-driven notification
- User has to deal with XML wildcard messages
- Usage
- Create Engine (don't forget to start it!)
- Create Consumer
- Returns EPR of Notification Consumer Service
- Subscribe via client stubs
- May be different for some services
9Notification Producer
- wsntNotificationProducer provider
- Creates notification-related properties
- Handles Subscribe/GetCurrentMessage operations
- Creates Topics for Resource Properties
- Notification Producer API
- Create/destroy topics
- Change topics
- Also manage producer, subscriptions, etc
- but provider handles these for you
10Service Groups
- wssgServiceGroup, wssgServiceGroupRegistration
providers - creates wssg-related properties (Entry,
MembershipContentRule) - implements Add operation
- service_group API to manage entries
- add/remove entries
- enumerate entries
- also create/destroy service group
- provider handles these for you
11Handler Chains
- Handle specific message elements
- Called when matching header element is found
- Examples
- WS-Addressing
- Set attributes when addressing values encountered
- Verify all required addressing elements are
present - WS-SecureMessage
- Add attributes for elements to be signed
- Add message signatures
12SOAP Messaging
- XML Serialization Handles
- to/from file, memory, libxml DOM, HTTP
- Options to control (de)serialization
- default NS
- xsitype attribute
- c14n
-
13Message Attributes
- Key-Value pairs
- When value is set, optional copy and destroy
functions for memory management - Default attributes set at engine initialization
(service) or on a client stub - Additional attributes used to pass info from
message handlers - Example wsaTo value set by WS-Addressing handler
14Message Attributes (2)
- Authentication Options
- TLS / WS-SecureMessage
- Credentials to use
- Message protection
- Peer subject name
- Also Message timeouts, persistent connections
15Bindings Generator
- globus-wsrf-cgen program
- Uses JavaScript-based template language
- Generates type bindings
- Data structures, allocators, deallocators,
serializers, etc - Type information for wildcard handling
- Generates service module to call service
implementation - Generates client stub functions to invoke
(remote) operations - Generates Packaging/Makefiles
16Resource Property Element
- ltelement name"CounterRP"gt
- ltcomplexTypegt
- ltsequencegt
- ltelement ref"tnsValue"/gt
- ltelement maxOccurs"unbounded"
ref"rpns0Topic"/gt - ltelement maxOccurs"unbounded"
- ref"rpns0TopicExpressionDia
lects"/gt - ltelement ref"rpns1TerminationTime"/gt
- ltelement ref"rpns1CurrentTime"/gt
- ltelement ref"rpns0FixedTopicSet"/gt
- lt/sequencegt
- lt/complexTypegt
- lt/elementgt
17Example Counter Service
- ltelement name"createCounter"gt
- ltcomplexType/gt
- lt/elementgt
- ltelement name"createCounterResponse"gt
- ltcomplexTypegt
- ltsequencegt
- ltelement ref"wsaEndpointReference"/gt
- lt/sequencegt
- lt/complexTypegt
- lt/elementgt
18Message Definition
- ltmessage name"CreateCounterRequest"gt
- ltpart name"request"
- element"tnscreateCounter"/gt
- lt/messagegt
- ltmessage name"CreateCounterResponse"gt
- ltpart name"response"
- element"tnscreateCounterResponse"/gt
- lt/messagegt
19Port Type Definition
- ltportType name"CounterPortType"
- wsrpResourceProperties"tnsCounterRP"gt
- ltoperation name"createCounter"gt
- ltinput
- message"tnsCreateCounterRequest"/gt
- ltoutput
- message"tnsCreateCounterResponse"/gt
- lt/operationgt
- ...
- lt/portTypegt
20C Type Binding
- typedef struct createCounterResponseType_s
-
- wsa_EndpointReferenceType EndpointReference
- createCounterResponseType
- typedef struct createCounterResponseType_array_s
-
- struct createCounterResponseType_s
- elements
- int length
- globus_xsd_type_info_t type_info
- createCounterType_array
21C Type Bindings Functions
- globus_result_t
- createCounterResponseType_init(
- createCounterResponseType inst)
- void
- createCounterResponseType_destroy(
- createCounterResponseType inst)
- struct createCounterType_s
- createCounterResponseType_array_push(
- createCounterResponseType_array array)
22C Type Serializer
- globus_result_t
- createCounterResponseType_serialize(
- const xsd_QName element_name,
- const createCounterResponseType val,
- globus_soap_message_handle_t message_handle,
- globus_xsd_element_options_t options)
- also deserialize, copy, array, contents-only
versions.
23XML Wildcards (1)
- struct globus_xsd_type_info_s
-
- xsd_QName type
- globus_xsd_serialize_func_t serialize
- globus_xsd_deserialize_func_t deserialize
- globus_xsd_init_func_t initialize
- globus_xsd_destroy_func_t destroy
- globus_xsd_copy_func_t copy
- ...
24XML Wildcards (2)
- typedef struct xsd_any_s
-
- globus_xsd_type_registry_t registry
- globus_xsd_type_info_t any_info
- xsd_QName element
- void value
- xsd_string_array
namespaces - xsd_any
25Client Stub Binding
- globus_result_t
- CounterPortType_createCounter(
- CounterService_client_handle_t handle,
- const char service_endpoint,
- const createCounterType createCounter,
- createCounterResponseType
- createCounterResponse,
- CounterPortType_createCounter_fault_t
- fault_type,
- xsd_any fault)
- Also with EPR in place of service_endpoint
- Also non-blocking functions
- Request and response versions
26Client Example (1)
- createCounterType createCounter
- createCounterResponseType createCounterResponseN
ULL - createCounterType_init_contents(createCounter)
- globus_soap_message_attr_init(attrs)
- globus_soap_message_attr_set(
- attrs,
- GLOBUS_SOAP_MESSAGE_AUTHENTICATION_METHOD_KEY,
- NULL, NULL,
- GLOBUS_SOAP_MESSAGE_AUTH_SECURE_MESSAGE)
- CounterService_client_init(
- client_handle, attrs, NULL)
27Client Example (2)
- result CounterPortType_createCounter(
- client_handle,
- counter_service_contact,
- createCounter,
- createCounterResponse,
- fault_type,
- fault)
- if (result ! GLOBUS_SUCCESS) ...
- globus_wsrf_core_export_endpoint_reference(
- createCounterResponse-gtEndpointReference,
- "counter.epr",
- wsa_EndpointReference_qname)l
28Service Initialization
- globus_result_t
- CounterService_init(
- globus_service_descriptor_t service_desc)
-
- globus_module_activate(
- GLOBUS_WSRF_RESOURCE_MODULE)
- ...
-
29Operation Implementation
- globus_result_t
- CounterPortType_createCounter_impl(
- globus_service_engine_t engine,
- globus_soap_message_handle_t message,
- globus_service_descriptor_t service,
- createCounterType createCounter,
- createCounterResponseType
- createCounterResponse,
- const char fault_name,
- void fault)
30Service EPR Construction
- globus_service_engine_get_contact(
- engine, endpoint)
- epr-gtAddress.base_value
- globus_common_create_string("s/s",
- endpoint,COUNTERSERVICE_BASE_PATH)
- counter_key xsd_any_array_push(
- epr-gtReferenceProperties-gtany)
- counter_key-gtany_info xsd_string_info
- counter_key-gtelement CounterKey_qname
- counter_key-gtvalue resource_id
31add operation
- globus_result_t
- CounterPortType_add_impl(
- globus_service_engine_t engine,
- globus_soap_message_handle_t message,
- globus_service_descriptor_t service,
- xsd_int add,
- xsd_int addResponse,
- const char fault_name,
- void fault)
32add implementation
- globus_wsrf_core_get_resource(
- message, service, resource)
- globus_resource_get_property(resource,
- CounterPortType_Value_rp_qname,
- (void )counter_value, NULL)
- counter_value add
- addResponse counter_value
- globus_resource_property_changed(resource,
CounterPortType_Value_rp_qname) - globus_resource_finish(resource)
33Generating WSRF Faults
- time_t timestamp time(NULL)
- wsrp_ResourceUnknownFaultType_init(fault)
- globus_libc_gmtime_r(timestamp,
- (fault)-gtTimestamp)
- fault_name"ResourceUnknownFault"
34Performance Snapshot (GT 4.0.1)
35Use Case globusrun-ws
- Command-line client to submit and monitor WS-GRAM
jobs - Interacts with WS-Delegation, WS-GRAM, and
(indirectly) RFT - Includes a service engine to handle notification
messages from WS-GRAM - On the order of 20x faster than the Java client
program - Largely due to the JVM startup costs
36Use Case RFT Client
- Command-line client to RFT service
- RFT performs reliable 3rd-party transfers using
GridFTP - Create a transfer, start monitor it
- Monitoring via WS-Notification
- Adds features, improves performance over previous
java client - Meet Ravi
- 9/14 1130 AM "Globus RFT for Developers"
37Use Case GridFTP Resource Properties
- Experimental GridFTP feature
- Server exposes state via resource properties
- Server load
- Connection limits
- Acts as WS-MDS provider
38Use Case Container on an ARM processor
- Prototype for ocean floor sensor platform for the
LOOKING project - Port of C WS Core to proprietary embedded
operating system - Development board with 4MB Flash, 16MB RAM
- NETOS
- C Container statically linked with OS and services
39Use Case Core Command-Line tools
- Substitute for Java CLI tools in 4.1, 4.2
- Clients work with any service implementing the
related port types - WS-ResourceProperties
- globus-wsrf-query
- globus-wsrf-get-property
- globus-wsrf-get-properties
- globus-wsrf-insert-property
- globus-wsrf-update-property
- globus-wsrf-delete-property
40Use Case Core Command-Line tools
- WS-ResourceLifetime
- globus-wsrf-destroy
- globus-wsrf-set-termination-time
- WS-BaseNotification
- globus-wsn-get-current-message
- globus-wsn-pause-subscription
- globus-wsn-resume-subscription
- globus-wsn-subscribe
41Project Web Page / Contributions
- http//dev.globus.org/wiki/C_WS_Core
- Globus is largely following the Apache project
model at this point. - We would welcome contributors.
- Long term, high quality contributors can be voted
in as committers. - An alternative would be to start a new,
independent project that utilized C WS Core, on
which you could be a committer at the start.
42Getting help / more information
- Email lists
- cwscore-devuserannounce_at_globus.org
- Documentation
- http//www.globus.org/toolkit/docs
- Bugzilla
- http//bugzilla.globus.org/bugzilla
- Product is C WS Core
- HPDC Paper
- http//www.globus.org/alliance/publications/papers
/WSRFComparison2005-3.pdf - Comparison of five different WSRF implementations
43Futures
- More clients (delegation, ...)
- Improved container
- More core services (registry, secure
conversation, ) - More flexible container configuration
- Authorization Improvements
- Persistent services
- Update to newer web standards
- Your C based Web service or client?
44Meet the Developers Session at Globus Alliance
Booth (152A-P7)
- September 12800am - 900am "Java WS Core and
Security (C, Java)" -- Olle Mulmo, Jarek Gawor,
Rachana Anantakrishnan - 1130am -1230pm "RLS" -- Rob Schuler, Ann
Chervenak1230pm -130pm "MDS" -- Mike D'arcy,
Laura Pearlman300pm - 400pm Resource
Management (GRAM, Virtual Workspaces and Dynamic
Accounts)" Stu Martin, Peter Lane, Tim Freeman,
Kate Keahey600pm - 700pm "C WS Core" -- Joe
Bester700pm - 800pm "Python WS Core" -- Joshua
Boverhof - September 13800am - 900am "GridShib" -- Von
Welch, Ton Scavo, Tim Freeman - 1130am - 1230pm "GT Installation and
Administration" -- Charles Bacon1230pm - 130pm
"MyProxy" -- Jim Basney300pm - 400pm "GridFTP,
XIO, RFT" -- John Bresnahan, Ravi Madduri
45Question Do you see a Fun Exciting Career in
my future? Magic 8 Ball All Signs Point to YES
- Say YES to Great Career Opportunities
- SOFTWARE ENGINEER/ARCHITECT
- Mathematics and Computer Science Division,
Argonne National Laboratory - The Grid is one of today's hottest technologies,
and our team in the Distributed Systems
Laboratory (www.mcs.anl.gov/dsl) is at the heart
of it. Send us a resume through the Argonne site
(www.anl.gov/Careers/), requisition number
MCS-310886. - SOFTWARE DEVELOPERS Computation Institute,
University of Chicago - Join a world-class team developing pioneering
eScience technologies and applications. Apply
using the University's online employment
application (http//jobs.uchicago.edu/, click
"Job Opportunities" and search for requisition
numbers 072817 and 072442). - See our Posting on the GlobusWorld Job Board or
Talk to Any of our Globus Folks.