Web Services in WebLogic Server

Slides:



Advertisements
Similar presentations
JSP and web applications
Advertisements

SOAP.
Web Services Web Services are the basic fundamental building blocks of invoking features that can be accessed by an application program. The accessibility.
RPC Robert Grimm New York University Remote Procedure Calls.
Web Services Darshan R. Kapadia Gregor von Laszewski 1http://grid.rit.edu.
Scale Up Access to your 4GL Application using Web Services
Presentation 7 part 2: SOAP & WSDL. Ingeniørhøjskolen i Århus Slide 2 Outline Building blocks in Web Services SOA SOAP WSDL (UDDI)
Object-Oriented Enterprise Application Development Tomcat 3.2 Configuration Last Updated: 03/30/2001.
1 HyCon Framework Overview Frank Allan Hansen and Bent Guldbjerg Christensen ! Run this presentation in presentation mode to watch animations.
Java 2 – Enterprise Edition Kevin J. LaFata April 21, 2003 UM – St. Louis.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
Apache Axis: A Set of Java Tools for SOAP Web Services.
Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
1 Java Server Programming zLecture 1 focuses on: yIntroduction to web services y Web Services using Axis y The bigger Picture: Introduction to J2EE y Java.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
JRun 4 & Macromedia MX Tommy Reilly JRun Engineer.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
Notes of J2EE Tutorial Matt Tsai. 2 Outline Chapter 1: Overview Chapter 1: Overview Chapter 2: Understanding XML Chapter 2: Understanding XML Chapter.
SSC2: Web Services. Web Services Web Services offer interoperability using the web Web Services provide information on the operations they can perform.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
WSDL: Web Services Definition Language CS 795/895.
SelfDiagnose “who is to blame” ernest micklei, April 2007.
1 Core Web Services Standards. 2 (Simplified) Web Service Architecture Registry 1. Service Registers PUBLISH 3. Client calls Service BIND 2. Client Request.
Using JavaBeans and Custom Tags in JSP Lesson 3B / Slide 1 of 37 J2EE Web Components Pre-assessment Questions 1.The _____________ attribute of a JSP page.
COP 4991 Component Based Software Development Lecture #4 Java Web Services Onyeka Ezenwoye.
Java Server Pages A JSP page is a text-based document that contains two types of text: static template data, which can be expressed in any text-based format,
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
J2EE Structure & Definitions Catie Welsh CSE 432
Web Services in WebLogic Server Tom Purcell Chariot Solutions LLC.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Ch 2 – Application Assembly and Deployment COSC 617 Jeff Schmitt September 14, 2006.
Presentation: SOAP/WS in a distributed object framework, Application Servers & AXIS SOAP.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring Remoting Simplifying.
1 Web Services Web and Database Management System.
XML and Web Services (II/2546)
INT-9: Implementing ESB Processes with OpenEdge ® and Sonic ™ David Cleary Principal Software Engineer.
S O A P ‘the protocol formerly known as Simple Object Access Protocol’ Team Pluto Bonnie, Brandon, George, Hojun.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
WSDL : Web Service Definition Language Dr. Yuhong Yan NRC-IIT-Fredericton Internet logic.
DEVELOPING ENTERPRISE APPLICATIONS USING EJB
15 Copyright © 2004, Oracle. All rights reserved. Adding JAAS Security to the Client.
DEVELOPING WEB SERVICES WITH JAVA DESIGN WEB SERVICE ENDPOINT.
Net-centric Computing Web Services. Lecture Outline  What is Web Service  Web Service Architecture  Creating and using Java Web Services  Apache Axis.
Topics to be covered (ni) Client side validation JSF (free tools as well) Webservices Tell Resources e.g. sites Packaging and deploying web applications.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
Java Web Services Orca Knowledge Center – Web Service key concepts.
J2EE Platform Overview (Application Architecture)
Developing Web Services with the Eclipse Web Tools Platform
Chapter 5 Remote Procedure Call
WEB SERVICES.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Writing simple Java Web Services using Eclipse
Web Services-JAX-RPC JAX-RPC enables a Web Service endpoint to be developed using either a Java Servlet or Enterprise JavaBeans (EJB) component model.
Outline SOAP and Web Services in relation to Distributed Objects
Outline SOAP and Web Services in relation to Distributed Objects
Introduction to J2EE Architecture
MSIS 655 Advanced Business Applications Programming
J2EE Application Development
Web-Services-based Systems Architecture, Design and Implementation
Chapter 9 Web Services: JAX-RPC, WSDL, XML Schema, and SOAP
Web services, WSDL, SOAP and UDDI
Understanding and Designing with EJB
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Introduction to Web Services
Understanding Web Services based on dev. java
Introduction to Web Services
Distributed System using Web Services
Presentation transcript:

Web Services in WebLogic Server Aaron Mulder Chief Technical Officer Chariot Solutions LLC

Learning Objectives In this presentation, we'll discuss The advantages of web services Exposing EJBs as web services in WebLogic 6.1 and WebLogic 7.0 Invoking web services from applications running in WebLogic 6.1/7.0

About Aaron Mulder Chief Technical Officer of Chariot Solutions Published author (Professional EJB, and a forthcoming WebLogic 7 handbook) Presented at JavaOne 2001/2002, and the Philadelphia Java Users Group Member of the JSR-88 Expert Group (J2EE Application Deployment) Contributed to open-source projects such as JBoss, OpenEJB, and PostgreSQL

Presentation Agenda About web services WebLogic support for web services WebLogic 6.1 in detail WebLogic 7.0 in detail Conclusions, Q&A

Why Web Services? Interoperability Alternatives hardware platforms programming languages applications business partners Alternatives CORBA RMI Proprietary protocols (XML, binary, etc.)

What Are Web Services? Generic protocol, transport For today's discussion SOAP 1.1 WSDL 1.1 HTTP or HTTPS JAX-RPC Registry services UDDI 2.0

What Does WebLogic Support? First release with web services support Tools to generate web services servlet/JSP code for stateless session EJBs and JMS destinations Crippled tool to generate client code to invoke web services No standards-based support

What Does WebLogic Support? Improved web services support Deployment Descriptor-based web services support Tool to generate client code to invoke any web service (based on WSDL) JAX-RPC support WebLogic 8.0 ? J2EE 1.4/EJB 2.1 web services support

Overview of Examples For the rest of the presentation, we'll dig into the code and procedures Source code is included on CD There are no particular WebLogic Console configuration requirements We'll focus on EJB access, as that is what J2EE 1.4 standardizes Inportant: WebLogic client libraries can be freely redistributed

WL6.1: Overview Expose stateless session beans via web services Some limitations on EJB interface Can't expose selected methods The easy tool doesn't support security, or apps larger than a single EJB JAR The advanced procedure can't generate client code Examples use WebLogic 6.1 SP3

WL6.1: Architecture WAR EJB JARs SOAP Servlets Session Beans Client Error Servlet WSDL JSPs

WL6.1: Developing the EJB No method overloading Limited data types in parameters, return value boolean short int long float double Boolean Short Integer Long Float Double String BigDecimal Date Element Document DocumentFragment byte[] 1-D array of these JavaBean with these types of properties

WL6.1: Easy Packaging Tool Create EJB JAR like usual Run setEnv script in weblogic/config/domain Use wsgen Ant task to create web services WAR and an EAR with the EJB JAR and WAR Deploy the EAR like usual

WL6.1: wsgen Ant script <wsgen destpath="example-wsgen.ear" context="/examples" protocol="http"> <rpcservices path="myejb.jar"> <rpcservice bean="Bean1" uri="/web-services/bean1" /> </rpcservice> </wsgen> Configuration Parameters: EAR name Web application context Protocol (http/https) Source EJB JAR ejb-name from EJB JAR EJB sub-context

WL6.1: Advanced Packaging Advantages Security settings Multiple EJB JARs, existing WAR/EAR Custom layout, URLs Procedure Configure servlets & EJB refs in WAR Generate WSDL JSPs Add WAR, EJB JARs to EAR Use easy packaging to generate client

WL6.1: Configure the WAR Add an invocation servlet for each EJB weblogic.soap.server.servlet.StatelessBeanAdapter One <init-param> called ejb-ref whose value is the JNDI name of the EJB Ref Add one error servlet in each WAR weblogic.soap.server.servlet.FaultHandler Add servlet mappings for each servlet Add an <error-page> Exception class weblogic.soap.FaultException Location matches error servlet mapping

WL6.1: Configure the WAR, cont. Add an EJB Reference for each EJB ejb-ref name must match the argument to the invocation servlet Add security-constraint, login-config, etc. to secure the web service Will use WebLogic security realm like any other web application Can separately secure the EJBs, but an insecure servlet can't invoke a secure EJB

WL6.1: DD Examples Too much to show here; provided on CD Typically web.xml with all the settings described here, and weblogic.xml with EJB reference resolution Can integrate these settings into existing deployment descriptors for existing WAR

WL6.1: Generate WSDL JSPs Run the setEnv script Add EJB JAR to the CLASSPATH Run the Remote2WSDL tool java weblogic.soap.wsdl.Remote2WSDL -protocol http com.chariotsolutions.example.Bean1 examples/web-services/bean1 > src/web/bean1-wsdl.jsp Remote2WSDL Arguments Protocol (http/https) fully-qualified remote interface name context & URL to servlet, without leading / redirect output to a file check for extraneous “type-class-name” line

WL6.1: WSDL JSP Aliasing Can add servlet and servlet mapping to web.xml for WDSL JSPs <servlet> <servlet-name>Bean1WSDL</servlet-name> <jsp-file>/bean1-wsdl.jsp</jsp-file> </servlet> <servlet-mapping> <url-pattern>/web-services/bean1.wsdl</url-pattern> </servlet-mapping>

WL6.1: Configuring the EAR Add web services WAR and EJB JAR to application configuration <application> <display-name>Example of Web Services</display-name> <module> <ejb>example-ejbs.jar</ejb> </module> <web> <web-uri>example-web-services.war</web-uri> <context-root>/examples</context-root> </web> </application>

WL6.1: Generate Client Code Only way to generate client code is to use wsgen Ant task, and it only generates clients for web services running in WebLogic Can use a third-party tool such as Apache SOAP or IBM Web Services Toolkit

WL6.1: Invoking the Web Services Build a URL from the web app context root and servlet url-pattern For the examples provided: http://localhost:7001/examples/web-services/bean1 http://localhost:7001/examples/web-services/bean1.wsdl Be sure to configure a security realm or comment out the security settings in web.xml

WebLogic 7.0 Web Services More options for what backs the web services (individual EJB methods, etc.) Supports additional data types Can interact with SOAP messages Client need not receive a response Generates JAX-RPC clients from WSDL Quick-start tool from WSDL Uses web services DD Examples use WebLogic 7.0 SP1

WL7.0: Architecture WAR EJB JAR SOAP Handler Chain Client web-services.xml Session Beans ? SOAP Handler Chain

WL7.0: Developing the EJB Still can't expose overloaded methods Generally same basic data types as WebLogic 6.1, but can generate or code custom XML serializers for unknown data types (such as Java Beans) Additional built-in types include: byte/Byte, char/Character, BigInteger, Calendar

WL7.0: Easy Packaging Tool Create an EJB JAR like normal Run the setEnv script to set environment, add webserviceclient.jar to CLASSPATH Run an Ant script with servicegen to create an EAR from an EJB JAR Deploy the EAR servicegen has loads of options, but still doesn't integrate well into an existing application

WL7.0: servicegen Ant Script <servicegen destEar="example-servicegen.ear" contextURI="examples" > <service ejbJar="example-ejbs.jar" targetNamespace="java:mypackage.name" serviceName="Bean1" includeEJBs="Bean1" serviceURI="/web-services/bean1" generateTypes="True" expandMethods="True" style="rpc" > <client packageName="com.chariotsolutions.example"/> </service> </servicegen>

WL7.0: Advanced Packaging Procedure Develop and package the EJBs Create the web-services.xml deployment descriptor Package the WAR, including web.xml for security, and classes for SOAP handlers Package the EAR, including EJB JARs and WAR Build the client code

WL7.0: web-services.xml <web-services> <web-service name="Bean1" targetNamespace="java:mypackage.name" uri="/web-services/bean1"> <components> <stateless-ejb name="Bean1"> <ejb-link path="example-ejbs.jar#Bean1" /> </stateless-ejb> </components> <operations> <operation method="saySomething" component="Bean1" /> </operations> </web-service> </web-services>

WL7.0: More web-services.xml Use embedded XML schemas with namespaces to identify custom data types (see also the autotype Ant task) Use method parameters to support in/out parameters Use method of “ * ” to support all methods on an EJB Specify one-way operations Specify SOAP processors

WL7.0: Package WAR & EAR web-services.xml goes in WEB-INF/ in the WAR SOAP handler classes go in WEB-INF/lib or WEB-INF/classes Security, WSDL URL aliasing goes in web.xml No need for EJB refs in web.xml EAR needs references to WAR and EJB JARs like before

WL7.0: Deploy EAR Deploy the EAR like normal Web services appear in the Console under Deployments/Web Services Components Use these URLs to access the web services and WSDL: http://localhost:7001/examples/web-services/bean1 http://localhost:7001/examples/web-services/bean1?WSDL

WL7.0: Client Code Run setEnv script, add webserviceclient.jar Generate client code from the WSDL using the clientgen Ant task <clientgen wsdl="c:/examples/src/web/bean1.wsdl" serviceName="Bean1" packageName="com.chariotsolutions.example.client" clientJar="c:/examples/dist/bean1-client.jar" /> Can also specify a normal URL for the WSDL

WL7.0: Coding a Client Add webserviceclient.jar and client JAR to CLASSPATH Configure JAXM/JAX-RPC system properties Use the generated classes to invoke the Web Service Or, use a much more complicated process to dynamically interact with arbitrary web services based on WSDL

WL7.0: Client Code System.setProperty("javax.xml.soap.MessageFactory", "weblogic.webservice.core.soap.MessageFactoryImpl"); System.setProperty("javax.xml.rpc.ServiceFactory", "weblogic.webservice.core.rpc.ServiceFactoryImpl"); ... Bean1_Impl stub = new Bean1_Impl(); Bean1Port bean = stub.getBean1Port(username, password); String response = bean.saySomething(); System.out.println("Bean1 said: "+response); This client will work against the service deployed in WebLogic 6.1 or 7.0!

Conclusions WebLogic 6.1 provides basic web services, but limited client generation WebLogic 7.0 provides lots of options, but taking full advantage makes it extremely difficult to configure WebLogic 7.0 is nearly fully Ant-script- able from client to server (WSDL?) EJB 2.1 will be greatly appreciated when it arrives

How can web services ease integration challenges today? A Final Thought How can web services ease integration challenges today?

Questions?

http://www.chariotsolutions.com/ http://www.xmltp.com/