1 copyright ©2008 serena software, inc. zmf web services john skelton principal software developer,...

30
1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

Upload: marquez-hurless

Post on 28-Mar-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

1 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

John SkeltonPrincipal Software Developer, Serena

Page 2: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

2 Copyright ©2008 Serena Software, Inc.

ZMF Web Services - Agenda

• Web Services Overview• Web Services Technology• ZMF Web Services Architecture• ZMF Web Services Specifics

Page 3: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

3 Copyright ©2008 Serena Software, Inc.

What are Web Services?

• The W3C definition: “a software system designed to support interoperable machine-to-machine interaction over a network”

• More simply Web Services are just WEB-API’s• Web Services are described by WSDL

• Service Location• Methods• Method Parameters• Parameter Data Types

• Moving towards a universal programming API

Page 4: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

4 Copyright ©2008 Serena Software, Inc.

What are Web Services?

• Application Components• Communicate using open protocols• Self Contained and Self Describing• Discovered using UDDI• Consumed by other applications• XML based

Page 5: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

5 Copyright ©2008 Serena Software, Inc.

How do they work?

• Web Services platform is XML + HTTP• HTTP is most widely used internet protocol

• XML can be used between different platforms and programming languages and still express complex messages and functions.

• Web Services platform elements• SOAP

• UDDI

• WSDL

Page 6: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

6 Copyright ©2008 Serena Software, Inc.

SOAP

• Simple Object Access Protocol • Application communication protocol • Format for sending messages • XML based• Platform independent • Language independent

Page 7: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

7 Copyright ©2008 Serena Software, Inc.

UDDI

• Universal Description Discovery and Integration • Directory for storing information about Web Services • Communicates using SOAP

Page 8: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

8 Copyright ©2008 Serena Software, Inc.

WSDL

• Web Services Description Language • XML document • Where is the Web Service?• What methods are in the Web Service? • What are the Service Parameters

Page 9: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

9 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• ZMF Connect Web Service looks like this:

<service name="ConnectServices">

<port name="Connect" binding="tns:ConnectSOAPBinding">

<soap:address location="http://localhost:7080/zmfws/services/ZMFConnectServices"/>

</port>

</service>

Page 10: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

10 Copyright ©2008 Serena Software, Inc.

ZMF Protocol Evolution

• APPC and TCP/IP• SERENA XChange client

• Proprietary wire protocol

• XML over proprietary wire protocol• ZDD, TeamTrack clients

• Requires SERXMLxx modules

• Still uses proprietary wire protocol

• Web Services• ZMF access using open HTTP/XML protocols

Page 11: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

11 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• Access to all areas of ZMF• Administration API’s - may be read only

• Developer API’s

• Grouped into logical package groups (18)

• Distributed as part of ZMF• Runs on Tomcat Application Server

• Requires AXIS

• Servlet, WSDL, Java Stubs

Page 12: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

12 Copyright ©2008 Serena Software, Inc.

ZMF Web Services - AXIS

• AXIS provides SOAP infrastructure• WSDL2JAVA utility generates JAVA code to access Web

Services• XML documents appear as JAVA objects• Other utilities available for other languages

Page 13: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

13 Copyright ©2008 Serena Software, Inc.

ZMF Web Services - AXIS

• A look at the AXIS generated Web Services Objects

// Create connect logon request.

LogonRequest logonReq = new LogonRequest();

logonReq.setHost(D001.SERENA.COM);

logonReq.setPortid(6611);

logonReq.setUser(WSER27);

logonReq.setPassword(********);

Page 14: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

14 Copyright ©2008 Serena Software, Inc.

ZMF Web Services - AXIS

• The call and the response:

Logon logon = new Logon(logonReq);

Connect.Response connectResponse = null;

connectResponse = binding.logon(logon);

connectResponse.getMessage() == “SER8209I Logon accepted for user WSER27; Local CCSID=00939”

Page 15: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

15 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• Web Service Clients communicate with SERENA Servlet using HTTP/SOAP• JAVA objects

• Servlet extracts SOAP body (XML) and forwards it to ZMF• Servlet receives response from ZMF, wraps response in

SOAP envelope, returns response back to client.

Page 16: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

16 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• ZMFConnectServices• Logon

• Logoff

• Change Password

• Must maintain session state

Page 17: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

17 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• ZMFPackageLifeCycle• Create Package

• Approve

• Demote

• Promote

• Backout

• Freeze

• Revert

Page 18: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

18 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• ZMFPackageInfoManagement• Get Affected Applications

• Get Approvers

• Get Package General Parameters

• Get Implementation

• Get Install Schedule

• Get Library Types

• Get Promotion History

• Get User Variables

Page 19: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

19 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• ZMFComponentLifeCycle• Checkout

• Checkin

• Build

• Recompile

• Relink

• Lock

• Unlock

• Scratch

Page 20: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

20 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• ZMFComponentInfoManagement• Component Change Descriptions

• Component Descriptions

• Component Promotion History

• Component History

Page 21: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

21 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• ZMFChangeLibraryAdmin• Baseline Libraries

• Production Libraries

• Promotion Libraries

• Read Only

Page 22: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

22 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• ZMFDeveloperEnvironmentAdmin• Global Parameters

• Application Parameters

• Global Library Types

• Application Library Types

• Build Procedures

• Read only

Page 23: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

23 Copyright ©2008 Serena Software, Inc.

ZMF Web Services general format

• All Services have request / response elements• Logon Request

• Userid• Password• New Password

• Logon Response• Return code• Reason code• Message

• May return “array” of result elements• Get Application Parms

Page 24: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

24 Copyright ©2008 Serena Software, Inc.

Session State

• ZMF runs multiple transactions over a session• Logon, Checkout, Stage, Build, Promote, Build…

• HTTP is stateless• Problem: How to correlate discrete Web Service requests

with an existing Servlet - ZMF session?• AXIS Session Header

• Retrieve Session Header at completion of Logon Transaction• Set Session Header for all other Soap Bindings.

Page 25: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

25 Copyright ©2008 Serena Software, Inc.

Session State

• Java code generated by AXIS has common Stub• Stub used by Java to access Soap Methods• ZMF Web Services has 18 Stubs• Session Header returned from Connect Service passed to

all other Services• Sample code provided as part of Web Services package

Page 26: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

26 Copyright ©2008 Serena Software, Inc.

Session State – Java Connect// Get the stub which implements the SDI.ConnectServicesLocator csl = new ConnectServicesLocator();binding = (ConnectSOAPBindingStub) csl.getConnect();binding.setMaintainSession(true);

// Create connect logon request.LogonRequest logonReq = new LogonRequest();logonReq.setHost(server.getProperties().getAddress());logonReq.setPortid(server.getPort());logonReq.setUser(username);logonReq.setPassword(password);

// Logon and Get the Responsecom.serena.zmf.webservices.client.internal.Connect.Response connectResponse = null;connectResponse = binding.logon(logon); // store cookiecookie = (String)

binding._getCall().getMessageContext().getProperty(HTTPConstants.HEADER_COOKIE);

Page 27: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

27 Copyright ©2008 Serena Software, Inc.

Session State 2nd Transaction

// Create a new package

public NewPackageResults createPackage(NewPackageRequest request) throws CoreException {NewPackage np = new NewPackage(request);NewPackageResults results = null;

PackageLifeCycleSOAPBindingStub binding = getPackageLifeCycleSOAPBindingStub();

try { results = binding.newPackage(np); } catch (Exception e) { e.printStackTrace(); }

return results;}

Page 28: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

28 Copyright ©2008 Serena Software, Inc.

Session State – 2nd Transaction

// Get PackageLifeCycleSOAPBindingStubprivate PackageLifeCycleSOAPBindingStub getPackageLifeCycleSOAPBindingStub() throws CoreException { PackageLifeCycleSOAPBindingStub binding = null; try { PackageLifeCycleServicesLocator sl = new PackageLifeCycleServicesLocator(); sl.setPackageLifeCycleEndpointAddress(updateURL(sl.getPackageLifeCycleAddress())); binding = (PackageLifeCycleSOAPBindingStub) sl.getPackageLifeCycle(); setCookieAndMaintainSession(binding); } catch (javax.xml.rpc.ServiceException jre) {

throwCoreException(jre); } return binding;}

// Set session cookieprivate void setCookieAndMaintainSession(Stub binding) { binding.setMaintainSession(true); binding._setProperty(HTTPConstants.HEADER_COOKIE, cookie);}

Page 29: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

29 Copyright ©2008 Serena Software, Inc.

ZMF Web Services

• Questions?

Page 30: 1 Copyright ©2008 Serena Software, Inc. ZMF Web Services John Skelton Principal Software Developer, Serena

30 Copyright ©2008 Serena Software, Inc.

Questions