SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
Reenabling SOAP using ERJaxWS
Markus Stoll
WebServices using SOAP
• Why SOAP? I do love REST!	

• "Simple Object Access Protocol"
SOAP
• Standardized	

• self defining
JavaWebServices
• known bugs (e. g. problems with https)	

• bugs with mapping of complex data types (uses Axis 1.x)	

• clumsy (Axis 1.x)	

• complicated (Axis 1.x)	

• slow (Axis 1.x)	

• consider it broken
Alternatives?
• AXIS 2
‣ POJO for services and
mapped data	

‣ service definitions in
separate files	

‣ rewritten from scratch	

!
• Jax WS
‣ POJO for services and
mapped data	

‣ all definitions using Java
Annotations	

‣ part of Standard Java!
ERJaxWS
• Jax WS RI Libraries	

• ERJaxWebServiceRequestHandler

adapting WORequest to Jax WS internal engine for handling servlet requests	

• NOT API compatible to JavaWebServices

• provide new SOAP service	

• provide SOAP service based on imported WSDL	

• call external SOAP service based on imported WSDL
Provide own SOAP service - 1
package your.app.ws;	
!
import javax.jws.WebService;	
!
@WebService	
!
public class Calculator {	
!
	 public int add(int a, int b)	
	 {	
	 	 return a + b;	
	 }	
}
Provide own SOAP service - 2
package your.app;	
!
import javax.xml.ws.Endpoint;	
!
import er.extensions.appserver.ERXApplication;	
import er.extensions.appserver.ws.ERJaxWebService;	
import er.extensions.appserver.ws.ERJaxWebServiceRequestHandler;	
!
public class Application extends ERXApplication {	
!
	 public static void main(String[] argv) {	
	 	 ERXApplication.main(argv, Application.class);	
	 }	
!
	 public Application() {	
	 	 setAllowsConcurrentRequestHandling(true);	 	 	
	 	
	 // do it the WONDER way	
	 ERJaxWebServiceRequestHandler wsHandler = new ERJaxWebServiceRequestHandler();	
	 wsHandler.registerWebService("Calculator", new ERJaxWebService<Calculator>(Calculator.class));	
	 this.registerRequestHandler(wsHandler, this.webServiceRequestHandlerKey());	
!
	 // create a standalone endpoint using Jax WS mechanisms	
	 Endpoint.publish("http://localhost:9999/ws/Calculator", new Calculator());	
!
	 }	
}
Provide own SOAP service - 3	

!
LIVE-DEMO
Provide SOAP service based on WSDL
// Import WSDL and create interface and classes for mapped data	
$ wsimport -keep -s Sources http://localhost:port/cgi-bin/WebObjects/WebService1.woa/ws/Calculator?wsdl	
!
// Import WSDL and create jar	
$ wsimport -clientjar Libraries/myservice.jar http://localhost:port/cgi-bin/WebObjects/WebService1.woa/ws/Calculator?wsdl	
!
!
!
// create CalculatorImplementation	
package your.app;	
!
import javax.jws.WebService;	
!
@WebService(endpointInterface = "your.app.Calculator")	
!
public class CalculatorImpl implements Calculator	
{	
!
	 @Override	
	 public int add(int arg0, int arg1) {	
	 	 return arg0 + arg1;	
	 }	
!
}
Provide SOAP service based on WSDL 	

!
LIVE-DEMO
Java Annotations / WebService
• @WebService	

 	

 	

 name, namespace, service interface	

• @BindingType	

 	

 	

 SOAP version	

• @SOAPBinding	

	

 	

 WSDL document styles	

• @WebMethod	

	

 	

 name, exclusion	

• @WebParam	

 	

 	

 name	

• @WebResult	

 	

 	

 name
Call a remote SOAP service
	 	 URL url = new URL("http://127.0.0.1:3333/cgi-bin/WebObjects/JaxServerTest.woa/ws/Hello?wsdl");	
!
	 	 // 1st argument service URI, refer to wsdl document above	
	 	 // 2nd argument is service name, refer to wsdl document above	
	 	 QName qname = new QName("http://app.your/", "HelloImplService");	
!
	 	 Service service = Service.create(url, qname);	
!
	 	 Hello remoteHello = service.getPort(Hello.class);	
!
	 	 remoteHello.hello("Jon Doe“);	
!
!
!
	 	 // BETTER: use imported interface	
!
	 	 HelloImplService service = new HelloImplService(url);	
!
	 	 Hello remoteHello = service.getPort(Hello.class);	
!
	 	 remoteHello.hello("Jon Doe“);	
!
Data mapping
• JAXB	

• all native Java data types	

• all "Bean" classes	

• custom type adaptors
custom data mapping - 1
!
!
!
public class WSStruct 	
{	
!
public String name;	
!
public int zip;	
!
public MyCustomDate myDate;	
	
!
public NSTimestamp datetime;	
}
custom data mapping - 2
@XmlType(name = "WSStructType", propOrder = {"name", "zip", "datetime"})	
@XmlAccessorType(value = XmlAccessType.PUBLIC_MEMBER)	
!
public class WSStruct 	
{	
@XmlElement	
public String name;	
@XmlAttribute	
public int zip;	
@XmlTransient	
public MyCustomDate myDate;	
	
!
public NSTimestamp datetime;	
}
custom data mapping - 3
@XmlType(name = "WSStructType", propOrder = {"name", "zip", "datetime"})	
@XmlAccessorType(value = XmlAccessType.PUBLIC_MEMBER)	
!
public class WSStruct 	
{	
@XmlElement	
public String name;	
@XmlAttribute	
public int zip;	
@XmlTransient	
public MyCustomDate myDate;	
	
@XmlJavaTypeAdapter(value = NSTimestampAdapter.class)	
public NSTimestamp datetime;	
}	
class NSTimestampAdapter extends XmlAdapter<String, NSTimestamp>	
{	
private final NSTimestampFormatter formatter = new NSTimestampFormatter();	
public NSTimestamp unmarshal(String v) throws Exception {	
return (NSTimestamp) formatter.parseObject(v);	
}	
public String marshal(NSTimestamp v) throws Exception {	
return formatter.format(v);	
}	
}
Data mapping
• Directly map EOs? NO!	

• might change	

• would need to adapt your EO templates	

• avoid marshalling your complete data tree
WebFaults
• WebServices exceptions can be defined as WebFaults	

• Beware: serialized info is not in Exception but in a referred
WebFault bean	

• stack traces possible 

switch off with property

com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace=false
WebFault sample
@WebFault(faultBean = "TestServiceFaultInfo")	
public class TestServiceException extends Exception 	
{	
	 private TestServiceFaultInfo code;	
	 	
	 public TestServiceException(String message, TestServiceFaultInfo info) {	
	 	 super(message);	
	 	 this.code = info;	
	 }	
	 	
	 public TestServiceFaultInfo getFaultInfo() {	
	 	 return code;	
	 }	
}	
!
public class TestServiceFaultInfo 	
{	
	 public String msg;	
!
	 public TestServiceFaultInfo() {	
	 }	
!
	 public TestServiceFaultInfo(String msg) {	
	 	 this.msg = msg;	
	 }	
}
Stateful Services
• @Stateful - makes no sense in WebObjects env	

• Jax WS injects a RequestContext into your Service object	

• gives access to WOContext and by that to your Session	

• creates WebObjects Cookies as usual	

• enable session persistence in your client proxy
Stateful Services	

!
LIVE-DEMO
Secure WebServices
• basic auth by common means	

• create your own custom ERJaxWebService	

• @SOAPMessageHandler



declare your own Jax WS message handlers

for example for handling signed SOAP messages
Troubleshooting
• Test-Tools	

• SoapUI	

• http://wsdlbrowser.com	

• test against original javax.xml.ws.Endpoint	

• compare imported WSDL vs. recreated WSDL
Resources
• https://github.com/markusstoll/wonder/tree/ERJaxWS	

• https://jax-ws.java.net	

• http://www.techferry.com/articles/jaxb-annotations.html
Q&A
Markus Stoll	

junidas GmbH	

markus.stoll@junidas.de

Contenu connexe

Tendances

Building Distributed Systems in Scala
Building Distributed Systems in ScalaBuilding Distributed Systems in Scala
Building Distributed Systems in ScalaAlex Payne
 
Scala.js: Next generation front end development in Scala
Scala.js:  Next generation front end development in ScalaScala.js:  Next generation front end development in Scala
Scala.js: Next generation front end development in ScalaOtto Chrons
 
Introduction to rx java for android
Introduction to rx java for androidIntroduction to rx java for android
Introduction to rx java for androidEsa Firman
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomáš Kypta
 
Arquitetando seu app Android com Jetpack
Arquitetando seu app Android com JetpackArquitetando seu app Android com Jetpack
Arquitetando seu app Android com JetpackNelson Glauber Leal
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at TwitterAlex Payne
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on AndroidTomáš Kypta
 
Functional Reactive Programming (CocoaHeads Bratislava)
Functional Reactive Programming (CocoaHeads Bratislava)Functional Reactive Programming (CocoaHeads Bratislava)
Functional Reactive Programming (CocoaHeads Bratislava)Michal Grman
 
Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaKros Huang
 
Akka persistence == event sourcing in 30 minutes
Akka persistence == event sourcing in 30 minutesAkka persistence == event sourcing in 30 minutes
Akka persistence == event sourcing in 30 minutesKonrad Malawski
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJavaJobaer Chowdhury
 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Konrad Malawski
 
Scala.js - yet another what..?
Scala.js - yet another what..?Scala.js - yet another what..?
Scala.js - yet another what..?Artur Skowroński
 
Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014Björn Antonsson
 
RxJava 2.0 介紹
RxJava 2.0 介紹RxJava 2.0 介紹
RxJava 2.0 介紹Kros Huang
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomáš Kypta
 
Intro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidIntro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidEgor Andreevich
 
Using akka streams to access s3 objects
Using akka streams to access s3 objectsUsing akka streams to access s3 objects
Using akka streams to access s3 objectsMikhail Girkin
 
Scaling an ELK stack at bol.com
Scaling an ELK stack at bol.comScaling an ELK stack at bol.com
Scaling an ELK stack at bol.comRenzo Tomà
 

Tendances (20)

Building Distributed Systems in Scala
Building Distributed Systems in ScalaBuilding Distributed Systems in Scala
Building Distributed Systems in Scala
 
Clojure & Scala
Clojure & ScalaClojure & Scala
Clojure & Scala
 
Scala.js: Next generation front end development in Scala
Scala.js:  Next generation front end development in ScalaScala.js:  Next generation front end development in Scala
Scala.js: Next generation front end development in Scala
 
Introduction to rx java for android
Introduction to rx java for androidIntroduction to rx java for android
Introduction to rx java for android
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Arquitetando seu app Android com Jetpack
Arquitetando seu app Android com JetpackArquitetando seu app Android com Jetpack
Arquitetando seu app Android com Jetpack
 
The Why and How of Scala at Twitter
The Why and How of Scala at TwitterThe Why and How of Scala at Twitter
The Why and How of Scala at Twitter
 
Reactive programming on Android
Reactive programming on AndroidReactive programming on Android
Reactive programming on Android
 
Functional Reactive Programming (CocoaHeads Bratislava)
Functional Reactive Programming (CocoaHeads Bratislava)Functional Reactive Programming (CocoaHeads Bratislava)
Functional Reactive Programming (CocoaHeads Bratislava)
 
Rxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJavaRxjava 介紹與 Android 中的 RxJava
Rxjava 介紹與 Android 中的 RxJava
 
Akka persistence == event sourcing in 30 minutes
Akka persistence == event sourcing in 30 minutesAkka persistence == event sourcing in 30 minutes
Akka persistence == event sourcing in 30 minutes
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJava
 
Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014Reactive Streams / Akka Streams - GeeCON Prague 2014
Reactive Streams / Akka Streams - GeeCON Prague 2014
 
Scala.js - yet another what..?
Scala.js - yet another what..?Scala.js - yet another what..?
Scala.js - yet another what..?
 
Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014Resilient Applications with Akka Persistence - Scaladays 2014
Resilient Applications with Akka Persistence - Scaladays 2014
 
RxJava 2.0 介紹
RxJava 2.0 介紹RxJava 2.0 介紹
RxJava 2.0 介紹
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
Intro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich AndroidIntro to RxJava/RxAndroid - GDG Munich Android
Intro to RxJava/RxAndroid - GDG Munich Android
 
Using akka streams to access s3 objects
Using akka streams to access s3 objectsUsing akka streams to access s3 objects
Using akka streams to access s3 objects
 
Scaling an ELK stack at bol.com
Scaling an ELK stack at bol.comScaling an ELK stack at bol.com
Scaling an ELK stack at bol.com
 

En vedette

D2W Stateful Controllers
D2W Stateful ControllersD2W Stateful Controllers
D2W Stateful ControllersWO Community
 
Migrating existing Projects to Wonder
Migrating existing Projects to WonderMigrating existing Projects to Wonder
Migrating existing Projects to WonderWO Community
 
Filtering data with D2W
Filtering data with D2W Filtering data with D2W
Filtering data with D2W WO Community
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache CayenneWO Community
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative versionWO Community
 
Build and deployment
Build and deploymentBuild and deployment
Build and deploymentWO Community
 
Chaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real WorldChaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real WorldWO Community
 
Unit Testing with WOUnit
Unit Testing with WOUnitUnit Testing with WOUnit
Unit Testing with WOUnitWO Community
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO DevsWO Community
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsWO Community
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on WindowsWO Community
 
"Framework Principal" pattern
"Framework Principal" pattern"Framework Principal" pattern
"Framework Principal" patternWO Community
 
In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engineWO Community
 

En vedette (18)

D2W Stateful Controllers
D2W Stateful ControllersD2W Stateful Controllers
D2W Stateful Controllers
 
iOS for ERREST
iOS for ERRESTiOS for ERREST
iOS for ERREST
 
Migrating existing Projects to Wonder
Migrating existing Projects to WonderMigrating existing Projects to Wonder
Migrating existing Projects to Wonder
 
Filtering data with D2W
Filtering data with D2W Filtering data with D2W
Filtering data with D2W
 
Advanced Apache Cayenne
Advanced Apache CayenneAdvanced Apache Cayenne
Advanced Apache Cayenne
 
WOver
WOverWOver
WOver
 
iOS for ERREST - alternative version
iOS for ERREST - alternative versioniOS for ERREST - alternative version
iOS for ERREST - alternative version
 
Build and deployment
Build and deploymentBuild and deployment
Build and deployment
 
Life outside WO
Life outside WOLife outside WO
Life outside WO
 
Chaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real WorldChaining the Beast - Testing Wonder Applications in the Real World
Chaining the Beast - Testing Wonder Applications in the Real World
 
Unit Testing with WOUnit
Unit Testing with WOUnitUnit Testing with WOUnit
Unit Testing with WOUnit
 
Apache Cayenne for WO Devs
Apache Cayenne for WO DevsApache Cayenne for WO Devs
Apache Cayenne for WO Devs
 
Using Nagios to monitor your WO systems
Using Nagios to monitor your WO systemsUsing Nagios to monitor your WO systems
Using Nagios to monitor your WO systems
 
High availability
High availabilityHigh availability
High availability
 
KAAccessControl
KAAccessControlKAAccessControl
KAAccessControl
 
Deploying WO on Windows
Deploying WO on WindowsDeploying WO on Windows
Deploying WO on Windows
 
"Framework Principal" pattern
"Framework Principal" pattern"Framework Principal" pattern
"Framework Principal" pattern
 
In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engine
 

Similaire à Reenabling SOAP using ERJaxWS

Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSam Brannen
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jerseyb_kathir
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serializationGWTcon
 
Jax ws
Jax wsJax ws
Jax wsF K
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationStuart (Pid) Williams
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WSIndicThreads
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceSachin Aggarwal
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RSFahad Golra
 
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...DataStax Academy
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An IntroductionThorsten Kamann
 
Soa 12 jax ws-xml Java API for web services
Soa 12 jax ws-xml Java API for web servicesSoa 12 jax ws-xml Java API for web services
Soa 12 jax ws-xml Java API for web servicesVaibhav Khanna
 
Java EE 7, what's in it for me?
Java EE 7, what's in it for me?Java EE 7, what's in it for me?
Java EE 7, what's in it for me?Alex Soto
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajaxNir Elbaz
 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITCarol McDonald
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
Java Web services
Java Web servicesJava Web services
Java Web servicesSujit Kumar
 
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...Christian Tzolov
 
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWeare-Legion
 

Similaire à Reenabling SOAP using ERJaxWS (20)

Spring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. RESTSpring Web Services: SOAP vs. REST
Spring Web Services: SOAP vs. REST
 
Developing RESTful WebServices using Jersey
Developing RESTful WebServices using JerseyDeveloping RESTful WebServices using Jersey
Developing RESTful WebServices using Jersey
 
GWT Web Socket and data serialization
GWT Web Socket and data serializationGWT Web Socket and data serialization
GWT Web Socket and data serialization
 
Ntg web services
Ntg   web servicesNtg   web services
Ntg web services
 
Jax ws
Jax wsJax ws
Jax ws
 
Groovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentationGroovy & Grails eXchange 2012 vert.x presentation
Groovy & Grails eXchange 2012 vert.x presentation
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
 
Apache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault ToleranceApache Spark Streaming: Architecture and Fault Tolerance
Apache Spark Streaming: Architecture and Fault Tolerance
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RS
 
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
London Cassandra Meetup 10/23: Apache Cassandra at British Gas Connected Home...
 
Spring 3 - An Introduction
Spring 3 - An IntroductionSpring 3 - An Introduction
Spring 3 - An Introduction
 
Soa 12 jax ws-xml Java API for web services
Soa 12 jax ws-xml Java API for web servicesSoa 12 jax ws-xml Java API for web services
Soa 12 jax ws-xml Java API for web services
 
Java EE 7, what's in it for me?
Java EE 7, what's in it for me?Java EE 7, what's in it for me?
Java EE 7, what's in it for me?
 
Introduction to ajax
Introduction to ajaxIntroduction to ajax
Introduction to ajax
 
Interoperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSITInteroperable Web Services with JAX-WS and WSIT
Interoperable Web Services with JAX-WS and WSIT
 
Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
Not your Grandma's XQuery
Not your Grandma's XQueryNot your Grandma's XQuery
Not your Grandma's XQuery
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
 
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
«ReactiveCocoa и MVVM» — Николай Касьянов, SoftWear
 

Plus de WO Community

Localizing your apps for multibyte languages
Localizing your apps for multibyte languagesLocalizing your apps for multibyte languages
Localizing your apps for multibyte languagesWO Community
 
D2W Branding Using jQuery ThemeRoller
D2W Branding Using jQuery ThemeRollerD2W Branding Using jQuery ThemeRoller
D2W Branding Using jQuery ThemeRollerWO Community
 
CMS / BLOG and SnoWOman
CMS / BLOG and SnoWOmanCMS / BLOG and SnoWOman
CMS / BLOG and SnoWOmanWO Community
 
Persistent Session Storage
Persistent Session StoragePersistent Session Storage
Persistent Session StorageWO Community
 
WebObjects Optimization
WebObjects OptimizationWebObjects Optimization
WebObjects OptimizationWO Community
 
ERRest: the Basics
ERRest: the BasicsERRest: the Basics
ERRest: the BasicsWO Community
 

Plus de WO Community (12)

Localizing your apps for multibyte languages
Localizing your apps for multibyte languagesLocalizing your apps for multibyte languages
Localizing your apps for multibyte languages
 
WOdka
WOdkaWOdka
WOdka
 
ERGroupware
ERGroupwareERGroupware
ERGroupware
 
D2W Branding Using jQuery ThemeRoller
D2W Branding Using jQuery ThemeRollerD2W Branding Using jQuery ThemeRoller
D2W Branding Using jQuery ThemeRoller
 
CMS / BLOG and SnoWOman
CMS / BLOG and SnoWOmanCMS / BLOG and SnoWOman
CMS / BLOG and SnoWOman
 
Using GIT
Using GITUsing GIT
Using GIT
 
Persistent Session Storage
Persistent Session StoragePersistent Session Storage
Persistent Session Storage
 
Back2 future
Back2 futureBack2 future
Back2 future
 
WebObjects Optimization
WebObjects OptimizationWebObjects Optimization
WebObjects Optimization
 
Dynamic Elements
Dynamic ElementsDynamic Elements
Dynamic Elements
 
Practical ERSync
Practical ERSyncPractical ERSync
Practical ERSync
 
ERRest: the Basics
ERRest: the BasicsERRest: the Basics
ERRest: the Basics
 

Dernier

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 

Dernier (20)

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

Reenabling SOAP using ERJaxWS

  • 1. Reenabling SOAP using ERJaxWS Markus Stoll
  • 2. WebServices using SOAP • Why SOAP? I do love REST! • "Simple Object Access Protocol"
  • 4. JavaWebServices • known bugs (e. g. problems with https) • bugs with mapping of complex data types (uses Axis 1.x) • clumsy (Axis 1.x) • complicated (Axis 1.x) • slow (Axis 1.x) • consider it broken
  • 5. Alternatives? • AXIS 2 ‣ POJO for services and mapped data ‣ service definitions in separate files ‣ rewritten from scratch ! • Jax WS ‣ POJO for services and mapped data ‣ all definitions using Java Annotations ‣ part of Standard Java!
  • 6. ERJaxWS • Jax WS RI Libraries • ERJaxWebServiceRequestHandler
 adapting WORequest to Jax WS internal engine for handling servlet requests • NOT API compatible to JavaWebServices
 • provide new SOAP service • provide SOAP service based on imported WSDL • call external SOAP service based on imported WSDL
  • 7. Provide own SOAP service - 1 package your.app.ws; ! import javax.jws.WebService; ! @WebService ! public class Calculator { ! public int add(int a, int b) { return a + b; } }
  • 8. Provide own SOAP service - 2 package your.app; ! import javax.xml.ws.Endpoint; ! import er.extensions.appserver.ERXApplication; import er.extensions.appserver.ws.ERJaxWebService; import er.extensions.appserver.ws.ERJaxWebServiceRequestHandler; ! public class Application extends ERXApplication { ! public static void main(String[] argv) { ERXApplication.main(argv, Application.class); } ! public Application() { setAllowsConcurrentRequestHandling(true); // do it the WONDER way ERJaxWebServiceRequestHandler wsHandler = new ERJaxWebServiceRequestHandler(); wsHandler.registerWebService("Calculator", new ERJaxWebService<Calculator>(Calculator.class)); this.registerRequestHandler(wsHandler, this.webServiceRequestHandlerKey()); ! // create a standalone endpoint using Jax WS mechanisms Endpoint.publish("http://localhost:9999/ws/Calculator", new Calculator()); ! } }
  • 9. Provide own SOAP service - 3 ! LIVE-DEMO
  • 10. Provide SOAP service based on WSDL // Import WSDL and create interface and classes for mapped data $ wsimport -keep -s Sources http://localhost:port/cgi-bin/WebObjects/WebService1.woa/ws/Calculator?wsdl ! // Import WSDL and create jar $ wsimport -clientjar Libraries/myservice.jar http://localhost:port/cgi-bin/WebObjects/WebService1.woa/ws/Calculator?wsdl ! ! ! // create CalculatorImplementation package your.app; ! import javax.jws.WebService; ! @WebService(endpointInterface = "your.app.Calculator") ! public class CalculatorImpl implements Calculator { ! @Override public int add(int arg0, int arg1) { return arg0 + arg1; } ! }
  • 11. Provide SOAP service based on WSDL ! LIVE-DEMO
  • 12. Java Annotations / WebService • @WebService name, namespace, service interface • @BindingType SOAP version • @SOAPBinding WSDL document styles • @WebMethod name, exclusion • @WebParam name • @WebResult name
  • 13. Call a remote SOAP service URL url = new URL("http://127.0.0.1:3333/cgi-bin/WebObjects/JaxServerTest.woa/ws/Hello?wsdl"); ! // 1st argument service URI, refer to wsdl document above // 2nd argument is service name, refer to wsdl document above QName qname = new QName("http://app.your/", "HelloImplService"); ! Service service = Service.create(url, qname); ! Hello remoteHello = service.getPort(Hello.class); ! remoteHello.hello("Jon Doe“); ! ! ! // BETTER: use imported interface ! HelloImplService service = new HelloImplService(url); ! Hello remoteHello = service.getPort(Hello.class); ! remoteHello.hello("Jon Doe“); !
  • 14. Data mapping • JAXB • all native Java data types • all "Bean" classes • custom type adaptors
  • 15. custom data mapping - 1 ! ! ! public class WSStruct { ! public String name; ! public int zip; ! public MyCustomDate myDate; ! public NSTimestamp datetime; }
  • 16. custom data mapping - 2 @XmlType(name = "WSStructType", propOrder = {"name", "zip", "datetime"}) @XmlAccessorType(value = XmlAccessType.PUBLIC_MEMBER) ! public class WSStruct { @XmlElement public String name; @XmlAttribute public int zip; @XmlTransient public MyCustomDate myDate; ! public NSTimestamp datetime; }
  • 17. custom data mapping - 3 @XmlType(name = "WSStructType", propOrder = {"name", "zip", "datetime"}) @XmlAccessorType(value = XmlAccessType.PUBLIC_MEMBER) ! public class WSStruct { @XmlElement public String name; @XmlAttribute public int zip; @XmlTransient public MyCustomDate myDate; @XmlJavaTypeAdapter(value = NSTimestampAdapter.class) public NSTimestamp datetime; } class NSTimestampAdapter extends XmlAdapter<String, NSTimestamp> { private final NSTimestampFormatter formatter = new NSTimestampFormatter(); public NSTimestamp unmarshal(String v) throws Exception { return (NSTimestamp) formatter.parseObject(v); } public String marshal(NSTimestamp v) throws Exception { return formatter.format(v); } }
  • 18. Data mapping • Directly map EOs? NO! • might change • would need to adapt your EO templates • avoid marshalling your complete data tree
  • 19. WebFaults • WebServices exceptions can be defined as WebFaults • Beware: serialized info is not in Exception but in a referred WebFault bean • stack traces possible 
 switch off with property
 com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace=false
  • 20. WebFault sample @WebFault(faultBean = "TestServiceFaultInfo") public class TestServiceException extends Exception { private TestServiceFaultInfo code; public TestServiceException(String message, TestServiceFaultInfo info) { super(message); this.code = info; } public TestServiceFaultInfo getFaultInfo() { return code; } } ! public class TestServiceFaultInfo { public String msg; ! public TestServiceFaultInfo() { } ! public TestServiceFaultInfo(String msg) { this.msg = msg; } }
  • 21. Stateful Services • @Stateful - makes no sense in WebObjects env • Jax WS injects a RequestContext into your Service object • gives access to WOContext and by that to your Session • creates WebObjects Cookies as usual • enable session persistence in your client proxy
  • 23. Secure WebServices • basic auth by common means • create your own custom ERJaxWebService • @SOAPMessageHandler
 
 declare your own Jax WS message handlers
 for example for handling signed SOAP messages
  • 24. Troubleshooting • Test-Tools • SoapUI • http://wsdlbrowser.com • test against original javax.xml.ws.Endpoint • compare imported WSDL vs. recreated WSDL