Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{scrollbar}

This

...

tutorial

...

will

...

walk

...

you

...

through

...

building

...

and

...

developing

...

the

...

jax-ws

...

calculator

...

that

...

ships

...

with

...

the

...

samples

...

package

...

for

...

Geronimo.

...

After

...

completing

...

this

...

tutorial,

...

you

...

should

...

be

...

able

...

to

...

understand

...

how

...

to

...

build

...

simple

...

web

...

services

...

with

...

Apache

...

Geronimo

...

2.1

...

using

...

the

...

Eclipse

...

development

...

environment

...

To

...

run

...

this

...

tutorial,

...

as

...

a

...

minimum

...

you

...

will

...

be

...

required

...

to

...

have

...

installed

...

the

...

following

...

prerequisite

...

software.

...

  • Sun

...

  • JDK

...

  • 5.0+

...

  • (J2SE

...

  • 1.5)

...

  • Eclipse

...

  • 3.3.1.1

...

  • (Eclipse

...

  • Classic

...

  • package

...

  • of

...

  • Europa

...

  • distribution),

...

  • which

...

  • is

...

  • platform

...

  • specific

...

  • Web

...

  • Tools

...

  • Platform

...

  • (WTP)

...

  • 2.0.1

...

  • Data

...

  • Tools

...

  • Platform

...

  • (DTP)

...

  • 1.5.1

...

  • Eclipse

...

  • Modeling

...

  • Framework

...

  • (EMF)

...

  • 2.3.1

...

  • Graphical

...

  • Editing

...

  • Framework

...

  • (GEF)

...

  • 3.3.1

...

Details

...

on

...

installing

...

eclipse

...

are

...

provided

...

in

...

the

...

Development

...

environment

...

section.

...

This

...

tutorial

...

is

...

organized

...

in

...

the

...

following

...

sections:

...

Table of Contents

...

The

...

application

...

development

...

will

...

take

...

you

...

through

...

the

...

following

...

Setting

...

Eclipse

...

for

...

Application

...

Development

...

  1. Create

...

  1. a

...

  1. Dynamic

...

  1. Web

...

  1. Project

...

    • Select File ->

...

    • New

...

    • ,

...

    • select

...

    • Other...

...




    • Image Added


    • In the popup window select Web->Dynamic

...

    • Web

...

    • Project

...

    • category

...

    • and

...

    • click

...

    • NEXT.


      Image Added


    • Type in jaxws-calculator

...

    • as

...

    • the

...

    • Project

...

    • name:

...

    • and

...

    • select

...

    • Next


      Image Added


    • On the next screen check the box for Axis2 Web Services


      Image Added


    • Make sure Generate Deployment Descriptor is selected and click Next.


      Image Added


    • Modify the Group Id to: org.apache.geronimo.samples.jws

...

    • and

...

    • Artifact

...

    • Id:

...

    • to

...

    • Calculator.
      Image Added


      Info
      titleUseful Information

      Group ID: A name that identifies the group of a module. The default value is default.
      Artifact ID: A name of the module in a group. The default value is <blank>.
      Version: The version of module. The default value is 1.0
      Type: The type of module, such as system module (car), jar module (jar), web
      archive (war), enterprise archive (ear), and so on. The default value is car
      A module is stored inside a repository as repository/groupId/artifactId/version/artifactIdversion.

...


    • type.

...

    • This

...

    • repository

...

    • structure

...

    • gives

...

    • a

...

    • more

...

    • standardized

...

    • and

...

    • easily

...

    • maintainable

...


    • structure

...

    • to

...

    • Geronimo

...

    • applications.

...

    • Select Finish.
      Warning
      titleWarning

      Depending upon your environment, you may see the error message "Failed while installing Axis2 Web Services Core 1.1".

...

    • Do

...

    • not

...

    • worry.

...

    • We

...

    • will

...

    • just

...

    • have

...

    • to

...

    • manually

...

    • point

...

    • Axis2

...

    • to

...

    • the

...

    • installation

...

    • directory

...

    • of

...

    • WASCE

...

    • to

...

    • fix

...

    • this

...

    • error.

      Image Added


  1. AXIS2 Configuration
    • Select Window->Preferences.


      Image Added


    • Select Web Services->Axis2 Preferences.
    • Under Axis2 Runtime tab, browse to the installation root of Apache Geronimo. Select Ok.


      Image Added


      This completes the configuration of Eclipse for application development.

Define the wsdl for the web service

  1. Right Click on the WebContent subfolder and Select New->Other.
    Image Added
  2. Select Web Services->wsdl and click Next.
    Image Added
  3. Give the File name as CalculatorService.wsdl and click Next.
    Image Added
  4. On the next window give the Target namespace as "http://jws.samples.geronimo.apache.org".

...

  1. Select

...

  1. Finish.

...


  1. Image Added
  2. Modify the CalculatorService.wsdl

...

  1. as

...

  1. follows

...

  1. Code Block

...

  1. title

...

  1. CalculatorService.wsdl

...

  1. borderStyle

...

  1. solid

...

  1. 
    <wsdl:definitions name="Calculator"
    xmlns="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://jws.samples.geronimo.apache.org"
    xmlns:tns="http://jws.samples.geronimo.apache.org">
    <wsdl:types>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://jws.samples.geronimo.apache.org"
    targetNamespace="http://jws.samples.geronimo.apache.org"
    attributeFormDefault="unqualified"
    elementFormDefault="qualified">
    <xsd:element name="add">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="value1" type="xsd:int"/>
    <xsd:element name="value2" type="xsd:int"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="addResponse">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="return" type="xsd:int"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name="add">
    <wsdl:part name="add" element="tns:add"/>
    </wsdl:message>
    <wsdl:message name="addResponse">
    <wsdl:part name="addResponse" element="tns:addResponse"/>
    </wsdl:message>
    <wsdl:portType name="CalculatorPortType">
    <wsdl:operation name="add">
    <wsdl:input name="add" message="tns:add"/>
    <wsdl:output name="addResponse" message="tns:addResponse"/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="CalculatorSoapBinding"
    type="tns:CalculatorPortType">
    <soap:binding style="document"
    transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="add">
    <soap:operation soapAction="add" style="document"/>
    <wsdl:input name="add">
    <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output name="addResponse">
    <soap:body use="literal"/>
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="Calculator">
    <wsdl:port name="CalculatorPort"
    binding="tns:CalculatorSoapBinding">
    <soap:address location="http://localhost:8080/jaxwscalculator-
    1.0/calculator"/>
    <wswa:UsingAddressing
    xmlns:wswa="http://www.w3.org/2005/08/addressing/wsdl"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
    

...

  1. Warning
    titleWarning

    add explanation for the code