service oriented architecture
Download
Skip this Video
Download Presentation
Service Oriented Architecture

Loading in 2 Seconds...

play fullscreen
1 / 9

Service Oriented Architecture - PowerPoint PPT Presentation


  • 85 Views
  • Uploaded on

Service Oriented Architecture. Lecture 2: JAX-WS 2.0. JAX-WS 2.0. Part of Java EE. New in Java SE 6. API stack for web services. Replaces JAX-RPC. New API’s: JAX-WS, SAAJ, Web Service metadata New packages: javax.xml.ws, javax.xml.soap,javax.jws. Writing A Web Service.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Service Oriented Architecture' - bernie


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
service oriented architecture

Service Oriented Architecture

Lecture 2: JAX-WS 2.0

Master of Information System Management

jax ws 2 0
JAX-WS 2.0
  • Part of Java EE.
  • New in Java SE 6.
  • API stack for web services.
  • Replaces JAX-RPC.
  • New API’s:

JAX-WS, SAAJ, Web Service metadata

  • New packages:

javax.xml.ws, javax.xml.soap,javax.jws

Master of Information System Management

writing a web service
Writing A Web Service

package loanservice;

import javax.jws.WebService;

import javax.jws.WebMethod;

import javax.xml.ws.Endpoint;

@WebService

public class LoanApprover {

@WebMethod

public boolean approve(String name) {

return name.equals("Mike");

}

Master of Information System Management

slide4
public static void main(String[] args){

LoanApprover la = new LoanApprover();

Endpoint endpoint =

Endpoint.publish(

"http://localhost:8080/loanapprover",

la);

}

}

Master of Information System Management

compile the service
Compile The Service

Create a myservice directory.

From the directory just above loanservice, run Java’s

Annotation Processing Tool (APT):

C:\>apt -d myservice loanservice/LoanApprover.java

This populates a directory named myservice.

If you copy these commands from the slides you may

have to retype those strings containing the “-” character.

Master of Information System Management

publish the service
Publish the Service

From a directory just above myservice:

C:\>java -cp myservice loanservice/LoanApprover

To view the WSDL, visit the service with a browser at

http://localhost:8080/loanapprover?wsdl

Master of Information System Management

generate stub code
Generate Stub Code

Make a client directory.

C:\>wsimport –p client –keep http://localhost:8080/loanapprover?wsdl

This populates the client subdirectory with .class

and .java files.

Master of Information System Management

write the client
Write the Client

package client;

class ApproverClient {

public static void main(String args[]){

LoanApproverService service = new LoanApproverService();

LoanApprover approverProxy = service.getLoanApproverPort();

boolean result = approverProxy.approve("Mike");

if(result) System.out.println("Approved");

else System.out.println("Not approved");

}

}

Master of Information System Management

compile run the client
Compile & Run the Client

C:\>javac –cp . client/ApproverClient.java

C:\>java -cp . client/ApproverClient

Approved

Master of Information System Management

ad