SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

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