레이블이 AXIS2인 게시물을 표시합니다. 모든 게시물 표시
레이블이 AXIS2인 게시물을 표시합니다. 모든 게시물 표시

2008년 3월 5일 수요일

Apache Axis2 User's Guide - Reference

Resources

---------------------------------------------------------------------------------------------------
Apache Axis - http://ws.apache.org/axis

Apache Axis2 - http://ws.apache.org/axis2/


Axis2 Architecture - http://ws.apache.org/axis2/1_1_1/Axis2ArchitectureGuide.html


XML processing with AXIOM - http://ws.apache.org/commons/axiom/OMTutorial.html


RESTful Web Services - http://ws.apache.org/axis2/1_1_1/rest-ws.html


TCP Transport - http://ws.apache.org/axis2/1_1_1/tcp-transport.html


Mail Transport - http://ws.apache.org/axis2/1_1_1/mail-transport.html


HTTP Transports - http://ws.apache.org/axis2/1_1_1/http-transport.html


MTOM with Axis2 - http://ws.apache.org/axis2/1_1_1/mtom-guide.html


Securing SOAP Messages with Apache Rampart- http://ws.apache.org/axis2/modules/rampart/1_1/security-module.html


SOAPMonitor - http://ws.apache.org/axis2/1_1_1/soapmonitor-module.html


Apache Axis2 Advance User's Guide - http://ws.apache.org/axis2/1_1_1/adv-userguide.html


--------------------------------------------------------------------------------------------------------------------

2008년 3월 4일 화요일

Apache Axis2 User's Guide - Creating Clients

수작업으로 Web service client를 생성할수 있다(참조 Building Services), 그러나 대부분의 경우 당신은 클라이언트가 보내고 받기를 기대하는 메세지를 명세한 Web Service Description Language (WSDL) definition을 가지고 있을것이다. Axis2는 자동으로 클라이언트를 생성하기위한 이 정의를 사용하는 몇몇의 방법을 제공한다.

Choosing a Client Generation Method

------------------------------------------------------------------------------------------------------------------
Axis2는 클라이언트를 생성하면서 WSDL을 객체에 맵핑할때 몇몇의 옵션을 제공한다. 이 3개의 옵션은 Axis2 DataBinding Framework, XMLBeans, 그리고 JiBX databinding 이다. 이 모든 방법은 서비스에서 사용되는 XML 구조를 벗어나 자바 객체를 생성하기위해 데이터바인딩을 이용한다, 그리고 그들 각각은 그들의 pros와 cons를 가지고 있다. 또한 당신은 데이터 바인딩에 기반을 두지 않은 XML in-out stubs를 생성할 수 있다.


Axis2 Databinding Framework (ADB): 아마도 Axis2 클라이언트를 생성하는 가장 간단한 방법은 ADB일 것이다. 대부분의 경우, 관련된 모든 클래스들은 메인 스텁 클래스의 내부 클래스(inner classes)로 생성된다. ADB는 사용하기 매우 쉽지만 제한이 없다. 이것이 full schema binding 어플리케이션이라는 의미는 아니다, 그리고 XML Schema element extensions과 restrictions 처럼 구조화 하기 어렵다.


XMLBeans: ADB와 달리, XMLBeans는 fully functional 스키마 컴파일러 이다, 그래서 ADB처럼 동일한 제한들을 운반하지 않는다. 그럼에도 불구하고 이것은 ADB보다 사용하기에 약간더 복잡하다. 이것은 거대한 양의 파일을 생성한다, 그리고 프로그래밍 모델이 매우 유용하지만 ADB 처럼 직관적이지 못하다.


JiBX: JiBX는 full 데이터바인딩 프레임웍 이며 WSDL-to-Java conversion(이 문서에서 설명할 것이다) 뿐만아니라 Java-to-XML conversion도 제공한다. 어떤 방법을 이용해 JiBX는 최고의 두개의 세계모두를 제공한다.  JiBX는 매우 유연(당신의 엔티티들을 표현하는 클래스를 선택가능하다) 하지만 셋업 하기가 복잡하다. 다르게 말하면, 일단 셋업되고 나면 생성된 코드를 실제로 이용할때는 ADB를 사용하는 것 처럼 쉽다.


마지막으로, 간단한 구조를 위해서는 ADB만으로도 충분하다. 다르게 말하면, 만약 당신이 더 많은 파워 또는 유연성을 얻으려면 얼마나 많은 파워 또는 유연성이 필요한지와 복잡성을 감수하는가에 따라 XMLBeans 또는 JiBX 중 하나를 선택하면 된다.

Generating Clients

------------------------------------------------------------------------------------------------------------------

클라이언트를 생성하고 사용하는 과정은 당신이 선택한 생성 방법에 따라 약간씩 다르다. 이 문서에 있는 3개의 경우 모두 클라이언트는 동일한 WSDL 파일을 이용해 생성된 것이다 (참조 Code Listing 5).


Code Listing 5 - Generating clients from the WSDL file

---------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
   xmlns:apachesoap="
http://xml.apache.org/xml-soap"
   xmlns:impl="
http://apache.org/axis2/Axis2UserGuide"
   xmlns:intf="
http://apache.org/axis2/Axis2UserGuide"
   xmlns:wsdl="
http://schemas.xmlsoap.org/wsdl/"
   xmlns:wsdlsoap="
http://schemas.xmlsoap.org/wsdl/soap/"
   xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
   targetNamespace="
http://apache.org/axis2/Axis2UserGuide">

  <wsdl:types>
    <schema
       elementFormDefault="qualified"
       targetNamespace="
http://apache.org/axis2/Axis2UserGuide"
       xmlns="
http://www.w3.org/2001/XMLSchema">
     
      <!-- ELEMENTS -->
     
      <element name="DoInOnlyRequest">
        <complexType>
          <sequence>
            <element name="messageString" type="xsd:string"/>
          </sequence>
        </complexType>
      </element>
element name="TwoWayOneParameterEchoRequest">
        <complexType>
          <sequence>
            <element name="echoString" type="xsd:string"/>
          </sequence>
        </complexType>
      </element>
      <element name="TwoWayOneParameterEchoResponse">
        <complexType>
          <sequence>
            <element name="echoString" type="xsd:string"/>
          </sequence>
        </complexType>
      </element>
     
      <element name="NoParametersRequest">
        <complexType/>
      </element>
      <element name="NoParametersResponse">
        <complexType/>
      </element>
     
      <element name="MultipleParametersAddItemRequest">
        <complexType>
          <sequence>
            <element name="itemId" type="xsd:int"/>
            <element name="itemName" type="xsd:string"/>
            <element name="price" type="xsd:float"/>
            <element name="description" type="xsd:string"/>
          </sequence>
        </complexType>
      </element>

      <element name="MultipleParametersAddItemResponse">
        <complexType>
          <sequence>
          <element name="itemId" type="xsd:int"/>
          <element name="successfulAdd" type="xsd:boolean"/>
          </sequence>
        </complexType>
      </element>

    </schema>
  </wsdl:types>

<!-- MESSAGES -->

  <wsdl:message name="DoInOnlyRequestMessage">
    <wsdl:part name="input" element="impl:DoInOnlyRequest"/>
  </wsdl:message>

  <wsdl:message name="TwoWayOneParameterEchoRequestMessage">
    <wsdl:part name="input" element="impl:TwoWayOneParameterEchoRequest"/>
  </wsdl:message>
  <wsdl:message name="TwoWayOneParameterEchoResponseMessage">
    <wsdl:part name="output" element="impl:TwoWayOneParameterEchoResponse"/>
  </wsdl:message>

  <wsdl:message name="NoParametersRequestMessage">
    <wsdl:part name="input" element="impl:NoParametersRequest"/>
  </wsdl:message>
  <wsdl:message name="NoParametersResponseMessage">
    <wsdl:part name="output" element="impl:NoParametersResponse"/>
  </wsdl:message>

  <wsdl:message name="MultipleParametersAddItemRequestMessage">
    <wsdl:part name="input" element="impl:MultipleParametersAddItemRequest"/>
  </wsdl:message>
  <wsdl:message name="MultipleParametersAddItemResponseMessage">
    <wsdl:part name="output" element="impl:MultipleParametersAddItemResponse"/>
  </wsdl:message>

<!-- Port type (operations) -->

  <wsdl:portType name="Axis2UserGuidePortType">

    <wsdl:operation name="DoInOnly" parameterOrder="input">
      <wsdl:input name="DoInOnlyRequestMessage"
                  message="impl:DoInOnlyRequestMessage"/>
    </wsdl:operation>

    <wsdl:operation name="TwoWayOneParameterEcho" parameterOrder="input">
      <wsdl:input name="TwoWayOneParameterEchoRequestMessage"
                  message="impl:TwoWayOneParameterEchoRequestMessage"/>
      <wsdl:output name="TwoWayOneParameterEchoResponseMessage"
                  message="impl:TwoWayOneParameterEchoResponseMessage"/>
    </wsdl:operation>

    <wsdl:operation name="NoParameters" parameterOrder="input">
      <wsdl:input name="NoParametersRequestMessage"
                  message="impl:NoParametersRequestMessage"/>
      <wsdl:output name="NoParametersResponseMessage"
                   message="impl:NoParametersResponseMessage"/>
    </wsdl:operation>

    <wsdl:operation name="MultipleParametersAddItem" parameterOrder="input">
      <wsdl:input name="MultipleParametersAddItemRequestMessage"
                  message="impl:MultipleParametersAddItemRequestMessage"/>
      <wsdl:output name="MultipleParametersAddItemResponseMessage"
                  message="impl:MultipleParametersAddItemResponseMessage"/>
    </wsdl:operation>

  </wsdl:portType>

<!-- BINDING (bind operations) -->
  <wsdl:binding
     name="Axis2UserGuideSoapBinding"
     type="impl:Axis2UserGuidePortType">
    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

    <wsdl:operation name="DoInOnly">
      <wsdlsoap:operation soapAction="DoInOnly"/>
      <wsdl:input>
        <wsdlsoap:body use="literal"/>
      </wsdl:input>
    </wsdl:operation>

    <wsdl:operation name="TwoWayOneParameterEcho">
      <wsdlsoap:operation soapAction="TwoWayOneParameterEcho"/>
      <wsdl:input>
        <wsdlsoap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <wsdlsoap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>

    <wsdl:operation name="NoParameters">
      <wsdlsoap:operation soapAction="NoParameters"/>
      <wsdl:input>
        <wsdlsoap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <wsdlsoap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>

    <wsdl:operation name="MultipleParametersAddItem">
      <wsdlsoap:operation soapAction="MultipleParametersAddItem"/>
      <wsdl:input>
        <wsdlsoap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <wsdlsoap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

<!-- SERVICE -->

  <wsdl:service name="Axis2UserGuideService">
    <wsdl:port binding="impl:Axis2UserGuideSoapBinding"
               name="Axis2UserGuide">
      <wsdlsoap:address location="
http://localhost:8080/axis2/services/Axis2UserGuide"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>
---------------------------------------------------------------------------------------------------------


여기서는 4개의 operation을 정의한다, DoInOnly, NoParameters, TwoWayOneParameterEcho, 그리고 MultipleParametersAddItem 이다. 각각의 클라이언트는 각각의 이 operation들을 호출하기 위한 함수를 가지고 있을 것이다.


(WSDL에 대한 더많은 정보를 원하면 http://www.w3.org/2002/ws/desc/ 를 방문하라.)

Axis Data Binding (ADB)

------------------------------------------------------------------------------------------------------------------

ADB를 이용하는 클라이언트를 생성하기 위해서는 다음의 단계를 실행하라:


The short story:


    1. 이것을 이전에 하지 않았으면 Apache Axis2 Standard Distribution을 다운로드하고 압축을 풀어라.


    2. 다음의 명령어를 이용해 클라이언트 stub을 생성하라:


        %AXIS2_HOME%\bin\wsdl2java -uri Axis2UserGuide.wsdl -p org.apache.axis2.axis2userguide -d adb -s


    3. 생성된 stub을 이용하는 자바 어플리케이션인 클라이언트(예: Client.java)를 생성하라,

       그리고 org/apache/axis2/axis2userguide 디렉토리에 이것을 저장하라.


    4. ant jar.client 명령어로 클라이언트를 빌드하라.


    5. 상응하는 서비스가 있다고 가정하고 build/lib 폴더안에 생성된 Axis2UserGuideService-test-client.jar 파일을

       클래스패스에 추가한다음 아래의 명령어를 실행해 클라이언트를 실행하라:


       java org.apache.axis2.axis2userguide.Client


The long story:


이것을 이전에 하지 않았으면 Apache Axis2 Standard Distribution을 다운로드하고 압축을 풀어라. Axis2 War Distribution은 WSDL2Java와 같은 코드를 생성하기위해 필요한 유틸리티들을 포함하고 있지 않다.


클라이언트를 생성할때 ADB 방법을 사용하면 서비스를 위한 모든 기능들은 stub 이라 불리는 하나의 클래스에 들어가게 된다.

stub은 WSDL 파일에 정의되어 있는 필요한 모든 객체에 해당하는 inner 클래스를 포함한다. 이 WSDL의 경우는 DoInOnlyRequestMessage를 예를 들수 있다. stub을 이용해 이런 클래스들과 그들의 함수들을 참조하여 쉽게 클라이언트를 생성할 수 있다. 클라이언트를 생성하기 위해서 Code Listing 6 의 명령을 따라라.

Code Listing 6 - Generating the Client
------------------------------------------------------------------------------------------------------------------


%AXIS2_HOME%\bin\wsdl2java -uri Axis2UserGuide.wsdl -p org.apache.axis2.axis2userguide -d adb -s


이 명령은 WSDL 파일을 분석하고 org.apache.axis2.axis2userguide 패키지에 stub을 생성한다. -d 옵션은 ADB data binding 방식을 사용한다는 의미이고, -s 옵션은 synchronous 또는 blocking 방식을 사용한다는 의미이다. 다르게 말하면, 클라이언트가 서버에 In-Out 호출을 하고나서 계속 진행하지 않고 response를 기다린다는 의미이다.


당신이 이 명령을 실행하고 나면 디렉토리 안에 새로운 두개의 아이템이 보일 것이다. 첫번째는 Ant가 클래스를 컴파일하고 생성하기위한 지시를 포함하고 있는 build.xml 파일이다. 두번째는 실제 Axis2UserGuideServiceStub.java 파일을 가지고 있는 src 디렉토리이다. 이 파일을 열어보면 wsdl 파일에서 명세한 각각의 아이템들을 위한 inner 클래스의 collection을 볼수 있다. 또한 몇개의 Axis2 client API 호출을 볼것이다. Axis2 client API는 들어오거나 나가는 메세지들을 빌드하고 분석하기위해 axiom을 이용한다.


이제 이 코드를 이용하기 위한 클라이언트가 필요하다. 클라이언트를 생성하기 위해 org/apache/axis2/axis2userguide 디렉토리에 Client.java 라는 새로운 클래스를 만들어라. 이것은 아래의 Code Listing 7 에 있는 코드를 포함하고 있다.


Code Listing 7- Client.java

---------------------------------------------------------------------------------------------------------

package org.apache.axis2.axis2userguide;


import org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.DoInOnlyRequest;
import org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.TwoWayOneParameterEchoRequest;
import org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.NoParametersRequest;
import org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.MultipleParametersAddItemRequest;

import org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.TwoWayOneParameterEchoResponse;
import org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.NoParametersResponse;
import org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.MultipleParametersAddItemResponse;


public class Client{

    public static void main(java.lang.String args[]){
        try{
            Axis2UserGuideServiceStub stub = new Axis2UserGuideServiceStub

                                                                      ("http://localhost:8080/axis2/services/Axis2UserGuideService");

            doInOnly(stub);
            twoWayOneParameterEcho(stub);
            noParameters(stub);
            multipleParameters(stub);

        } catch(Exception e){
            e.printStackTrace();
            System.out.println("\n\n\n");
        }
    }

/* do in only */
    public static void doInOnly(Axis2UserGuideServiceStub stub){
        try{
            DoInOnlyRequest req = new DoInOnlyRequest();

            req.setMessageString("An in only request");

            stub.DoInOnly(req);
            System.out.println("done");
        } catch(Exception e){
            e.printStackTrace();
            System.out.println("\n\n\n");
        }
    }


    /* two way call/receive */
    public static void twoWayOneParameterEcho(Axis2UserGuideServiceStub stub){
        try{
            TwoWayOneParameterEchoRequest req = new TwoWayOneParameterEchoRequest();

            req.setEchoString("echo! ... echo!");

            TwoWayOneParameterEchoResponse res = stub.TwoWayOneParameterEcho(req);

            System.out.println(res.getEchoString());
        } catch(Exception e){
            e.printStackTrace();
            System.out.println("\n\n\n");
        }
    }


    /* No parameters */
    public static void noParameters(Axis2UserGuideServiceStub stub){
        try{
            NoParametersRequest req = new NoParametersRequest();

            System.out.println(stub.NoParameters(req));
        } catch(Exception e){
            e.printStackTrace();
            System.out.println("\n\n\n");
        }
    }

/* multiple parameters */
    public static void multipleParameters(Axis2UserGuideServiceStub stub){
        try{
            MultipleParametersAddItemRequest req = new MultipleParametersAddItemRequest();

            req.setPrice((float)1.99);
            req.setItemId((int)23872983);
            req.setDescription("Must have for cooking");
            req.setItemName("flour");

            MultipleParametersAddItemResponse res = stub.MultipleParametersAddItem(req);

            System.out.println(res.getSuccessfulAdd());
            System.out.println(res.getItemId());
        } catch(Exception e){
            e.printStackTrace();
            System.out.println("\n\n\n");
        }
    }
}

---------------------------------------------------------------------------------------------------------

WSDL 파일에 정의된 이름들을 이용하는 적당한 request 타입을 생성하고 populating 하고난후 stub을 이용해 적당한 함수에 실제로 request를 보내는 방식으로 서비스를 사용하는것이 간단하다는 것을 인지하시오. 예를들면, DoInOnly operation을 호출하기위해 당신은 DoInOnlyRequest를 생성하고 setMessageString() 함수를 이용해 이것의 messageString element의 컨텐츠를 셋팅한 다음 이것을 stub.DoInOnly() 함수에 알규먼트로 넘긴다.


클라이언트를 생성하기위해 ant jar.client 명령을 사용하라.


이렇게 하면 두개의 새로운 디렉토리(build와 test)를 생성할 것 이다. test 디렉토리는 비어있지만 build 디렉토리는 2개의 클라이언트 버젼을 포함하고 있다. 첫번째 버젼은 lib 디렉토리에 있으며 클라이언트 클래스와 stub을 포함하는 하나의 jar 파일이다. 두번째는 classes 디렉토리에 있으며 classes 파일들 만을 포함하고 있다.


Axis2 lib directory 안의 모든 jar 파일들이 클래스패스에 잡여있는지 확인하라.


만약 당신이 이 클라이언트에 상응하는 서비스를 가지고 있으면 -- 만약 없으면 Building services 문서를 확인하라 -- 당신은 jar 파일을 당신의 클래스패스에 추가하고 java org.apache.axis2.axis2userguide.Client 명령어를 이용해 클라이언트를 실행할 수 있다.


당신의 서블릿 컨테이너의 콘솔창에서 response를 볼 수 있다. 이것은 아래와 같을 것이다:


사용자 삽입 이미지

ADB만이 웹 서비스 클라이언트를 생성하는 유일한 옵션이 아니다. XmlBeans, JiBX, JAXME 그리고 JAXBRI 와 같은 다른 옵션들도 있다.


 

Apache Axis2 User's Guide -Building Services

이제 당신은 WSDL을 이용해 클라이언트를 생성하기위해 Axis2를 사용하는 방법을 알고 있다, 이번 섹션에서는 좀더 깊이 들어갈 것이다, 서비스를 생성하는 방법과 아무것도 없는 상태에서 서버스와 클라이언트 둘다를 생성하는 방법을 보여줄 것이다.



Content

-------------------------------------------------------------------------------------------------------------------
    ● Introducing Axis2

        ○ What is Axis2?
        ○ What's under the hood?
        ○ How Axis2 handles SOAP messages
        ○ Axis2 distributions
        ○ The Axis2 Standard Binary Distribution
        ○ Axis2.war Directory hierarchy
        ○ Axis2 Documents Distribution
        ○ Axis2 and clients


    ● Installing and testing client code


    ● Introduction to Services

        ○ Message Exchange Patterns


    ● Creating Clients

        ○ Choosing a Client Generation Method
        ○ Generating Clients
        ○ Axis Data Binding (ADB)


    ● Building Services

        ○ Getting Comfortable with Available Options
        ○ Creating a service from scratch
        ○ Deploying Plain Old Java Objects
        ○ Deploying and running an Axis2 service created from WSDL


    ● Samples


    ● For Further Study



Getting Comfortable with Available Options

--------------------------------------------------------------------------------------------------------------------

아래와 같이 Axis2는 서비스를 생성하는 몇가지 방법을 제공한다:


    ● 아무것도 없는상태에서 서버스를 생성하고 빌드한다: 이 경우에 당신은 AXIOM OMElement 객체들에 구체적으로 접근하기

        위한 서비스 클래스를 빌드한 다음 services.xml 파일을 생성하고 디플로이 하기위해 이것을 묶는다.


    ● Plain Old Java Objects (POJOs)를 서비스로 디플로이한다.


    ● WSDL로 부터 서비스를 생성한다: WSDL만 가지고 클라이언트를 생성 할 수 있다. 당신은 서비스의 skeleton을

        생성 할 수 있다.


이 3개의 옵션들을 살펴보자.



Creating a Service From Scratch

--------------------------------------------------------------------------------------------------------------------

아무것도 없는상태에서 서버스를 생성하는 것은 가장 편리한 방법이 아니지만 가장 많은 제어권을 당신에게 준다. 이 과정은 몇단계를 거쳐야한다.


The short story:


    1. org.apache.axiom.om.OMElement 객체를 알규먼트로 받는 함수에의해 대표되는 각각의 오퍼레이션을 가지고 있는

       서비스 클래스를 생성한다. (OMElement는 AXIs2 Object Model (AXIOM) 이 XML element를 표현하기위한 것이다.)


    2. 서비스 디스크립터(services.xml)를 생성한다. 이것은 서비스에 의해 사용되는 클래스와 적절한 메세지 receiver들을

       정의한다.


    3. .aar 파일을 생성한다. 이 파일은 패키지를 기준으로 적절한 위치에 있는 클래스들과 META-INF 디렉토리안에 있는

       services.xml 파일을 포함하고 있다.


    4. 웹 관리자 어플리케이션을 이용하거나 Axis2 서비스 디렉토리에 .aar 파일을 복사해 넣는 방식으로 .aar 파일을

       디플로이한다.

The long story:


먼저 서비스 클래스를 생성한다. 서비스 클래스는 Axis2 라이버러리 안에 있는 클래스를 이용하는 plain Java class 이다(참조 Code Listing 8).


Code Listing 8-Creating the Service Class

--------------------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------------
package org.apache.axis2.axis2userguide;


import javax.xml.stream.XMLStreamException;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;


public class SampleService {


    public OMElement sayHello(OMElement element) throws XMLStreamException {
            element.build();
            element.detach();

            String rootName = element.getLocalName();
            System.out.println("Reading "+rootName+" element");
           
            OMElement childElement = element.getFirstElement();
            String personToGreet = childElement.getText();

            OMFactory fac = OMAbstractFactory.getOMFactory();
            OMNamespace omNs = fac.createOMNamespace("
http://example1.org/example1", "example1");
            OMElement method = fac.createOMElement("sayHelloResponse", omNs);
            OMElement value = fac.createOMElement("greeting", omNs);
            value.addChild(fac.createOMText(value, "Hello, "+personToGreet));
            method.addChild(value);

            return method;
     }

private void ping(){
     }


}

------------------------------------------------------------------------------------------------------------


소스를 컴파일할때 당신의 클래스패스에 Axis2 라이버러리들이 포함되 있는지 확인하라.


Axis2는 AXIOM (또는 AXIs Object Model) 를 이용한다. 이것은 StAX API (Streaming API for XML) 에 기반을둔 구조와 비슷한 DOM (Document Object Model) 이다.

서비스 처럼 동작하는 함수들은 그들의 알규먼트로 OMElement를 가지고 있어야 한다. OMElement는 들어오는 SOAP 메세지의 payload를 표현한다. (OMElement는 DOM Element 객체처럼 단지 AXIOM이 XML element를 표현하는 방식이다.)

이 경우, 당신은 payload element의 첫번째 child의 컨텐츠를 추출한다음 텍스트를 이것에 추가한다. 그리고 이것을 리턴되는 OMElement의 컨텐츠로 사용한다.

이것이 "in only" 서비스가 아니라면, 이 함수들은 OMElement를 리턴 해야한다. 리턴되는 SOAP 메세지의 payload가 되기 때문이다.


서비스에 이 클래스를 넣기위해 Code Listing 9에 있는 서비스 디스크립션 파일(services.xml)을 생성하라.

Code Listing 9 - Create the Service Description
--------------------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------------

<service name="UserGuideSampleService">
    <description>
        This is a sample service created in the Axis2 User's Guide
    </description>

    <parameter name="ServiceClass" locked="false">

        org.apache.axis2.axis2userguide.SampleService
    </parameter>

    <operation name="sayHello">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </operation>
    <operation name="ping">
        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
    </operation>
</service>

------------------------------------------------------------------------------------------------------------


이 문서는 Web Administration Application이 호출하는 service와 request들을 처리하는데 사용되는 클래스를 정의한다. 각각의 오퍼레이션을 위해 적절한 message receiver class를 정의한다.


클래스의 메인 디렉토리에 새로운 META-INF 디렉토리를 생성하라. (이 경우, org 디렉토리를 포함하고 있는 디렉토리와 동일한 디렉토리이다.) 그런다음 services.xml 파일을 그곳에 두라.


jar cvf SampleService.aar ./* 명령을 이용해 .aar 파일을 생성하라.


Web Administration application을 이용하거나 SampleService.aar 파일을 Axis2 services 디렉토리에 복사해 넣는 방식을 이용해 SampleService.aar 파일을 디플로이 하라.


이제 당신은 서비스에 직접 접근 할 수 있는 클라이언트 클래스를 생성 할 수 있다 (참조 Code Listing 10).

Code Listing 10 - Create a Client Class that Accesses the Service Directly

--------------------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------------
package org.apache.axis2.axis2userguide;


import javax.xml.stream.XMLStreamException;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.Constants;
import org.apache.axis2.client.ServiceClient;


public class SampleClient {

        private static EndpointReference targetEPR =

                                 new EndpointReference("http://localhost:8080/axis2/services/UserGuideSampleService");

       

    public static OMElement greetUserPayload(String personToGreet) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://example1.org/example1", "example1");
        OMElement method = fac.createOMElement("sayHello", omNs);
        OMElement value = fac.createOMElement("personToGreet", omNs);
        value.addChild(fac.createOMText(value, personToGreet));
        method.addChild(value);
        return method;
    }

public static void main(String[] args) {
        try {
            OMElement payload = SampleClient.greetUserPayload("John");
            Options options = new Options();
            options.setTo(targetEPR);
           
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

            ServiceClient sender = new ServiceClient();
            sender.setOptions(options);
            OMElement result = sender.sendReceive(payload);

            String response = result.getFirstElement().getText();
            System.out.println(response);

        } catch (Exception e) {    //(XMLStreamException e) {
            System.out.println(e.toString());
        }
    }

   
}

------------------------------------------------------------------------------------------------------------


이 클래스는 OMElement를 보내고 받는 동일한 기술을 사용한다. 그러나 Options 클래스를 사용하는부분을 아는것이 중요하다.

이 클래스는 리턴되는 메세지를 위해 사용되는 transport와 사용하기 위한 SOAP 버젼과 같은 속성들을 결정하는 것을 가능하게 한다. 보내는 메세지에 사용되는 transport는 지정된 URL로 부터 추즉 가능하다.

클라이언트가 서버스와 상호작용하는 방식에 영향을 주는 특정 속성들의 setter와 getter 함수를 제공하는것 뿐만 아니라, Options 클래스는 당신이 Options 객체들 사이에 상속관계를 생성하는것을 가능하게 한다. 그래서, 만약 현재 사용되는 Options 객체에 속성이 없으면 클라이언트는 현재 Options 객체의 부모 Options 객체를 검사 할 수 있다.


위의 SampleClient.java를 컴파일하고 실행하라. 모든 axis2 라이버러리들이 당신의 클래스 패스에 있는지 확인하라. 만약 모든것이 정상이라면 콘솔창에 'Hello, John' 이 나타날 것이다.

Deploying Plain Old Java Objects (POJOs)

--------------------------------------------------------------------------------------------------------------------


웹 서비스를 생성하는 매우 쉬운 방법중의 하나는 간단히 서비스에 상응하는 자바 객체를 디플로이 하는 것이다. Code Listing 11 에서 보이는 클래스 부터 시작하자.



Code Listing 11 - Creating the Class SampleService

--------------------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------------

package org.apache.axis2.axis2userguide;


public class SampleService {


    public void doInOnly(){
        return;
    }
    
    public String noParameters(){
        return "Hello";
    }
   
    public String twoWayOneParameterEcho(String toEcho){
        return toEcho;
    }
   
    public boolean multipleParametersAdd(float price, int itemId, String description, String itemName){
        //Code to handle the logic
        return true;
    }
 
}

------------------------------------------------------------------------------------------------------------

다음은 어떤 웹 서비스에 어떤 클래스가 대응하는지 Axis2에게 알려줘야 할 필요가 있다. services.xml 파일을 생성하고 Code Listing 12 의 내용을 추가함으로써 이 일이 가능하다.



Code Listing 12 - Creating services.xml

--------------------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------------
<service name="SampleService" scope="application">
    <description>
        Sample Service
    </description>
    <messageReceivers>
        <messageReceiver
            mep="
http://www.w3.org/2004/08/wsdl/in-only"

            class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
        <messageReceiver
            mep="
http://www.w3.org/2004/08/wsdl/in-out"
            class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
    </messageReceivers>
    <parameter name="ServiceClass">
        org.apache.axis2.axis2userguide.SampleService
    </parameter>
</service>

------------------------------------------------------------------------------------------------------------

이 파일은 InOnly와 InOut MEPs(message exchange patterns) 를 service에서 가능하게 만들고 어떤 클래스를 호출해야 하는지 Axis2에 알려준다; operation들은 함수이름들과 매치가 되어야만 한다. 다르게 말하면, Axis2는 자동으로 multipleParametersAdd operation 호출을 org.apache.axis2.axis2userguide.SampleService.multipleParametersAdd() 함수로 보낸다.


이제 distribution을 생성할 시간이다. 아래의 디렉토리 구조안에 당신의 파일들을 배치하라. (참조 Code Listing 13)



Code Listing 13- Create the Directory Structure for the Distribution

--------------------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------------
 - SampleService
   - META-INF
     - services.xml
   - org
     - apache
       - axis2
         - axis2userguide
           - SampleService.class

------------------------------------------------------------------------------------------------------------


마지막으로, SampleService 디렉토리를 서블릿 엔진의 webapps/axis2/WEB-INF/services 디렉토리에 복사해 넣음으로서 서비스를 디플로이 하라. http://<host>:<port>/axis2/services/listServices 페이지를 검사해 올바르게 디플로이 됬는지 확인할수 있다.

Deploying and Running an Axis2 Service Created from WSDL

--------------------------------------------------------------------------------------------------------------------


If you have a WSDL file, you can easily create and deploy a service based on that description. For example, to create a service based on the same WSDL file used in the clients section of this document, you'd employ the following steps.


만약 당신이 WSDL 파일을 가지고 있으면 그 description을 기준으로 쉽게 서비스를 생성하고 디플로이 할 수 있다. 예를 들어,


The short story:


    1. Axis2 standard distribution이 없다면 다운로드 하라.


    2. WSDL2Java 유틸리티를 이용해 skeleton을 생성하라:


        java org.apache.axis2.wsdl.WSDL2Java -uri file:///C:/apps/axis2/samples/zSample/Axis2UserGuide.wsdl

        -p org.apache.axis2.axis2userguide -d adb -s -wv 1.1 -ss -sd -ssi


    3. *Skeleton.java 파일을 열어 생성된 함수들 안에 당신의 서비스 기능을 추가하라.


    4. ant jar.server 명령을 실행해 서비스를 빌드하라.


    5. build/lib/*.aar 파일을 <J2EE_HOME>/webapps/axis2/WEB-INF/services 폴더에 복사해 넣어 서비스를 디플로이 하라.


    6. http://<server>:<port>/axis2/services/listServices 페이지를 열어 서비스가 올바르게 디플로이 됬는지 확인하라.
 

The long story:


클라이언트를 생성하는 경우처럼 Axis2 Standard Distribution이 필요하다. Axis2 War Distribution에는 WSDL2Java 유틸리티가 없기 때문이다. 이것을 다운로드하고 압축을 푼다음 AXIS2_HOME 환경변수에 압축을 푼 폴더의 경로를 셋팅하라.


이제 당신은 실제 서비스를 생성할 준비가 됬다. 클라이언트를 생성할때 참조했던 WSDL 파일을 사용할 것이다. 이 파일에는 4개의 오퍼레이션(NoParameters, TwoWayOneParameterEcho, MultipleParametersAddItem, DoInOnly)이 있다. Code Listing 14 에서 처럼 WSDL2Java 유틸리티를 사용해 서비스를 생성하라.

Code Listing 14 - Using the WSDL2Java Utility to Generate the Service

--------------------------------------------------------------------------------------------------------------------


java org.apache.axis2.wsdl.WSDL2Java -uri
file:///C:/apps/axis2/samples/zSample/Axis2UserGuide.wsdl -p
org.apache.axis2.axis2userguide -o target_directory_name -d adb -s -wv 1.1 -ss -sd


이 명령문은 유틸리티에게 당신이 생성하기 원하는 Axis2UserGuide.wsdl 안에 있는 오퍼레이션의 서비스를 알려준다. 그리고 생성된 자바 클래스들은 org.apache.axis2.axis2userguide 패키지 안에 놓여질 것이다 (-p). (당신은 적절한 디렉토리들을 볼수 있다. code listing 14 에 지정된 "target_directory_name" 디렉토리 안에 깔끔하게 정리된 이 디렉토리들이 생성될 것이다. 만약 이 디렉토리가 존재하지 않으면 생성될 것이다.) 이것은 또한 Axis2 DataBinding Framework(ADB)을 사용하라고 가리킨다 (-d). synchronous(blocking) 코드를 생성하고 (-s), 클라이언트에 대응하는 server-side 코드를 생성하고 (-ss). services.xml service descriptor 파일을 포함하라고 가리킨다 (-sd). 이것은 또한 WSDL 파일의 버젼을 1.1로 명세한다 (-wv).


이제, 당신이 선택한 디렉토리안에 3개의 새로운 아이템들이 보일 것이다: build.xml은 Ant를 위한 지시들을 포함하고있다. src 디렉토리는 모든 생성된 클래스들과 stub들을 포함하고 있다. resources 디렉토리는 다시 생성된 버젼의 WSDL 파일을 포함한다. services.xml 파일은 궁극적으로 서비스의 행동을 제어한다.


이제 당신은 서비스를 컴파일 할 수 있다, 그러나 실제로 아직까지 아무일도 하지 않았다. 당신은 src\org\apache\axis2\axis2userguide\Axis2UserGuideServiceSkeleton.java 파일을 열어 굵은 글씨의 코드를 수정해 그 문제를 해결 할 수 있다. -- 파라미터 갯수를 관리하는것을 확실히 하라 -- 또는 아래의 Code Listing 15 의 모든 코드를 교체할 수 있다.



Code Listing 15 - Compiling the Service

--------------------------------------------------------------------------------------------------------------------


------------------------------------------------------------------------------------------------------------

/**
 * Axis2UserGuideServiceSkeleton.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis2 version: SNAPSHOT Oct 15, 2006 (11:23:18 GMT+00:00)
 */
package org.apache.axis2.axis2userguide;

/**
 *  Axis2UserGuideServiceSkeleton java skeleton for the axisService
 */

public class Axis2UserGuideServiceSkeleton {
         
    /**
     * Auto generated method signature
     * @param param7
    */
    public  org.apache.axis2.axis2userguide.NoParametersResponse NoParameters
                                    (org.apache.axis2.axis2userguide.NoParametersRequest param7)        
  {
        System.out.println(param7);

        NoParametersResponse res = new NoParametersResponse();

        return res;
    }
         
    /**
     * Auto generated method signature
     * @param param9
    */
    public org.apache.axis2.axis2userguide.TwoWayOneParameterEchoResponse TwoWayOneParameterEcho
                                                 (org.apache.axis2.axis2userguide.TwoWayOneParameterEchoRequest param9)
    {
        System.out.println(param9.getEchoString());

        TwoWayOneParameterEchoResponse res = new TwoWayOneParameterEchoResponse();
        res.setEchoString(param9.getEchoString());

        return res;
    }
         
    /**
     * Auto generated method signature
     * @param param11
    */
    public void DoInOnly (org.apache.axis2.axis2userguide.DoInOnlyRequest param11)        
    {
        System.out.println(param11.getMessageString());
    }
         
    /**
     * Auto generated method signature
     * @param param12
    */

 
public org.apache.axis2.axis2userguide.MultipleParametersAddItemResponse MultipleParametersAddItem
                                                 (org.apache.axis2.axis2userguide.MultipleParametersAddItemRequest param12)
    {
        System.out.println(param12.getPrice());
        System.out.println(param12.getItemId());
        System.out.println(param12.getDescription());
        System.out.println(param12.getItemName());

        MultipleParametersAddItemResponse res = new MultipleParametersAddItemResponse();
       
        res.setSuccessfulAdd(true);
        res.setItemId(param12.getItemId());

        return res;
    }
    
}

------------------------------------------------------------------------------------------------------------

클라이언트를 생성하는 경우와 마찬가지로 모든 클래스들(MultipleParametersAddItemRequest와 TwoWayOneParameterEchoResponse 같은)은 유틸리티에 의해 생성된다. 그리고 skeleton 파일과 동일한 디렉토리 안에서 찾을수 있다. 그들은 response안의 엘리먼트의 컨텐츠의 값을 셋팅하는 setSuccessfulAdd()와  response안의 엘리먼트의 컨텐츠를 찾는 getItemName() 같은 함수를 포함하고 있다.

ant jar.server 명령문으로 파일을 저장하고 컴파일 하라.


모든 것이 잘 되면, 명령창에서 BUILD SUCCESSFUL 메세지를 볼 것이다. 그리고 새로 생성된 build/lib 디렉토리안에 Axis2UserGuideService.aar 파일을 볼수 있다.

사용자 삽입 이미지

이제 당신은 서비스를 서버에 디플로이 해야 한다. 이를 위해서는 Axis2UserGuideService.aar 파일을 어플리케이션 서버의 WEB-INF/services 디렉토리에 복사해 넣어라. (또한 당신은 관리 툴을 사용하기 위한 옵션도 가지고 있다. 더 많은 정보를 원하면 Web Administrator's Guide를 보라.)


그 서비스가 올바르게 디플로이 됬는지 확인하기 위해 http://<host>:<port>/axis2/services/listServices 페이지의 서비스 리스트를 확인하라.

사용자 삽입 이미지

이제 당신은 Generating Clients 문서에서 빌드한 클라이언트들 중 하나를 이용해 서비스에 접근할 수 있다.


 

2008년 3월 3일 월요일

Apache Axis2 Installation Guide

   
사용자 삽입 이미지
                   
사용자 삽입 이미지
 

Apache Axis2 Installation Guide


이 문서는 Axis2 배포 패키지에 대한 정보, 시스템 요구사항, 환경변수 셋팅, 설치 방법에 대한 상세한 설명이 있는 도구를 제공한다.


Send your feedback to: axis-dev@ws.apache.org. Prefix subject with [Axis2]. To subscribe to mailing list see here.


Contents

-------------------------------------------------------------------------------------------------------------------
    ● Download Axis2
    ● System Requirements
    ● Installation Using Standard Binary Distribution
        ○ Install the Apache Axis2 Binary Distribution
        ○ Starting up Axis2 Standalone Server
        ○ Building WAR File Using Standard Binary Distribution
        ○ Getting Familiar with the Axis2 Convenient Scripts

    ● Installing Axis2 in a Servlet Container
    ● Uploading Services
    ● Advanced
        ○ Axis2 Source Distribution
            ■ Setting up the Environment and Tools
            ■ Building Axis2 Binaries and WAR file Using the Source Distribution


Download Axis2

-------------------------------------------------------------------------------------------------------------------
Axis2 는 몇가지의 편리한 배포 패키지안에 배포되며 standalone 서버 또는 J2EE compliant 서블릿 컨테이너의 일부분으로 설치될수 있다. Axis2 는 Apache License (버젼 2.0) 으로 배포된다. 이 설치 가이드는 Standard Binary Distribution 을 이용하여 Apache Axis2 를 실행하는것에 초점을 맞출것이다.


Apache Axis2 1.1.1 버젼(최신)의 배포 패키지를 다운로드 하라.


Apache Axis2  모든 버젼의 배포 패키지를 다운로드 하라.


배포 패키지는 다음과 같은것들을 제공한다:


1. Standard Binary Distribution

-------------------------------------------------------------------------------------------------------------------
이것은 완벽한 버젼의 Axis2 이며 sample 과 convenient script 를 포함하고 있다.


Standard Binary Distribution 를 다운로드 하라.


2. WAR (Web Archive) Distribution

-------------------------------------------------------------------------------------------------------------------
이것은 대부분의 서블릿 컨테이너에 디플로이 될수 있는 Axis2 웹 어플리케이션이 될것이다.


Download WAR (Web Archive) Distribution


3. Documents Distribution

-------------------------------------------------------------------------------------------------------------------
이것은 하나의 패키지안에 있는 모든 문서를 포함할 것이다. 그 패키지는 이 프로젝트의 xdoc 과 Java API doc 을 포함한다.


Download Documents Distribution


4. Source Distribution

-------------------------------------------------------------------------------------------------------------------
이것은 Axis2 standard distribution 의 소스를 포함할 것이며 주로 advance 사용자들을 위한것이다.

$maven dist-bin 명령어를 이용해 소스로 부터 binary distribution 을 생성할수 있다.

이 명령어를 실행하기전에 당신은 Axis2 환경을 셋팅해야 한다.

Advanced section 에 단계적으로 binary distribution 을 생성하는 방법에 대한 상세설명이 있다.


Download Source Distribution


System Requirements

-------------------------------------------------------------------------------------------------------------------
    ● Java Development Kit (JDK) - 1.4 or later (For instructions on setting up the JDK in different operating systems,

        visit http://java.sun.com)


    ● Disk - Approximately 11 MB separately for standard binary distribution


    ● Operating system - Tested on Windows XP, Linux, Mac OS X, Fedora core, Ubuntu, Gentoo


    ● Build Tool-Apache Ant - To run samples and to build war from Axis2 binary distribution.

        Version 1.6.5 or higher (download).


    ● Build Tool-Apache Maven 1.x - Required only for building Axis2 from Source Distribution

        1.0.2 or higher in Maven 1.x series (download). Please download maven 1.x version.

        Axis2 does not support maven 2.


Installation Using Standard Binary Distribution

-------------------------------------------------------------------------------------------------------------------


1. Download and Install the Apache Axis2 Binary Distribution

-------------------------------------------------------------------------------------------------------------------
Java Development Kit (JDK) release (version 1.4 or later) 을 여기서 다운로드하고 설치하라.

release 에 포함된 설명서에 따라 JDK 를 설치하라.

JAVA_HOME 환경변수를 JDK 가 설치된 디렉토리 경로의 이름으로 셋팅하라.


Axis2 Standard Binary Distribution 을 다운로드하고 편리한 곳에 압축을 풀어라.

AXIS2_HOME 환경변수를 Axis2 의 디렉토리 경로의 이름으로 셋팅하라(예, /opt/axis2-1.1.1).


2. Starting up Axis2 Standalone Server

-------------------------------------------------------------------------------------------------------------------
Standalone Axis2 server 는 다음의 명령어 실행으로 시작할수 있다:


$AXIS2_HOME\bin\axis2server.bat (Windows)


$AXIS2_HOME/bin/axis2server.sh (Unix)


서버를 구동한 후 Axis2 에 포함된 기본 웹 서비스를 http://localhost:8080/axis2/services/ 에서 확인가능하다.


3. Building the Axis2 Web Application (axis2.war) Using Standard Binary Distribution

-------------------------------------------------------------------------------------------------------------------
여기에서 Apache Ant (version 1.6.5 or later) 를 다운로드 하고 설치하라. Ant release 에 포함된 설명서에 따라 설치하라.


ant build file (build.xml) 을 Axis2 home 디렉토리 아래의 webapp 디렉토리 안에 넣어라(예, $AXIS_HOME/webapp).

$AXIS2_HOME/webapps 폴더 안에서 "ant create.war" 를 실행해서 Ant build 를 실행하라.

$AXIS2_HOME/dist 디렉토리 안에서 생성된 axis2.war 를 발견할수 있다.

AXIS2_HOME/repository 안의 모든 service 와 module 들이 $AXIS2_HOME/conf/axis2.xml (Axis2 configuration) 과 함께 axis2.war 안에 포함될 것이다.


아래의 Installing Axis2 in a Servlet Container 부분을 보면 Axis2 web application 을 servlet container 에 디플로이 하는 방법을 알수 있다.


4. Getting Familiar with the Axis2 Convenient Scripts

-------------------------------------------------------------------------------------------------------------------
아래의 스크립트를 원하는 장소에서 실행하기위해 $AXIS2_HOME/bin 을 PATH 에 추가하라.


----------------------------------------------------------------------------------------------------------------

Script Name            Description

----------------------------------------------------------------------------------------------------------------
axis2.{bat|sh}         
Axis2 를 이용하는 web service client 를 실행하기위해 이 스크립트를 사용할수 있다. 이 스크립트는

                               Axis2 dependent libraries (AXIS2_HOME/lib 폴더 안에 있는 *.jar 파일들) 를 classpath 에 추가하고

                               Axis2 repository location (AXIS2_HOME/repository) 을 셋팅하고 Axis2 설정파일 위치

                               (AXIS2_HOME/conf/axis2.xml) 를 세팅한 후 "java" 명령어를 호출한다. 이렇게 함으로서 위의 모든

                               Axis2 specific parameter 들을 셋팅하는 것으로부터 자유로워질수 있다.                              


                               Usage : axis2.{sh.bat} [-options] class [args...]

----------------------------------------------------------------------------------------------------------------

axis2server.{sh|bat}  이 스크립트는 AXIS2_HOME/repository 를 Axis2 repository 로 이용하고

                               AXIS2_HOME/conf/axis2.xml 파일을 Axis2 설정파일로 이용하는 standalone Axis2 server 를 시작할 수

                               있다. 이것은 AXIS2_HOME/conf/axis2.xml 에 명시된 모든 transport listener 들을 시작할수 있다.


                               예를 들면, 만약 당신이 standalone Axis2 server 에 하나의 서비스를 디플로이 하고 싶으면 당신의

                               service archive 를 AXIS2_HOME/repository/services 디렉토리에 복사해 넣어라. 그런다음

                               AXIS2_HOME/conf/axis2.xml 의 "Transport Ins" section 으로 이동한다음 transport receivers 를

                               설정하라 (8080 포트에 simpleHttpServer 가 기본으로 지정되있다). 그런다음 이 스크립트를 호출하라.

----------------------------------------------------------------------------------------------------------------

wsdl2java.{bat|sh}   이 스크립트는 웹 서비스 호출을 관리하기 위한 WSDL 파일에 따라 자바 코드를 생성한다

                              (Client side Stubs). 또한 이 스크립트는 주어진 WSDL 에 따라 service skeleton 들을 생성할수 있다.


                               Usage: wsdl2java.{sh|bat} [OPTION]... -uri <Location of WSDL>


                               Eg: wsdl2java.sh -uri ../wsdl/Axis2Sample.wsdl


                               이 스크립트에 대한 더 자세한 참조는 여기서 찾을수 있다.

----------------------------------------------------------------------------------------------------------------

java2wsdl.{bat|sh}   이 스크립트는 주어진 자바 클래스로부터 적절한 WSDL 파일을 생성한다.


                              Usage: Java2WSDL.{sh|bat} [OPTION]... -cn <fully qualified class name>


                              Eg: Java2WSDL.sh -cn ../samples/test/searchTool.Search


                              이 스크립트에 대한 더 자세한 참조는 여기서 찾을수 있다.

----------------------------------------------------------------------------------------------------------------


Installing Axis2 in a Servlet Container

-------------------------------------------------------------------------------------------------------------------
어떤 배포본 이던지, 아래와 같이 J2EE compliant servlet container 에 Axis2 를 설치할수 있다:


    1. Axis2 Standard Binary Distribution 을 이용해 Axis2 WAR file 을 빌드하라. (아니면 axis2.war 를 다운로드 하던지

       Source Distribution 을 이용해 axis2.war 를 빌드할수있다.)


    2. servlet container 의 webapps 폴더에 war 를 집어넣어라. 대부분의 servlet container 들은 자동으로 war 를 설치할

       것이다. (어떤 서블릿 컨테이너는 새로운 웹 어플리케이션을 인식하기위한 재시작이 필요할수도 있다. 이것에 대한 더

       자세한 정보를 원하면 당신의 서블릿 컨테이너의 문서를 참조하라.)


    3. WAR 가 성공적으로 설치되고 나면 웹 브라우져로 http://<host :port>/axis2 를 열어 테스트 하라. 그러면 아래와 같이

       Axis2 웹 어플리케이션 홈 페이지가 보일것이다.

사용자 삽입 이미지



    4. 모든것이 자연스럽고 올바르게 됬는지 확인하기위해 "Validate" 링크를 이용하라. 만약 validation 이 실패하면 war 가

       올바르게 설치되것이 아니거나 어떤 필요한 jar 가 누락된 것이다. 실패할 경우 각각의 서블릿 컨테이너의 문서가 문제점을

       찾기위한 조언을 제공할것이다. 다음 페이지는 성공적인 validation 의 경우 보여진다. core Axis2 libraries 가 존재하는지

       확인하라.


사용자 삽입 이미지


Note: 특정 어플리케이션 서버가 제공하는 설치 정보는 그 어플리케이션 서버가 제공하는 설정 가이드를 참조하라.


Uploading Services

-------------------------------------------------------------------------------------------------------------------
또한 Axis2 Web application 은 서비스를 업로드하기위한 인터페이스를 제공한다. Apache Axis2 Web Administrator's Guide 에서 설명한데로 서비스 명세서에 따라 생성된 서비스의 jar 파일은 업로드 페이지를 이용해 업로드될수 있다.


사용자 삽입 이미지


업로드된 jar 파일들은 기본 서비스 디렉토리에 저장될 것이다. Axis2 에서는 <webapps>/axis2/WEB-INF/services 디렉토리가 된다. 일단 서비스가 업로드되면 즉시 설치될 것이다.


Axis2 가 hot deployment 를 지원하므로 service jar 를 파일 시스템을 통해 위에서 언급한 서비스 디렉토리에 직접 집어넣을수 있다. 또한 이것은 컨테이너의 재시작 없이 서비스가 자동으로 설치되도록 한다.


서비스의 성공적인 설치를 확인하기 위해 웹 어플리케이션 홈 페이지의 'Services' 링크를 이용하라. 성공적으로 설치된 서비스의 service 와 operation 들은 가능한 서비스 페이지에 보여진다.

사용자 삽입 이미지



만약 서비스가 deployment time error 가 발생하면 이 서비스들은 실패 서비스로 보여진다. 링크를 누르면 deployment fault error message(s) 를 볼수 있다.


사용자 삽입 이미지


Deployment time error message


사용자 삽입 이미지


Axis2 Administration 은 런타임에 모든 설정을 할수있으며 짧은시간안에 반영된다. 더 자세한 설명은 Axis2 Web Administration Guide 에서 볼수 있다.


Advanced

-------------------------------------------------------------------------------------------------------------------


Axis2 Source Distribution

-------------------------------------------------------------------------------------------------------------------
Source Distribution 을 사용한 binary 파일 (Standard Binary Distribution 으로 다운로드 가능하다) 과 axis2.war 파일 (WAR distribution 으로 다운로드 가능하다) 의 생성은 maven 명령어로 이루어진다.


필요한 jar 파일들은 distribution 에 포함되 있지 않으며 그들도 또한 maven 명령어의 실행을 통해 만들어진다. 이문서를 더 진행하기위해서는 Maven 을 설채해야 한다.


Setting Up the Environment and Tools

-------------------------------------------------------------------------------------------------------------------


Maven

-------------------------------------------------------------------------------------------------------------------
Axis2 build 는 Maven 을 기반으로 한다. source distribution 으로부터 Axis2 를 빌드하기위해 Maven 이 설치되어 있어야 한다. Maven 사이트에서 많은 설명서를 볼수 있다. 그러므로 이 가이드에서는 빠른 환경 설정을 위해 가장쉬운 방법을 설명한다. Maven 에 대해 더 많은것을 알고 싶으면 여기를 방문하라.


    ● MS Windows


    1. Maven Windows installer package 를 다운로드 하고 실행하라.
    2. 'Environment Variables' 를 설정하라. (시스템 변수 MAVEN_HOME 을 생성하고 path 를 수정하라.

        예: "C:\Program Files\Apache Software Foundation\maven-1.0.2"; path %MAVEN_HOME%\bin)
    3. JAVA_HOME 시스템 변수가 당신의 JDK 가 설치된 폴더로 셋팅되 있는지 확인하라.

        예, C:\Program Files\Java\jdk1.5.0_02

    4. 올바르게 설치됬는지 확인하기위해 'maven --version' 을 실행하라.



사용자 삽입 이미지


    ● Unix based OS (Linux etc)


tar ball 또는 zip archive 가 최선의 선택이다. archive 를 다운로드하고 선택한 디렉토리에 압축을 푼다음 MAVEN_HOME 환경변수를 셋팅하고 path 에 MAVEN_HOME/bin 을 추가하라. 유닉스 기반의 OS에 Maven 을 설치하기위한 더 많은 설명서를 보고 싶으면 여기를 방문하라.


maven 을 올바르게 설치한다음 Axis2 를 빌드할수 있다.


자주 사용되는 Maven 명령어들을 FAQs 페이지에 설명해 놨다.


Building Binaries and WAR File Using the Source Distribution

-------------------------------------------------------------------------------------------------------------------
Source Distribution 을 zipped archive 형태로 얻을수 있다. 모든 필요한 빌드 스크립트들은 source distribution 에 포함되있다.

선택된 디렉토리에 source archive 를 푼다음 특정 디렉토리로 이동한다음 maven 명령어를 실행하면 Axis2 jar 파일을 빌드할 것이다.


사용자 삽입 이미지


명령이 완료된 다음에 새로 생성된 "target" 디렉토리에서 binaries (이 경우 jar 파일들) 를 찾을수 있다.


Note: Maven 을 처음 빌드할때 (만약 maven repository 가 먼저 만들어져 있지 않으면) 필요한 jar 파일들을 다운로드하는데 시간이 조금 걸릴것이다. 그러나 성공적인 빌드들에는 영향을 미치지 않고 한번만 처리된다.


기본 maven build 는 Axis2 jar 파일만 빌드한다. WAR (Web Archive) 를 얻기위해서 maven war  명령어를 사용하라. 그러면 target 디렉토리안에 완벽한 axis2.war 파일을 생성할 것이다.


이 빌드 단계가 완료되면 binaries 는 디플로이될 준비가 된것이다.


-------------------------------------------------------------------------------------------------


원본 : http://ws.apache.org/axis2/1_1_1/installationguide.html


번역 : 김운주 ounju@naver.com