Alvin Chao – James Madison University 
@chaoaj, chaoaj@jmu.edu , #csuc14 - 
#ws101
Overview 
Topics: 
Who is this aimed at? 
What is a web service? 
Where do you find resources for Cascade Server Web Services 
Operations 
When / Why would you use Web Services / Real life 
applications 
How: Understanding how to make Web Services Calls 
Code examples for some commonly used operations
Who 
Technical users with a background in some modern 
programming language and XML/Xpath, XSLT , Velocity 
Managers/Supervisors to know what the capabilities are 
for extending Cascade with Web Services
What is a Web Service? 
W3C defintion for a web service is, “a software system designed to 
support interoperable machine-to-machine interaction over a 
network”. 
Web Services provide a way to communicate between your own 
external code based application and Cascade Server. 
Cascade Server uses Simple Object Access Protocol (SOAP) for 
Web Services based on a Web Services Definition 
Language(WSDL) 
SOAP leverages XML formatted data calls to send and receive 
information 
WSDL::Web Server Script as SOAP::HTML requests
Where do you find info about 
Web Services? 
W3 Schools Web Services 
tutorials(http://www.w3schools.com/webservices/default.a 
sp) 
SOAPuser.com(http://www.soapuser.com/index.html ) 
WSDL 
Essentials(http://www.developer.com/services/article.php/ 
1602051/WSDL-Essentials.htm )
When /Why would you use a 
Web Service?(Use Case 
Scenarios) 
Importing content into Cascade from other 3rd party apps or databases/files 
Pulling Cascade Data out to other 3rd party Applications 
Handling form submissions 
Updating access rights on multiple assets for a single user or group 
Advanced bulk change 
Bulk update content 
Selective publishing of specific assets only 
Data Definition Page to Data Definition Block conversion 
Reporting of Cascade statistical information for management / analytics
How: Understanding how to 
make Web Services calls 
Read/interpret Your WSDL 
Setup a client: or Make Raw SOAP calls 
PHP: needs soap package 
Perl: Need SOAP::Lite module 
Java 
Javascript 
ASP.NET 
Connection/Authentication 
Make Calls 
Enjoy your Web Services
Who’sDL? What’s a WSDL 
A Web Services Description Language(WSDL) is the XML 
response document that serves as a Table of Content or 
Glossary to describe available operations(methods) 
available from a server. 
Cascade Server WSDL location is: 
http://[yourserver.edu]/ws/services/AssetOperationService?wsdl 
Recommend using a parser for WSDL like SOAP UI – 
http://soapui.org
WSDL elements / tags 
DEFINITIONS: Name of the web services, including 
NameSpace(important) 
http://www.hannonhill.com/ws/ns/AssetOperationService 
TYPES: What types of data will be transmitted? 
MESSAGES: What Messages will be transmitted?(matches 
types for Cascade) 
PORTTYPE: What operations will be supported? Cascade = 
Input/Output pairs 
BINDING: How will a message be transmitted? SOAP 
details(raw literal message for Cascade) 
SERVICE: Where is the service located?(Server URL)
WSDL File 
http://localhost:8080/ws/services/AssetOperationService?w 
sdl
Getting SOAPy 
SOAP(Simple Object Access Protocol) is used for 
application to application communication of XML message 
over http protocol. 
SOAP features: 
Platform independent(*nix, Mac OS, Windows) 
Language independent(JS, .NET, Perl, PHP, Ruby, Python, 
Java, etc…)
Anatomy of a SOAP Call 
CLIENT 
1: Prepare SOAP Request 
and Client Socket 
2: Connect to Server 
Authentication 
w/Username 
3: Transmit SOAP request 
4: Wait 
5: Receive SOAP 
response 
6: Close Client Socket 
SERVER 
1: Prepare Server Socket/ 
Listen on Server Socket 
2: Connect with Client 
3:Receive SOAP request 
4: Process/Prepare SOAP 
response 
5: Transmit SOAP 
Response 
6: Wait 
Password 
HTTP + 
XML = 
SOAP 
XML 
Message 
over HTTP 
Soap Message: 
XML: Envelope: 
Header: Body 
Server Message 
sends results 
back in Body 
section of SOAP 
Response
SOAP Message portions 
XML DECLARATION: 
ENVELOPE: Sets up namespace as a SOAP message 
HEADER(optional must be first if present): Not necessary 
for Cascade 
BODY:Actual message to be run 
FAULT(optional): used for error handling.
Connection / Authentication 
Each operation needs to be authenticated using a username 
and password 
The operation is then executed as if that User performed the 
operation in the web UI: 
Given User is the author of the operation 
Permissions and abilities are verified 
Audits are created for that User 
User must be setup to have the rights to run that 
operation in Cascade
Cascade Available 
operations 
http://localhost:8080/ws/services/Asset 
OperationService?wsdl 
Most frequently used operations: 
Create 
Read 
Edit 
Delete 
Copy 
Read/Edit Access Rights 
Publish
Important keywords in WSDL 
"complexType" and "simpleType”
Important keywords in WSDL 
« choice - either element 
Sequence – order is specific
Important keywords in WSDL 
"element" 
Attributes: "minOccurs", "maxOccurs" and "type" 
Comments
Important keywords in WSDL 
"extension »- More specific information on the operation
Cascade WSDL parameters 
Required: 
xml 
parentFolderId or parentFolderPath 
name 
Optional: 
expirationFolderId or expirationFolderPath 
metadataSetId or metadataSetPath 
Metadata fields (title, displayName, etc.) 
siteId or siteName
SOAPUI.org client 
examples 
Would you pay $1000? - XML Spy 
Would you pay $100? Oxygen XML educational price 
Would What is SOAP UI? 
Like MS Access for SOAP calls, allows you to generate SQL 
like calls to a database but SOAP calls to a WSDL 
http://soapui.org
Example SOAP Read folder names 
message
Example return output
Limitations 
Can’t access past versions of assets and drafts 
Can’t render assets 
Can’t use tools(Bulk Change) 
Can’t change preferences 
Can’t change configuration files 
Can’t view or interact with publish queue 
Certain operations can be limited
Further Reading/Resources 
Artur Tomusiak’s CSUC12 presentation on How to use 
Web Services(http://www.slideshare.net/hannonhill/artur-tomusiak 
) 
Hannon Hill Github for Web Services(≈) Perl, PHP, Java 
examples(https://github.com/hannonhill) 
Wing Ming Chan’s Web Services page: 
(http://www.upstate.edu/cascade-admin/projects/web-services/ 
)
Other WS Presentations at 
#CSUC14 
Tues 10:15 Leveraging Adminstative Tasks with Web 
Services - Eric Caraballo 
Tues 1:30 Ingesting Banner output Schedule Classes 
into Cascade Server (In Java - Web Services) – Alem 
Areki 
Tues 1:30 Web Forms, or How I Learned to Stop 
Worrying and Love Web Services – Erik Gorka 
Tues 4:15 Web Services: Encapsulation, Reusability, and 
Simplicity - Wing Ming Chan
Questions? 
@chaoaj – chaoaj@jmu.edu 
#ws101

Web services101

  • 1.
    Alvin Chao –James Madison University @chaoaj, chaoaj@jmu.edu , #csuc14 - #ws101
  • 2.
    Overview Topics: Whois this aimed at? What is a web service? Where do you find resources for Cascade Server Web Services Operations When / Why would you use Web Services / Real life applications How: Understanding how to make Web Services Calls Code examples for some commonly used operations
  • 3.
    Who Technical userswith a background in some modern programming language and XML/Xpath, XSLT , Velocity Managers/Supervisors to know what the capabilities are for extending Cascade with Web Services
  • 4.
    What is aWeb Service? W3C defintion for a web service is, “a software system designed to support interoperable machine-to-machine interaction over a network”. Web Services provide a way to communicate between your own external code based application and Cascade Server. Cascade Server uses Simple Object Access Protocol (SOAP) for Web Services based on a Web Services Definition Language(WSDL) SOAP leverages XML formatted data calls to send and receive information WSDL::Web Server Script as SOAP::HTML requests
  • 5.
    Where do youfind info about Web Services? W3 Schools Web Services tutorials(http://www.w3schools.com/webservices/default.a sp) SOAPuser.com(http://www.soapuser.com/index.html ) WSDL Essentials(http://www.developer.com/services/article.php/ 1602051/WSDL-Essentials.htm )
  • 6.
    When /Why wouldyou use a Web Service?(Use Case Scenarios) Importing content into Cascade from other 3rd party apps or databases/files Pulling Cascade Data out to other 3rd party Applications Handling form submissions Updating access rights on multiple assets for a single user or group Advanced bulk change Bulk update content Selective publishing of specific assets only Data Definition Page to Data Definition Block conversion Reporting of Cascade statistical information for management / analytics
  • 7.
    How: Understanding howto make Web Services calls Read/interpret Your WSDL Setup a client: or Make Raw SOAP calls PHP: needs soap package Perl: Need SOAP::Lite module Java Javascript ASP.NET Connection/Authentication Make Calls Enjoy your Web Services
  • 8.
    Who’sDL? What’s aWSDL A Web Services Description Language(WSDL) is the XML response document that serves as a Table of Content or Glossary to describe available operations(methods) available from a server. Cascade Server WSDL location is: http://[yourserver.edu]/ws/services/AssetOperationService?wsdl Recommend using a parser for WSDL like SOAP UI – http://soapui.org
  • 9.
    WSDL elements /tags DEFINITIONS: Name of the web services, including NameSpace(important) http://www.hannonhill.com/ws/ns/AssetOperationService TYPES: What types of data will be transmitted? MESSAGES: What Messages will be transmitted?(matches types for Cascade) PORTTYPE: What operations will be supported? Cascade = Input/Output pairs BINDING: How will a message be transmitted? SOAP details(raw literal message for Cascade) SERVICE: Where is the service located?(Server URL)
  • 10.
  • 11.
    Getting SOAPy SOAP(SimpleObject Access Protocol) is used for application to application communication of XML message over http protocol. SOAP features: Platform independent(*nix, Mac OS, Windows) Language independent(JS, .NET, Perl, PHP, Ruby, Python, Java, etc…)
  • 12.
    Anatomy of aSOAP Call CLIENT 1: Prepare SOAP Request and Client Socket 2: Connect to Server Authentication w/Username 3: Transmit SOAP request 4: Wait 5: Receive SOAP response 6: Close Client Socket SERVER 1: Prepare Server Socket/ Listen on Server Socket 2: Connect with Client 3:Receive SOAP request 4: Process/Prepare SOAP response 5: Transmit SOAP Response 6: Wait Password HTTP + XML = SOAP XML Message over HTTP Soap Message: XML: Envelope: Header: Body Server Message sends results back in Body section of SOAP Response
  • 13.
    SOAP Message portions XML DECLARATION: ENVELOPE: Sets up namespace as a SOAP message HEADER(optional must be first if present): Not necessary for Cascade BODY:Actual message to be run FAULT(optional): used for error handling.
  • 14.
    Connection / Authentication Each operation needs to be authenticated using a username and password The operation is then executed as if that User performed the operation in the web UI: Given User is the author of the operation Permissions and abilities are verified Audits are created for that User User must be setup to have the rights to run that operation in Cascade
  • 15.
    Cascade Available operations http://localhost:8080/ws/services/Asset OperationService?wsdl Most frequently used operations: Create Read Edit Delete Copy Read/Edit Access Rights Publish
  • 16.
    Important keywords inWSDL "complexType" and "simpleType”
  • 17.
    Important keywords inWSDL « choice - either element Sequence – order is specific
  • 18.
    Important keywords inWSDL "element" Attributes: "minOccurs", "maxOccurs" and "type" Comments
  • 19.
    Important keywords inWSDL "extension »- More specific information on the operation
  • 20.
    Cascade WSDL parameters Required: xml parentFolderId or parentFolderPath name Optional: expirationFolderId or expirationFolderPath metadataSetId or metadataSetPath Metadata fields (title, displayName, etc.) siteId or siteName
  • 21.
    SOAPUI.org client examples Would you pay $1000? - XML Spy Would you pay $100? Oxygen XML educational price Would What is SOAP UI? Like MS Access for SOAP calls, allows you to generate SQL like calls to a database but SOAP calls to a WSDL http://soapui.org
  • 22.
    Example SOAP Readfolder names message
  • 23.
  • 24.
    Limitations Can’t accesspast versions of assets and drafts Can’t render assets Can’t use tools(Bulk Change) Can’t change preferences Can’t change configuration files Can’t view or interact with publish queue Certain operations can be limited
  • 25.
    Further Reading/Resources ArturTomusiak’s CSUC12 presentation on How to use Web Services(http://www.slideshare.net/hannonhill/artur-tomusiak ) Hannon Hill Github for Web Services(≈) Perl, PHP, Java examples(https://github.com/hannonhill) Wing Ming Chan’s Web Services page: (http://www.upstate.edu/cascade-admin/projects/web-services/ )
  • 26.
    Other WS Presentationsat #CSUC14 Tues 10:15 Leveraging Adminstative Tasks with Web Services - Eric Caraballo Tues 1:30 Ingesting Banner output Schedule Classes into Cascade Server (In Java - Web Services) – Alem Areki Tues 1:30 Web Forms, or How I Learned to Stop Worrying and Love Web Services – Erik Gorka Tues 4:15 Web Services: Encapsulation, Reusability, and Simplicity - Wing Ming Chan
  • 27.
    Questions? @chaoaj –chaoaj@jmu.edu #ws101