View Full Document

5 views

Unformatted text preview:

JDK 6 Web Services Week 4 JAX WS 2 0 95 804 Applied Cryptography Master of Information System Management 1 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 95 804 Applied Cryptography Master of Information System Management 2 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 95 804 Applied Cryptography Master of Information System Management 3 public static void main String args LoanApprover la new LoanApprover Endpoint endpoint Endpoint publish http localhost 8080 loanapprover la 95 804 Applied Cryptography Master of Information System Management 4 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 The directory holds the compiled package as well as a new directory package called jaxws The new jaxws package holds classes associated with the parameters to and from each web service method Use the s switch to generate the source code 95 804 Applied Cryptography Master of Information System Management 5 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 95 804 Applied Cryptography Master of Information System Management 6 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 95 804 Applied Cryptography Master of Information System Management 7 Write the Client package client class ApproverClient public static void main String args



Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view JDK 6 Web Services and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view JDK 6 Web Services and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?