• No results found

rpafi/jl open source Apache Axis2 Web Services 2nd Edition using Apache Axis2 Deepal Jayasinghe Create secure, reliable, and easy-to-use web services

N/A
N/A
Protected

Academic year: 2021

Share "rpafi/jl open source Apache Axis2 Web Services 2nd Edition using Apache Axis2 Deepal Jayasinghe Create secure, reliable, and easy-to-use web services"

Copied!
9
0
0

Loading.... (view fulltext now)

Full text

(1)

Apache

Axis2

Web

Services

2nd Edition

Create

secure,

reliable,

and

easy-to-use

web services

using Apache

Axis2

Deepal

Jayasinghe

Afkham Azeez

rpAfi/jl

open

source

I

I

I

I

community experiencedistilled

v.?

w

PUBLISHING

(2)

Table

of

Contents

Preface 1

Chapter

1:

Apache

Web Services and Axis2 7

Service Oriented Architecture (SOA) 8

Web service overview 10 How do organizations move into webservices? 11 Web services model 12

Web services standards 13

XML-RPC 14

SOAP 14

Web ServicesAddressing

(WS-Addressing)

15 Service description 15 Web Services

Description

Language (WSDL) 16

Web services

lifecycle

16

Apache

Web Service stack 18

WhyAxis2?

19

Downloading and

installing Apache

Axis2 21 Binarydistribution 22 WAR distribution 23 Source distribution 25 Document distribution 25 JARdistribution 25 Summary 26

Chapter

2:

Looking

inside Axis2 27

Axis2 architecture 27

Core modules 28

XML processing model 30

SOAP

processing

model 30

(3)

TableofContents

Deployment

model 33 ClientAPI 34 Transports 36 Other modules 36 Code

generation

37 Data

binding

37

Extensible nature of Axis2 38

Service extension orthe module 38 Custom

deployers

39

Message

receivers 39

Summary

39

Chapter

3: Axis 2 XML Model

(AXIOM)

41

Overview of AXIOM and its features 41

What is pull parsing? 42

Architecture 43

Working

with AXIOM 43

Creating

Axiom 44

CreatingAxiom from an

input

stream 44

CreatingAxiomusing astring 45

CreatingAxiomprogrammatically 46

Adding

child nodes and attributes 47

Working

with OM namespaces 48

Working

with attribute 48

TraversingtheAxiomtree 48

Serialization 49

Advanced operations with Axiom 51

Xpath navigation 51

Accessingthepullparser 52

Axiom and SOAP 52

Summary

54

Chapter

4: Execution Chain 55

Handler 56

Writing a simple handler 57

Phase 58

Types

of

phases

60

Globalphases 60

Operation phases 62

Phase rules 62

Characterizing a phase rule 62

Phasename 63

phaseFirst 63

(4)

before 63

after 64

after and before 64

Invalidphase rules 64

Flow 65

Module engagementand

dynamic

execution chain 66

Special

handlers in the chain 67

Transportreceiver 67

Dispatchers 67

Messagereceiver 68

Transportsender 69

Summary

69

Chapter

5:

Deployment

Model

What is new in Axis2 deployment? 72

Hot

deployment

andhot update 74

Hot

deployment

74

Hot

update

75

Repository

75

Change in the way ofdeploying handlers

(modules)

76 Deployment

descriptors

77

Global

descriptor

or axis2.xml 78

Service

descriptor (services.xml)

78

Module

descriptor

ormodule.xml 79

Available

deployment

options 79

Archive-based

deployment

80

Directory-based deployment

80

Deploying

a service

programmatically

80

POJO

deployment

81

Deploying

and running a service in one line 83

Summary 84

Chapter

6: Information Model 85

Axis2staticdata 86

AxisConfiguration

88

Parameters 89

MessageReceiver 90 MessageFormatters and MessageBuilders 91 TransportReceiverand TransportSender 91

Flows and

phaseOrder

92

AxisModule 93

Service description

hierarchy

94

(5)

TableofContents AxisService 95 AxisOperation 95

AxisMessage

96 Axis2contexts 96 ConfigurationContext 97 ServiceGroupContext 98 ServiceContext 98

OperationContext

98

MessageContext

99 Summary 99

Chapter 7:

Writing

an Axis2 Service 101

Creating aweb service 102 The code firstapproach 104

Single

class POJO approach 104

POJOs with

packages

106

Deploying services

using

a service 108

Writingthe services.xml file 108

Serviceimplementationclass 109

Specifyingthe message receiver 109

Creating a service archive file 110

Different ways of specifying message receivers 110

Service group and

single

service 113

Adding

third-party

resources 114

Service WSDL and schemas 114

Contract firstapproach-starting from the WSDL 116

Generating code 116

Filling

in theservice skeleton 117

Running

the antbuild file 117

Summary 117

Chapter

8:

Writing

anAxis2 Module 119

Brief history of the Axis2 module 120

Module concept 120

Module structure 121 Moduleconfigurationfile(module.xml) 122 Handlers andphaserules 123 Moduleimplementationclass 125

Writing

the module.xml file 128

Deployingandengagingthe module 129

Advanced module.xml 132

(6)

WS-Policy 132

Endpoints 133

Summary

134

Chapter

9: The Client API 135

Webservice client 136

Blocking

and non-blockinginvocation 136

Looking

into Axis2 clientAPI 137

ServiceClientAPI 137 ServiceClient with working samples 140

Working

with the OperationClient 147

Summary

150

Chapter

10: Session Management 151

Stateless natureof Axis2 152 Theavailable type of sessions in Axis2 153

Session

initializing

and session

invalidating

155

Java reflection 155 Usingthe optional interface 156 Accessing

MessageContext

156 Requestsession scope 157

SOAPsession scope 158

Transport

session scope 162

Option

1: Usingthe browser 162

Option

2: Usingthe service client 163

Application scope 163 Managing sessions

using

ServiceClient 164

Summary

164

Chapter

11:

Developing

JAX-WS Web Services 165

Writing

asimpleJAX-WS web service 166

JAX-WS annotations 166 JSR 181

(Web

Service

Metadata)

annotations 167

javax.jws.WebService 167 javax.jws.WebMethod 169 javax.jws.OneWay 170 javax.jws.WebParam 171 name 171 targetNamespace 172 mode 172 header 172 partName 172 javax.jws.WebResult 172 javax.jws.soap.SOAPBinding 174

(7)

TableofContents

JSR 224

(JAX-WS)

annotations 175

javax.xml.ws.BindingType 175

javax.xml.ws.RequestWrapperandjavax.xml.ws.ResponseWrapper 176

javax.xml.ws.ServiceMode 177 javax.xml.ws.WebEndpoint 177 javax.xml.ws.WebFault 178 javax.xml.ws.WebServiceClient 178 javax.xml.ws.WebServiceProvider 179 javax.xml.ws.WebServiceRef 180 JSR 222 (JAXB) annotations 180 javax.xml.bind.annotation.XmlRootElement 181 namespace 181 name 181 javax.xml.bind.annotation.XmlAccessorType 182 javax.xml.bind.annotation.XmlElement 182 name 183 namespace 183 JSR 250(Common Annotations) 183 javax.annotation.Resource 183 javax.annotation. PostConstruct 184

javax.annotation.PreDestroy

184

Code first service developmentwith JAX-WS 185

Contract first

development

with JAX-WS 188

Client-sideJAX-WS 193

TheDispatchclient 194

TheDynamicProxy client 196

MTOM with JAX-WS Services 196

Asynchronous invocation ofJAX-WS services 198

Pollingmodel 198

Callback model 198

Summary 200

Chapter 12; Axis2

Clustering

201

Setting up a

simple

Axis2 cluster 202

Writing

a

highly

available clusterable

web service 203

Stateless Axis2 Web Services 204 Setting up afailover cluster 204 Increasing horizontal

scalability

205 Setting up and

configuring

Axis2 clusters in production 206

Clustering

agent 206

Clustering

agent parameters 206

Avoidlnitiation 207

membershipScheme 207

(8)

of synchronizeAII 208 maxRetries 208 mcastAddress 208 mcastPort 208 mcastFrequency 208 memberDropTime 208 mcastBindAddress 209 localMemberHost 209 localMemberPort 209 preserveMessageOrder 209 atmostOnceMessageSemantics 209 properties 210 State management 210 Node management 211

Group

management 211 Static members 212 Full

configuration

212

Membership

schemes 214 Static membership 214 Dynamic

membership

216 Hybrid

membership

216 Cluster management 218

Highly

available load

balancing

220

TheAxis2 clustering managementAPI 220

org.apache.axis2.clustering.ClusteringAgent

221

org.apache.axis2.clustering.state.StateManager

222

org.apache.axis2.clustering.management.NodeManager

223

org.apache.axis2.clustering.management.GroupManagementAgent

223

Summary

223

Chapter

13: Enterprise

Integration

Patterns 225

Apache Synapse 226

WS02 ESB 227

OpenESB 230

Protocol bridging 230

External authentication and authorization 231 Dynamic

routing

combined with auditing 233 Event DrivenArchitecture (EDA)withMaster Data

Management

(MDM) for

Integrating Legacy

Systems 234

Event DrivenArchitecture (EDA) 234

Master Data

Management (MDM)

235

Adaptor layer 236

Integration server 236

(9)

TableofContents

Registry

237

Push and pull 237

Fault tolerant

autoscaling

with dynamic load balancing 239

References 240

Summary

240

Chapter

14: Axis2Advanced Features and

Usage

243

RepresentationalState Transfer

(REST)

244 Features ofREST 244

REST services in Axis2 244

RESTweb service with GET and POST 245

Message

Transmission Optimization Mechanism

(MTOM)

247

By

value 247

By reference 247

MTOM on the client side 249

MTOM on the service side 250

Axis2

configurator

251

Deploying

Axis2 in various application servers 252

Asynchronous

webservices with Axis2 254

Client side

asynchronous

254 Application-level asynchronous support 257

Transports-level

asynchronous

support

258

Summary

259

Chapter

15: Building a Secure Reliable Web Service 261

Reliableweb services 262

Sampleservice 263

One wayinvocation 264

Request-replyinvocation 266

Managing

sequences 268

Creatingasequence withoutsendinga message 269

Terminateasequence 269

Secure webservices 269

Sampleservice 270

Writingthepasswordcallback 270

Creating

the policyelement 271

Generatingclient stubs 273

Invokingtheservicewithoutsecurity 273

Invokingthe service withsecurity 273

Summary

274

References

Related documents

CIVE 201 (2) Introduction to Problem Solving and Civil Engineering Design Introduction to the design concepts of civil engineering projects including presentations, codes

Health risk behaviors are associated with demographic and job characteristics such as gender, age group, job, or work type (21,22]. Therefore, we need to consider the

Purpose: To evaluate hearing limitations among elderly individuals with moderate to severe sensorineural hearing loss according to the variables educational level and degree of

experiences (i.e., dating relationship, sexual relations, cohabitation, engagement, marriage) and how these vary by age, gender, and nativity; and (b) to examine longitudinally, the

In order to answer the third question, what is the effect the achievement of the school in the Tenth Grade on Enrollment in Hotel Education as explained in

In June 2012, the Pardee Center, with CEDES and GDAE, convened a second Task Force workshop in Buenos Aires specifically to review agreements at the World Trade Organization

Additionally, the FRA position was improved when in 2009 the European Council stressed that the EU institutions should “make full use of FRA’s expertise in devising the

Pelvic floor muscle training versus no treatment, or inactive control treatments, for urinary incontinence in women. Cochrane Database