Talend ESB Service Developer Guide
Total Page:16
File Type:pdf, Size:1020Kb
Talend ESB Service Developer Guide 6.5.1 Talend ESB Service Adapted for v6.5.1. Supersedes previous releases. Publication date: January 18, 2018 Copyright © 2018 Talend Inc. All rights reserved. Copyleft This documentation is provided under the terms of the Creative Commons Public License (CCPL). For more information about what you can and cannot do with this documentation in accordance with the CCPL, please read: http://creativecommons.org/licenses/by-nc-sa/2.0/ This document may include documentation produced at The Apache Software Foundation which is licensed under The Apache License 2.0. Notices Talend and Talend ESB are trademarks of Talend, Inc. Apache CXF, CXF, Apache Karaf, Karaf, Apache Cellar, Cellar, Apache Camel, Camel, Apache Maven, Maven, Apache Archiva, Archiva, Apache Syncope, Syncope, Apache ActiveMQ, ActiveMQ, Apache Log4j, Log4j, Apache Felix, Felix, Apache ServiceMix, ServiceMix, Apache Ant, Ant, Apache Derby, Derby, Apache Tomcat, Tomcat, Apache ZooKeeper, ZooKeeper, Apache Jackrabbit, Jackrabbit, Apache Santuario, Santuario, Apache DS, DS, Apache Avro, Avro, Apache Abdera, Abdera, Apache Chemistry, Chemistry, Apache CouchDB, CouchDB, Apache Kafka, Kafka, Apache Lucene, Lucene, Apache MINA, MINA, Apache Velocity, Velocity, Apache FOP, FOP, Apache HBase, HBase, Apache Hadoop, Hadoop, Apache Shiro, Shiro, Apache Axiom, Axiom, Apache Neethi, Neethi, Apache WSS4J, WSS4J are trademarks of The Apache Foundation. Eclipse Equinox is a trademark of the Eclipse Foundation, Inc. SoapUI is a trademark of SmartBear Software. Hyperic is a trademark of VMware, Inc. Nagios is a trademark of Nagios Enterprises, LLC. All other brands, product names, company names, trademarks and service marks are the properties of their respective owners. This product includes software developed at AOP Alliance (Java/J2EE AOP standards), ASM, AntlR, Apache ActiveMQ, Apache Ant, Apache Avro, Apache Axiom, Apache Axis, Apache Axis 2, Apache Batik, Apache CXF, Apache Camel, Apache Chemistry, Apache Common Http Client, Apache Common Http Core, Apache Commons, Apache Commons Bcel, Apache Commons JxPath, Apache Commons Lang, Apache Derby Database Engine and Embedded JDBC Driver, Apache Geronimo, Apache Hadoop, Apache Hive, Apache HttpClient, Apache HttpComponents Client, Apache JAMES, Apache Log4j, Apache Lucene Core, Apache Neethi, Apache POI, Apache Pig, Apache Qpid-Jms, Apache Tomcat, Apache Velocity, Apache WSS4J, Apache WebServices Common Utilities, Apache Xml-RPC, Apache Zookeeper, Box Java SDK (V2), CSV Tools, DataStax Java Driver for Apache Cassandra, Ehcache, Ezmorph, Ganymed SSH-2 for Java, Google APIs Client Library for Java, Google Gson, Groovy, Guava: Google Core Libraries for Java, H2 Embedded Database and JDBC Driver, HsqlDB, Ini4j, JClouds, JLine, JSON, JSR 305: Annotations for Software Defect Detection in Java, JUnit, Jackson Java JSON-processor, Java API for RESTful Services, Jaxb, Jaxen, Jettison, Jetty, Joda-Time, Json Simple, MetaStuff, Mondrian, OpenSAML, Paraccel JDBC Driver, PostgreSQL JDBC Driver, Resty: A simple HTTP REST client for Java, Rocoto, SL4J: Simple Logging Facade for Java, SQLite JDBC Driver, Simple API for CSS, SshJ, StAX API, StAXON - JSON via StAX, Talend Camel Dependencies (Talend), The Castor Project, The Legion of the Bouncy Castle, W3C, Woden, Woodstox : High-performance XML processor, XML Pull Parser (XPP), Xalan- J, Xerces2, XmlBeans, XmlSchema Core, Xmlsec - Apache Santuario, Zip4J, atinject, dropbox-sdk-java: Java library for the Dropbox Core API, google-guice. Licensed under their respective license. 3.1. Root Resources and Sub Resources ...... 148 Table of Contents 3.2. Path, HTTP Method and MediaType annotations ..................................... 149 Chapter 1. Introduction to Service 3.3. Request Message, Parameters and Creation with Talend ESB ...................... 1 Contexts ........................................ 150 Chapter 2. JAX-WS Development ............ 3 3.4. Responses from Resource Methods ...... 151 2.1. JAX-WS Overview .......................... 4 3.5. Exception Handling ....................... 151 2.1.1. Spring Integration ................... 4 3.6. Custom JAX-RS Providers ............... 152 2.1.2. Transports ........................... 4 3.7. Client API ................................. 152 2.1.3. Support for Various 3.7.1. HTTP Centric API ............... 152 Databindings between XML and 3.7.2. Proxy API ........................ 153 Java ........................................ 4 3.7.3. Reading and Writing HTTP 2.1.4. Bindings ............................. 4 Messages ................................ 154 2.1.5. Message Interception and 3.7.4. Exception Handling .............. 154 Modification ............................... 4 3.8. Working With Attachments .............. 155 2.1.6. JAX-WS Handlers .................. 5 3.8.1. Reading Attachments ............. 155 2.1.7. Interceptors ......................... 5 3.8.2. Writing Attachments ............. 156 2.1.8. Transmitting Binary Data ........... 5 3.8.3. Uploading files ................... 157 2.1.9. WS-* Support ....................... 5 3.8.4. Forms and multiparts ............. 158 2.1.10. Invokers ........................... 5 3.8.5. XOP support ..................... 159 2.2. JAX-WS Service Development 3.9. Configuration ............................. 159 Options ............................................ 5 3.9.1. Configuration of Endpoints ...... 159 2.2.1. JAX-WS Annotated Services 3.9.2. Configuration of Clients ......... 161 from Java .................................. 5 3.10. Tutorials .................................. 161 2.2.2. JAX-WS Annotated Services 3.10.1. Creating a Basic JAX-RS from WSDL ............................... 6 endpoint ................................. 161 2.2.3. Developing a Service using Chapter 4. JAX-RS and OAuth2 .......... 167 JAX-WS ................................... 6 4.1. Developing OAuth2 Servers .............. 169 2.2.4. JAX-WS Configuration ........... 18 4.1.1. Authorization Service ............ 169 2.2.5. JAX-WS Providers ................ 27 4.1.2. AccessTokenService ............. 171 2.2.6. WebserviceContext ................ 32 4.1.3. OAuth Server JAX-RS 2.3. JAX-WS Client Development endpoints ................................ 175 Options ........................................... 33 4.2. Protecting resources with OAuth2 2.3.1. WSDL2Java generated Client ..... 33 filters ............................................ 176 2.3.2. JAX-WS Proxy .................... 33 4.3. How to get the user login name .......... 176 2.3.3. JAX-WS Dispatch APIs ........... 34 4.4. Client-side support ........................ 177 2.3.4. Usage Modes ...................... 34 4.5. OAuth2 without Explicit 2.3.5. Data Types ........................ 35 Authorization .................................. 178 2.3.6. Working with Dispatch 4.6. OAuth2 without a Browser .............. 178 Objects .................................... 36 4.7. Controlling the Access to Resource 2.3.7. Developing a Consumer ........... 39 Server ........................................... 178 2.4. Data Binding Options ...................... 53 4.7.1. Sharing the same access path 2.4.1. JAXB .............................. 53 between end users and clients .......... 179 2.4.2. MTOM Attachments with 4.7.2. Providing different access JAXB ..................................... 55 points to end users and clients .......... 180 2.4.3. SDO ............................... 58 Chapter 5. Combining JAX-WS and 2.4.4. XMLBeans ........................ 59 JAX-RS ............................................. 181 2.5. CXF Transports ............................ 60 5.1. Using Java-First Approach ............... 182 2.5.1. HTTP Transport ................... 60 5.2. Using Document-First Approach ........ 182 2.5.2. JMS Transport ..................... 81 2.5.3. UDP Transport .................... 97 Chapter 6. Talend ESB Service 2.6. WS-* Support .............................. 98 Recommended Project Structure .......... 183 2.6.1. WS-Addressing .................... 98 Chapter 7. Talend ESB Service 2.6.2. WS-Discovery ..................... 99 Examples ........................................... 185 2.6.3. WS-Policy ........................ 100 2.6.4. WS-ReliableMessaging .......... 110 Chapter 8. Configuring JMX 2.6.5. WS-SecureConversation ......... 111 Integration ......................................... 187 2.6.6. WS-Security ...................... 112 8.1. Example Configuration ................... 189 2.6.7. WS-SecurityPolicy ............... 122 8.2. How to get web service performance 2.6.8. WS-Trust ......................... 126 metrics .......................................... 190 2.7. CXF Customizations ...................... 129 Chapter 9. Communication styles ......... 191 2.7.1. Annotations ...................... 129 9.1. Request-Response ......................... 192 2.7.2. Dynamic Clients ................. 132 9.2. One-way ................................... 192 2.8. CXF Command-Line Tools .............. 133 9.3. Request-Callback ......................... 192 2.8.1. WSDL to Java .................... 134 9.3.1. WSDL for Request-Callback 2.8.2. Java to WS ....................... 135 Message Exchange ...................... 192 2.9. JAX-WS Development With Eclipse ..... 137 9.3.2. Relation between Request and 2.10. Talend ESB Policies ..................... 143 Callback Messages ...................... 195 2.10.1. Correlation ID Policy ........... 143 9.3.3. Defining Participants ............. 195 2.10.2. Transformation Policy .......... 144