SlideShare uma empresa Scribd logo
1 de 19
JAX-WS
Another Java
Web Services Framework
Overview

Included in Java 6 Standard Edition

Available as download for Java 5

Annotation Based

Tools available for WSDL consumption

Development Approaches

Contract First (Top Down)

Code First (Bottom Up)
WAR Structure
my.war
index.jsp
META-INF
MANIFEST.MF
WEB-INF
classes
com/mypackage/MyClass.class
lib
some.jar
web.xml
sun-jaxws.xml
Web App Config
WEB-INF/web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<listener>
<listenerclass>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>WSServlet</servlet-name>
<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WSServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Web Service Config
1
2
3
4
5
6
7
WEB-INF/sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime'
version='2.0'>
<endpoint name="Hello"
implementation="com.blogspot.weswilliams.hello.ws.Hello"
url-pattern="/Hello" />
</endpoints>
Minimal Service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.blogspot.weswilliams.hello.ws;
import java.util.Date;
import javax.jws.*;
@WebService
public class Hello
{
public Hello()
{
System.out.println(new Date() + " - Ready to Say Hello");
}
public String sayHello(String name)
{
System.out.println(new Date() + " - saying hello to " + name);
return "Hello " + name + "!";
}
}
Minimal SOAP WSDL
<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://ws.hello.weswilliams.blogspot.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://ws.hello.weswilliams.blogspot.com/"
name="HelloService">
<types>
<xsd:schema>
<xsd:import namespace="http://ws.hello.weswilliams.blogspot.com/"
schemaLocation="http://localhost:8080/hello/Hello?xsd=1" />
</xsd:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello" />
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse" />
</message>
<portType name="Hello">
<operation name="sayHello">
<input message="tns:sayHello" />
<output message="tns:sayHelloResponse" />
</operation>
</portType>
<binding name="HelloPortBinding" type="tns:Hello">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="sayHello">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloPort" binding="tns:HelloPortBinding">
<soap:address location="http://localhost:8080/hello/Hello" />
</port>
</service>
</definitions>
Minimal SOAP XSD
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema xmlns:tns="http://ws.hello.weswilliams.blogspot.com/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0"
targetNamespace="http://ws.hello.weswilliams.blogspot.com/">
<xs:element name="sayHello" type="tns:sayHello" />
<xs:element name="sayHelloResponse" type="tns:sayHelloResponse" />
<xs:complexType name="sayHello">
<xs:sequence>
<xs:element name="arg0" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHelloResponse">
<xs:sequence>
<xs:element name="return" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Minimal SOAP Message
Request:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ws="http://ws.hello.weswilliams.blogspot.com/">
<soapenv:Header/>
<soapenv:Body>
<ws:sayHello>
<!--Optional:-->
<arg0>Wes</arg0>
</ws:sayHello>
</soapenv:Body>
</soapenv:Envelope>
Response:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:sayHelloResponse
xmlns:ns2="http://ws.hello.weswilliams.blogspot.com/">
<return>Hello Wes!</return>
</ns2:sayHelloResponse>
</S:Body>
</S:Envelope>
1
2
3
4
5
6
7
8
9
10
11
1
2
3
4
5
6
7
8
Customized Service
Hello.java:
package com.blogspot.weswilliams.hello2.ws;
import javax.jws.*;
@WebService(targetNamespace = "http://wes-williams.blogspot.com/Hi")
public interface Hello
{
@WebResult(name = "sayHiMessage")
@WebMethod(operationName = "sayHi")
public String sayHello(@WebParam(name = "name") String name);
}
1
2
3
4
5
6
7
8
9
10
Customized Implementation
HelloImpl.java:
package com.blogspot.weswilliams.hello2.ws;
import javax.jws.WebService;
import java.util.Date;
@WebService(name = "HiService",
targetNamespace = "http://wes-williams.blogspot.com/Hi",
serviceName = "HiService",
endpointInterface = "com.blogspot.weswilliams.hello2.ws.Hello")
public class HelloImpl implements Hello
{
public HelloImpl()
{
System.out.println(new Date() + " - Ready to Say Hi");
}
public String sayHello(String name)
{
System.out.println(new Date() + " - saying hello to " + name);
return "Hello " + name + "!";
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
Configuration Difference
WEB-INF/sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime'
version='2.0'>
<endpoint name="Hello"
implementation="com.blogspot.weswilliams.hello2.ws.HelloImpl"
url-pattern="/Hello" />
</endpoints>
1
2
3
4
5
6
7
Customized WSDL
<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://wes-williams.blogspot.com/Hi"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://wes-williams.blogspot.com/Hi"
name="HiService">
<types>
<xsd:schema>
<xsd:import namespace="http://wes-williams.blogspot.com/Hi"
schemaLocation="http://localhost:8080/hello/Hello?xsd=1" />
</xsd:schema>
</types>
<message name="sayHi">
<part name="parameters" element="tns:sayHi" />
</message>
<message name="sayHiResponse">
<part name="parameters" element="tns:sayHiResponse" />
</message>
<portType name="HiService">
<operation name="sayHi">
<input message="tns:sayHi" />
<output message="tns:sayHiResponse" />
</operation>
</portType>
<binding name="HiServicePortBinding" type="tns:HiService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="sayHi">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="HiService">
<port name="HiServicePort" binding="tns:HiServicePortBinding">
<soap:address location="http://localhost:8080/hello/Hello" />
</port>
</service>
</definitions>
Customized XSD
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema xmlns:tns="http://wes-williams.blogspot.com/Hi"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0"
targetNamespace="http://wes-williams.blogspot.com/Hi">
<xs:element name="sayHi" type="tns:sayHi" />
<xs:element name="sayHiResponse" type="tns:sayHiResponse" />
<xs:complexType name="sayHi">
<xs:sequence>
<xs:element name="name" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHiResponse">
<xs:sequence>
<xs:element name="sayHiResult" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:schema>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Provide a Custom WSDL
Hello.java:
package com.blogspot.weswilliams.hello2.ws;
import javax.jws.*;
@WebService(name = "HiService",
targetNamespace = "http://wes-williams.blogspot.com/Hi",
wsdlLocation="WEB-INF/wsdl/HiService.wsdl")
public interface Hello
{
@WebResult(name = "sayHiMessage")
@WebMethod(operationName = "sayHi")
public String sayHello(@WebParam(name = "name") String name);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
Custom WSDL
<?xml version='1.0' encoding='UTF-8'?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://wes-williams.blogspot.com/Hi"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://wes-williams.blogspot.com/Hi"
name="HiService">
<types>
<xs:schema xmlns:tns="http://wes-williams.blogspot.com/Hi"
xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"
targetNamespace="http://wes-williams.blogspot.com/Hi">
<xs:element name="sayHi" type="tns:sayHi" />
<xs:element name="sayHiResponse" type="tns:sayHiResponse" />
<xs:complexType name="sayHi">
<xs:sequence>
<xs:element name="name" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="sayHiResponse">
<xs:sequence>
<xs:element name="sayHiMessage" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
. . .
. . .
Customized Messages
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:hi="http://wes-williams.blogspot.com/Hi">
<soapenv:Header/>
<soapenv:Body>
<hi:sayHi>
<name>Wes</name>
</hi:sayHi>
</soapenv:Body>
</soapenv:Envelope>
Response:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:sayHiResponse xmlns:ns2="http://wes-williams.blogspot.com/Hi">
<sayHiMessage>Hi Wes!</sayHiMessage>
</ns2:sayHiResponse>
</S:Body>
</S:Envelope>
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
Client Generation
Generation:
wsimport -keep -p <PACKAGE_FOR_CLIENT> -d <GENERATION_DIRECTORY> <WSDL_URL>
Output:
parsing WSDL...
generating code...
compiling code...
Usage:
import com.blogspot.weswilliams.hello2.ws.client.*;
public class Test
{
public static void main(String[] args)
{
HiService hiClient = new HiService_Service().getHiServicePort();
System.out.println(hiClient.sayHi("Wes"));
}
}
1
2
3
4
5
6
7
8
9
10
More JAX-WS Resources
General:
https://jax-ws.dev.java.net/
http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/
Apache CFX: http://cfx.apache.org
Related Resources: http://soapui.org
Book Recommendation:
O'Reily's Java Web Services: Up and Running
wes-williams.blogspot.com

Mais conteúdo relacionado

Mais procurados

Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with SpringJoshua Long
 
Spring Web Services
Spring Web ServicesSpring Web Services
Spring Web ServicesEmprovise
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods pptkamal kotecha
 
Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtapVikas Jagtap
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jspAnkit Minocha
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)Talha Ocakçı
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsi krishna
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jspJafar Nesargi
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packagesvamsi krishna
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programmingKumar
 
Oracle WebLogic Server 11g for IT OPS
Oracle WebLogic Server 11g for IT OPSOracle WebLogic Server 11g for IT OPS
Oracle WebLogic Server 11g for IT OPSRakesh Gujjarlapudi
 
An Introduction To Java Web Technology
An Introduction To Java Web TechnologyAn Introduction To Java Web Technology
An Introduction To Java Web Technologyvikram singh
 
Java Servlet
Java ServletJava Servlet
Java ServletYoga Raja
 

Mais procurados (20)

Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Multi Client Development with Spring
Multi Client Development with SpringMulti Client Development with Spring
Multi Client Development with Spring
 
Spring Web Services
Spring Web ServicesSpring Web Services
Spring Web Services
 
Java Servlets & JSP
Java Servlets & JSPJava Servlets & JSP
Java Servlets & JSP
 
Java servlet life cycle - methods ppt
Java servlet life cycle - methods pptJava servlet life cycle - methods ppt
Java servlet life cycle - methods ppt
 
Servlet ppt by vikas jagtap
Servlet ppt by vikas jagtapServlet ppt by vikas jagtap
Servlet ppt by vikas jagtap
 
JDBC
JDBCJDBC
JDBC
 
1 java servlets and jsp
1   java servlets and jsp1   java servlets and jsp
1 java servlets and jsp
 
JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)JAVA EE DEVELOPMENT (JSP and Servlets)
JAVA EE DEVELOPMENT (JSP and Servlets)
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
 
JSP Error handling
JSP Error handlingJSP Error handling
JSP Error handling
 
Servlets
ServletsServlets
Servlets
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packages
 
java servlet and servlet programming
java servlet and servlet programmingjava servlet and servlet programming
java servlet and servlet programming
 
Oracle WebLogic Server 11g for IT OPS
Oracle WebLogic Server 11g for IT OPSOracle WebLogic Server 11g for IT OPS
Oracle WebLogic Server 11g for IT OPS
 
An Introduction To Java Web Technology
An Introduction To Java Web TechnologyAn Introduction To Java Web Technology
An Introduction To Java Web Technology
 
Java Servlet
Java ServletJava Servlet
Java Servlet
 

Destaque

Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentationguest0df6b0
 
Web Services - A brief overview
Web Services -  A brief overviewWeb Services -  A brief overview
Web Services - A brief overviewRaveendra Bhat
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Peter R. Egli
 
Implementing Web Services In Java
Implementing Web Services In JavaImplementing Web Services In Java
Implementing Web Services In JavaEdureka!
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
 
Java Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web ServicesJava Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web ServicesIMC Institute
 
Web services - A Practical Approach
Web services - A Practical ApproachWeb services - A Practical Approach
Web services - A Practical ApproachMadhaiyan Muthu
 
Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Martin Necasky
 
Introduction to hibernate
Introduction to hibernateIntroduction to hibernate
Introduction to hibernatehr1383
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To HibernateAmit Himani
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentationguest11106b
 
Webservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and RESTWebservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and RESTPradeep Kumar
 

Destaque (16)

Web Services
Web ServicesWeb Services
Web Services
 
Web Services Tutorial
Web Services TutorialWeb Services Tutorial
Web Services Tutorial
 
Web Service Presentation
Web Service PresentationWeb Service Presentation
Web Service Presentation
 
Web Services - A brief overview
Web Services -  A brief overviewWeb Services -  A brief overview
Web Services - A brief overview
 
Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)Web Services (SOAP, WSDL, UDDI)
Web Services (SOAP, WSDL, UDDI)
 
Hibernate in Action
Hibernate in ActionHibernate in Action
Hibernate in Action
 
Implementing Web Services In Java
Implementing Web Services In JavaImplementing Web Services In Java
Implementing Web Services In Java
 
Java Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and ExampleJava Hibernate Programming with Architecture Diagram and Example
Java Hibernate Programming with Architecture Diagram and Example
 
Java Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web ServicesJava Web Services [1/5]: Introduction to Web Services
Java Web Services [1/5]: Introduction to Web Services
 
Web services - A Practical Approach
Web services - A Practical ApproachWeb services - A Practical Approach
Web services - A Practical Approach
 
Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)Web Services - Architecture and SOAP (part 1)
Web Services - Architecture and SOAP (part 1)
 
Introduction to hibernate
Introduction to hibernateIntroduction to hibernate
Introduction to hibernate
 
Intro To Hibernate
Intro To HibernateIntro To Hibernate
Intro To Hibernate
 
Hibernate Presentation
Hibernate  PresentationHibernate  Presentation
Hibernate Presentation
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Webservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and RESTWebservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and REST
 

Semelhante a JAX-WS Basics

Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleMaven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleNikhil Bhalwankar
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)DK Lee
 
Windows Azure Infrastructure as a Service (IaaS) Avançado
Windows Azure Infrastructure as a Service (IaaS) AvançadoWindows Azure Infrastructure as a Service (IaaS) Avançado
Windows Azure Infrastructure as a Service (IaaS) AvançadoAzure Summit Brasil
 
JBoss AS Upgrade
JBoss AS UpgradeJBoss AS Upgrade
JBoss AS Upgradesharmami
 
SOA with C, C++, PHP and more
SOA with C, C++, PHP and moreSOA with C, C++, PHP and more
SOA with C, C++, PHP and moreWSO2
 
Java EE 02-First Servlet
Java EE 02-First ServletJava EE 02-First Servlet
Java EE 02-First ServletFernando Gil
 
As7 web services - JUG Milan April 2012
As7 web services - JUG Milan April 2012As7 web services - JUG Milan April 2012
As7 web services - JUG Milan April 2012alepalin
 
JUDCon Brazil 2013 - Domain Models with JBoss AS 7
JUDCon Brazil 2013 - Domain Models with JBoss AS 7JUDCon Brazil 2013 - Domain Models with JBoss AS 7
JUDCon Brazil 2013 - Domain Models with JBoss AS 7Samuel Tauil
 
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex HenevaldCloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex Henevaldbuildacloud
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 

Semelhante a JAX-WS Basics (20)

JSF 2.0 Preview
JSF 2.0 PreviewJSF 2.0 Preview
JSF 2.0 Preview
 
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleMaven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
 
Symfony2 revealed
Symfony2 revealedSymfony2 revealed
Symfony2 revealed
 
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
자바 웹 개발 시작하기 (1주차 : 웹 어플리케이션 체험 실습)
 
Introduction to JavaFX
Introduction to JavaFXIntroduction to JavaFX
Introduction to JavaFX
 
Windows Azure Infrastructure as a Service (IaaS) Avançado
Windows Azure Infrastructure as a Service (IaaS) AvançadoWindows Azure Infrastructure as a Service (IaaS) Avançado
Windows Azure Infrastructure as a Service (IaaS) Avançado
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Java Server Faces
Java Server FacesJava Server Faces
Java Server Faces
 
JBoss AS Upgrade
JBoss AS UpgradeJBoss AS Upgrade
JBoss AS Upgrade
 
SOA with C, C++, PHP and more
SOA with C, C++, PHP and moreSOA with C, C++, PHP and more
SOA with C, C++, PHP and more
 
Soap Component
Soap ComponentSoap Component
Soap Component
 
Java EE 02-First Servlet
Java EE 02-First ServletJava EE 02-First Servlet
Java EE 02-First Servlet
 
As7 web services - JUG Milan April 2012
As7 web services - JUG Milan April 2012As7 web services - JUG Milan April 2012
As7 web services - JUG Milan April 2012
 
Node.js vs Play Framework
Node.js vs Play FrameworkNode.js vs Play Framework
Node.js vs Play Framework
 
How to use soap component
How to use soap componentHow to use soap component
How to use soap component
 
Nuxt.js - Introduction
Nuxt.js - IntroductionNuxt.js - Introduction
Nuxt.js - Introduction
 
Java fx
Java fxJava fx
Java fx
 
JUDCon Brazil 2013 - Domain Models with JBoss AS 7
JUDCon Brazil 2013 - Domain Models with JBoss AS 7JUDCon Brazil 2013 - Domain Models with JBoss AS 7
JUDCon Brazil 2013 - Domain Models with JBoss AS 7
 
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex HenevaldCloud Application Blueprints with Apache Brooklyn by Alex Henevald
Cloud Application Blueprints with Apache Brooklyn by Alex Henevald
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 

Último

Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data SciencePaolo Missier
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdfMuhammad Subhan
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireExakis Nelite
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxFIDO Alliance
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?Paolo Missier
 
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial IntelligenceRevolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial IntelligencePrecisely
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfalexjohnson7307
 

Último (20)

Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Introduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptxIntroduction to FIDO Authentication and Passkeys.pptx
Introduction to FIDO Authentication and Passkeys.pptx
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial IntelligenceRevolutionizing SAP® Processes with Automation and Artificial Intelligence
Revolutionizing SAP® Processes with Automation and Artificial Intelligence
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 

JAX-WS Basics

  • 2. Overview  Included in Java 6 Standard Edition  Available as download for Java 5  Annotation Based  Tools available for WSDL consumption  Development Approaches  Contract First (Top Down)  Code First (Bottom Up)
  • 4. Web App Config WEB-INF/web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <listener> <listenerclass> com.sun.xml.ws.transport.http.servlet.WSServletContextListener </listener-class> </listener> <servlet> <servlet-name>WSServlet</servlet-name> <servlet-class> com.sun.xml.ws.transport.http.servlet.WSServlet </servlet-class> </servlet> <servlet-mapping> <servlet-name>WSServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  • 5. Web Service Config 1 2 3 4 5 6 7 WEB-INF/sun-jaxws.xml <?xml version="1.0" encoding="UTF-8"?> <endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'> <endpoint name="Hello" implementation="com.blogspot.weswilliams.hello.ws.Hello" url-pattern="/Hello" /> </endpoints>
  • 6. Minimal Service 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 package com.blogspot.weswilliams.hello.ws; import java.util.Date; import javax.jws.*; @WebService public class Hello { public Hello() { System.out.println(new Date() + " - Ready to Say Hello"); } public String sayHello(String name) { System.out.println(new Date() + " - saying hello to " + name); return "Hello " + name + "!"; } }
  • 7. Minimal SOAP WSDL <?xml version='1.0' encoding='UTF-8'?> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.hello.weswilliams.blogspot.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://ws.hello.weswilliams.blogspot.com/" name="HelloService"> <types> <xsd:schema> <xsd:import namespace="http://ws.hello.weswilliams.blogspot.com/" schemaLocation="http://localhost:8080/hello/Hello?xsd=1" /> </xsd:schema> </types> <message name="sayHello"> <part name="parameters" element="tns:sayHello" /> </message> <message name="sayHelloResponse"> <part name="parameters" element="tns:sayHelloResponse" /> </message> <portType name="Hello"> <operation name="sayHello"> <input message="tns:sayHello" /> <output message="tns:sayHelloResponse" /> </operation> </portType> <binding name="HelloPortBinding" type="tns:Hello"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="sayHello"> <soap:operation soapAction="" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="HelloService"> <port name="HelloPort" binding="tns:HelloPortBinding"> <soap:address location="http://localhost:8080/hello/Hello" /> </port> </service> </definitions>
  • 8. Minimal SOAP XSD <?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:tns="http://ws.hello.weswilliams.blogspot.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://ws.hello.weswilliams.blogspot.com/"> <xs:element name="sayHello" type="tns:sayHello" /> <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" /> <xs:complexType name="sayHello"> <xs:sequence> <xs:element name="arg0" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> <xs:complexType name="sayHelloResponse"> <xs:sequence> <xs:element name="return" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:schema> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
  • 9. Minimal SOAP Message Request: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.hello.weswilliams.blogspot.com/"> <soapenv:Header/> <soapenv:Body> <ws:sayHello> <!--Optional:--> <arg0>Wes</arg0> </ws:sayHello> </soapenv:Body> </soapenv:Envelope> Response: <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:sayHelloResponse xmlns:ns2="http://ws.hello.weswilliams.blogspot.com/"> <return>Hello Wes!</return> </ns2:sayHelloResponse> </S:Body> </S:Envelope> 1 2 3 4 5 6 7 8 9 10 11 1 2 3 4 5 6 7 8
  • 10. Customized Service Hello.java: package com.blogspot.weswilliams.hello2.ws; import javax.jws.*; @WebService(targetNamespace = "http://wes-williams.blogspot.com/Hi") public interface Hello { @WebResult(name = "sayHiMessage") @WebMethod(operationName = "sayHi") public String sayHello(@WebParam(name = "name") String name); } 1 2 3 4 5 6 7 8 9 10
  • 11. Customized Implementation HelloImpl.java: package com.blogspot.weswilliams.hello2.ws; import javax.jws.WebService; import java.util.Date; @WebService(name = "HiService", targetNamespace = "http://wes-williams.blogspot.com/Hi", serviceName = "HiService", endpointInterface = "com.blogspot.weswilliams.hello2.ws.Hello") public class HelloImpl implements Hello { public HelloImpl() { System.out.println(new Date() + " - Ready to Say Hi"); } public String sayHello(String name) { System.out.println(new Date() + " - saying hello to " + name); return "Hello " + name + "!"; } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
  • 12. Configuration Difference WEB-INF/sun-jaxws.xml <?xml version="1.0" encoding="UTF-8"?> <endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'> <endpoint name="Hello" implementation="com.blogspot.weswilliams.hello2.ws.HelloImpl" url-pattern="/Hello" /> </endpoints> 1 2 3 4 5 6 7
  • 13. Customized WSDL <?xml version='1.0' encoding='UTF-8'?> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://wes-williams.blogspot.com/Hi" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://wes-williams.blogspot.com/Hi" name="HiService"> <types> <xsd:schema> <xsd:import namespace="http://wes-williams.blogspot.com/Hi" schemaLocation="http://localhost:8080/hello/Hello?xsd=1" /> </xsd:schema> </types> <message name="sayHi"> <part name="parameters" element="tns:sayHi" /> </message> <message name="sayHiResponse"> <part name="parameters" element="tns:sayHiResponse" /> </message> <portType name="HiService"> <operation name="sayHi"> <input message="tns:sayHi" /> <output message="tns:sayHiResponse" /> </operation> </portType> <binding name="HiServicePortBinding" type="tns:HiService"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="sayHi"> <soap:operation soapAction="" /> <input> <soap:body use="literal" /> </input> <output> <soap:body use="literal" /> </output> </operation> </binding> <service name="HiService"> <port name="HiServicePort" binding="tns:HiServicePortBinding"> <soap:address location="http://localhost:8080/hello/Hello" /> </port> </service> </definitions>
  • 14. Customized XSD <?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:tns="http://wes-williams.blogspot.com/Hi" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://wes-williams.blogspot.com/Hi"> <xs:element name="sayHi" type="tns:sayHi" /> <xs:element name="sayHiResponse" type="tns:sayHiResponse" /> <xs:complexType name="sayHi"> <xs:sequence> <xs:element name="name" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> <xs:complexType name="sayHiResponse"> <xs:sequence> <xs:element name="sayHiResult" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:schema> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
  • 15. Provide a Custom WSDL Hello.java: package com.blogspot.weswilliams.hello2.ws; import javax.jws.*; @WebService(name = "HiService", targetNamespace = "http://wes-williams.blogspot.com/Hi", wsdlLocation="WEB-INF/wsdl/HiService.wsdl") public interface Hello { @WebResult(name = "sayHiMessage") @WebMethod(operationName = "sayHi") public String sayHello(@WebParam(name = "name") String name); } 1 2 3 4 5 6 7 8 9 10 11 12 13
  • 16. Custom WSDL <?xml version='1.0' encoding='UTF-8'?> <definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://wes-williams.blogspot.com/Hi" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://wes-williams.blogspot.com/Hi" name="HiService"> <types> <xs:schema xmlns:tns="http://wes-williams.blogspot.com/Hi" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" targetNamespace="http://wes-williams.blogspot.com/Hi"> <xs:element name="sayHi" type="tns:sayHi" /> <xs:element name="sayHiResponse" type="tns:sayHiResponse" /> <xs:complexType name="sayHi"> <xs:sequence> <xs:element name="name" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="sayHiResponse"> <xs:sequence> <xs:element name="sayHiMessage" type="xs:string" /> </xs:sequence> </xs:complexType> </xs:schema> </types> . . . . . .
  • 17. Customized Messages Request: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:hi="http://wes-williams.blogspot.com/Hi"> <soapenv:Header/> <soapenv:Body> <hi:sayHi> <name>Wes</name> </hi:sayHi> </soapenv:Body> </soapenv:Envelope> Response: <S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> <S:Body> <ns2:sayHiResponse xmlns:ns2="http://wes-williams.blogspot.com/Hi"> <sayHiMessage>Hi Wes!</sayHiMessage> </ns2:sayHiResponse> </S:Body> </S:Envelope> 1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7
  • 18. Client Generation Generation: wsimport -keep -p <PACKAGE_FOR_CLIENT> -d <GENERATION_DIRECTORY> <WSDL_URL> Output: parsing WSDL... generating code... compiling code... Usage: import com.blogspot.weswilliams.hello2.ws.client.*; public class Test { public static void main(String[] args) { HiService hiClient = new HiService_Service().getHiServicePort(); System.out.println(hiClient.sayHi("Wes")); } } 1 2 3 4 5 6 7 8 9 10
  • 19. More JAX-WS Resources General: https://jax-ws.dev.java.net/ http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/ Apache CFX: http://cfx.apache.org Related Resources: http://soapui.org Book Recommendation: O'Reily's Java Web Services: Up and Running wes-williams.blogspot.com