Egloos | Log-in


WSDL

WSDL(Web Services Description Language의 약자)은 웹 서비스 기술언어 또는 기술된 정의 파일의 총칭으로 XML로 기술된다. 웹 서비스의 구체적 내용이 기술되어 있어 서비스 제공 장소, 서비스 메시지 포맷, 프로토콜 등이 기술된다.

예제

WSDL 2.0 문서의 구조:

<?xmlversion="1.0"encoding="UTF-8"?><descriptionxmlns="http://www.w3.org/ns/wsdl"xmlns:tns="http://www.example.com/wsdl20sample"xmlns:whttp="http://www.w3.org/ns/wsdl/http"xmlns:wsoap="http://www.w3.org/ns/wsdl/soap"targetNamespace="http://www.example.com/wsdl20sample">  <!-- Abstract types -->   <types>      <xs:schemaxmlns="http://www.example.com/wsdl20sample"xmlns:xs="http://www.w3.org/2001/XMLSchema"targetNamespace="http://www.example.com/wsdl20sample">          <xs:elementname="request">            <xs:complexType>               <xs:sequence>                  <xs:elementname="header"maxOccurs="unbounded">                     <xs:complexType>                        <xs:simpleContent>                           <xs:extensionbase="xs:string">                              <xs:attributename="name"type="xs:string"use="required"/>                           </xs:extension>                        </xs:simpleContent>                     </xs:complexType>                  </xs:element>                  <xs:elementname="body"type="xs:anyType"minOccurs="0"/>               </xs:sequence>               <xs:attributename="method"type="xs:string"use="required"/>               <xs:attributename="uri"type="xs:anyURI"use="required"/>            </xs:complexType>         </xs:element>          <xs:elementname="response">            <xs:complexType>               <xs:sequence>                  <xs:elementname="header"maxOccurs="unbounded">                     <xs:complexType>                        <xs:simpleContent>                           <xs:extensionbase="xs:string">                              <xs:attributename="name"type="xs:string"use="required"/>                           </xs:extension>                        </xs:simpleContent>                     </xs:complexType>                  </xs:element>                  <xs:elementname="body"type="xs:anyType"minOccurs="0"/>               </xs:sequence>               <xs:attributename="status-code"type="xs:anySimpleType"use="required"/>               <xs:attributename="response-phrase"use="required"/>            </xs:complexType>         </xs:element>      </xs:schema>   </types>  <!-- Abstract interfaces -->   <interfacename="RESTfulInterface">      <faultname="ClientError"element="tns:response"/>      <faultname="ServerError"element="tns:response"/>      <faultname="Redirection"element="tns:response"/>      <operationname="Get"pattern="http://www.w3.org/ns/wsdl/in-out">         <inputmessageLabel="GetMsg"element="tns:request"/>         <outputmessageLabel="SuccessfulMsg"element="tns:response"/>      </operation>      <operationname="Post"pattern="http://www.w3.org/ns/wsdl/in-out">         <inputmessageLabel="PostMsg"element="tns:request"/>         <outputmessageLabel="SuccessfulMsg"element="tns:response"/>      </operation>      <operationname="Put"pattern="http://www.w3.org/ns/wsdl/in-out">         <inputmessageLabel="PutMsg"element="tns:request"/>         <outputmessageLabel="SuccessfulMsg"element="tns:response"/>      </operation>      <operationname="Delete"pattern="http://www.w3.org/ns/wsdl/in-out">         <inputmessageLabel="DeleteMsg"element="tns:request"/>         <outputmessageLabel="SuccessfulMsg"element="tns:response"/>      </operation>   </interface>   <!-- Concrete Binding Over HTTP -->   <bindingname="RESTfulInterfaceHttpBinding"interface="tns:RESTfulInterface"type="http://www.w3.org/ns/wsdl/http">      <operationref="tns:Get"whttp:method="GET"/>      <operationref="tns:Post"whttp:method="POST"whttp:inputSerialization="application/x-www-form-urlencoded"/>      <operationref="tns:Put"whttp:method="PUT"whttp:inputSerialization="application/x-www-form-urlencoded"/>      <operationref="tns:Delete"whttp:method="DELETE"/>   </binding> <!-- Concrete Binding with SOAP-->   <bindingname="RESTfulInterfaceSoapBinding"interface="tns:RESTfulInterface"type="http://www.w3.org/ns/wsdl/soap"wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/"wsoap:mepDefault="http://www.w3.org/2003/05/soap/mep/request-response">      <operationref="tns:Get"/>      <operationref="tns:Post"/>      <operationref="tns:Put"/>      <operationref="tns:Delete"/>   </binding>  <!-- Web Service offering endpoints for both the bindings-->   <servicename="RESTfulService"interface="tns:RESTfulInterface">      <endpointname="RESTfulServiceRestEndpoint"binding="tns:RESTfulInterfaceHttpBinding"address="http://www.example.com/rest/"/>      <endpointname="RESTfulServiceSoapEndpoint"binding="tns:RESTfulInterfaceSoapBinding"address="http://www.example.com/soap/"/>   </service></description>



--출처 : 위키백과

by 손둥번개 | 2008/09/09 11:10 | 기타 | 트랙백 | 덧글(0)

Microsoft SOAP Toolkit

Microsoft SOAP Toolkit

This section shows you how to write a SOAP client using the Microsoft SOAP Toolkit. The MS SOAP Toolkit is a set of DLLs which can be exploited from an any language within the COM (Component Object Model) family (as long, of course, as the executable is running on a Win32 system). The language we will be looking at in this tutorial is Visual Basic.
이 섹션에서 Microsoft SOAP Toolkit을 사용하여 어떻게 SOAP client를 작성하는지 여러분에게 보여줄 것이다. MS SOAP Toolkit은 COM Family안에서그 어떠한 언어도도 개발될 수 있는 DLLs 세트이다. 개발할 언어로 우리는 비주얼베이직을 사용한 튜토리얼을 보여줄 것이다.

Introduction
We will be writing a very simple VB SOAP client which will exploit the Quotation Service as described and developed in the Section 4 of Server-Side SOAP.
우리는 Server-Side SOAP에서 개발하고 서술한 Quotation을 사용하는 아주 간단한 VB SOAP을 작성할 것이다.


The SOAP-related VB code in the client we will develop here can easily be incorporated into a VB Macro to SOAP-enable an Excel Spreadsheet. We will take a look at how to do that as well. While it is true that you can exploit the MS SOAP Toolkit DLLs from many languages other than VB, it is not our intention to cover them all.
클라이언트의 VB와 관련된 SOAP 코드는 하나의 엑셀 스프레드시트 SOAP-enable에 VB Macro를 병합하여 손쉽게 개발할 수 있다. 우리는 아주 자세시 어떻게 개발하는지 볼 수 있다. 여러분이 많은 다른 VB 언어로 MS SOAP DLLs를 사용할수 있는 것은 사실이지만, 여기에서 모든것을 다루지는 않는다.


As is the case when writing clients to any SOAP service, ensure in advance that you are familiar with the service and its method signatures.
그 어떤 SOAP 서비스에 대해 작성하는 경우에는 더 향상되게 하기 위해 여러분은 서비스와 메소드 서명에 대해 친숙해야 한다.


We will build a single VB client which will exploit all three service methods.
우리는 세가지 서비스 메소드 모두를 사용하는 VB 클라이언트를 개발할 것이다.


Note that there are actually two APIs in the Microsoft SOAP Toolkit. They are the so-called High Level API (which involves the use of wsdl and wsml files for service description) and the Low Level API (which does not require the preparation of such files and is as a result more verbose in terms of code but at the same time more powerful). The API used in this tutorial is the Low Level API.
Microsoft SOAP Toolkit에서 실제로 두 개의 API가 있다. 그들은 High Level API 과 Low Level API가 있다. 이 튜토리얼에서는 Low Level API 를 사용했다.

 

Check your Visual Basic Version
You will need Visual Basic 6.0 Service Pack 4 or later (this is the version delivered with Visual Studio 6.0 Service Pack 4). To check your version open up Visual Basic and choose Help / About Microsoft Visual Basic.
여러분은 Visual Basic 6.0 Service Pack 4 혹은 그 이상의 버전을 필요로 한다. 여러분의 VB를 실행하고 Help / About Microsoft Visual Basic 를 선택하여 버전을 확인하길 바란다.


If you have Visual Basic 6.0 but are at an earlier Service Pack level you can download SP4 from Microsoft Product Support Services.
만약 VB 6.0를 사용하지만 이전 버전의 서비스 펙이면 여러분은 SP4(혹은 이상 버전)을 다운로드 받아야 한다.


If you have a version prior to 6.0, or do not have Visual Basic at all, unfortunately, unlike the rest of the packages used on this site, you cannot download it for free. You can however still go through the source code here and run the VB demo found in the Demo Section.
여러분이 만약 6.0 이전의 버전 혹은 VB를 가지고 있지 않다면, 불행하게도 이 사이트의 팩키지를 사용할 수 없다. 여러분은 vb 6.0을 공짜로 다운로드 할 수 없다. 그러나 여전히 여기 소스 코드를 사용하고 그리고 Demo 섹션에서 VB 데모를 실행할 수 있다.


Installing the MS SOAP Toolkit
Before you install the actual toolkit, you will need to ensure that you have the following on your system:
여러분은 실제 Toolkit을 설치하기 전에, 여러분의 시스템에서 다음을 따르기 위한 확실한 방법이 필요할 것이다.


    * Internet Explorer 5.5 or later (this will ensure you have the correct version of the HTTP connector libraries) - if you have a prior version then 5.5 can be downloaded free of charge from Microsoft's IE download page.
    * Microsoft Installer (MSI) functionality (which allows you to run the SOAP toolkit installer) - this comes standard with Windows 2000 and Windows Me so users of these systems will not need to do anything. If you are using Windows NT then download MSI 1.1+ for NT. If you are using Win95 or Win98 then download MSI 1.1+ for Win9x.
- 인터넷 익스플로러 5.5 혹은 그 이상 버전
- Microsoft Installer (MSI) functionality


Now for the toolkit itself. We will be using Microsoft SOAP Toolkit 2.0 SP2. To install this on your machine go to the MS SOAP Toolkit download area and choose the download entitled "Soap Toolkit 2.0 SP2", read and accept the license agreement (if you are happy with the terms) and save the file to your machine. You should now have a file called soaptoolkit20.exe. This is a self-extracting executable that exploits MSI functionality. Run it and follow the onscreen instructions to install the toolkit. When asked, opt for the COMPLETE install.
우리는 Microsoft SOAP Toolkit 2.0 SP2를 사용할 것이다. 여러분의 컴퓨터에 이것을 설치하는 것은 MS SOAP Toolkit download 페이지로 가서 Soap Toolkit 2.0 SP2 선택하고, 라이센스에 동의해서 여러분의 시스템에 저장할 수 있다. 지금 여러분은 soaptoolkit20.exe 를 실행해야 한다. 이 파일은 MSI functionality를 사용하여 자동적으로 설치될 것이다.

Understanding the API
Following is the bare-essentials VB code required to exploit the API. It is paraphrased from the VB source downloadable further down this page. Note that we have chopped out just the SOAP-related code, so what you see when you open up the downloaded source will be basically the same but slightly rearranged and more verbose to handle the GUI aspects of the client (which we will not bother to explain as they are trivial). Follow these steps in order to invoke a service via the API:
다음의 bare-essentials VB 코드는 API를 사용하는 것을 요구한다. 이것은 이 페이지 더 아래에서 다운로드 할 수 있는 VB 소스를 의역한 것이다. (바꾸어 설명하다) 우리는 SOAP-related 코드에서 손을 땔 것이지만, 여러분은 다운로드한 소스을 열어 기본적으로 같은 것을 볼수 있지만, 배열하고 클라이언트의 GUI를 다르는 좀 더 많은 것을 해야 한다. API를 통해서 서비스를 인보크 하기 위해 이러한 과정을 밟아야 한다.

    * Define some constants which will be used to build the SOAP Envelope (if you want to know more about these URLs see the section on SOAP Messages) as well as your service identification data (SOAP Server URL, Service URI and service method name).
여러분의 서비스의 동일한 데이터 뿐만아니라 SOAP Envelope 를 빌드하여 사용할 수 있는 어떠한 일정한 것을 정의 해야 한다.
        Private Const ENC = "http://schemas.xmlsoap.org/soap/encoding/"
        Private Const XSI = "http://www.w3.org/1999/XMLSchema-instance"
        Private Const XSD = "http://www.w3.org/1999/XMLSchema"
        URL = "http://localhost:8080/soap/servlet/rpcrouter"
        URI = "urn:QuotationService"
        Method = "getQuotationsByAuthor"

    * Instantiate your SOAP Connector, Serializer and Reader. The Connector will handle the HTTP Connection, the Serializer will help you build the SOAP Envelope and the Reader will help you to access the result.
여러분의 SOAP Connector, Serializer and Reader 초기화 해야 한다. 이 커넥터는 HTTP 커넥션으로 다룰 것이다. Serializer 는 여러분이 SOAP Envelope를 빌드 하는것을 도와 줄 것이며 Reader는 여러분이 그 결과를 사용할 수 있게 도와준다.
        Dim Connector As SoapConnector
        Dim Serializer As SoapSerializer
        Dim Reader As SoapReader
        Set Connector = New HttpConnector
        Set Serializer = New SoapSerializer
        Set Reader = New SoapReader

    * Prepare the Connector to talk to the SOAP Server. Note that the "SoapAction" data is not consequential on the server side so the contents can be anything at all - It is a good idea to set it to the URI and Method name for easier identification when you are debugging and reading the SOAP messages.
사전에 SOAP Server의 커넥터를 준비 해야 한다. "SoapAction" 데이타는 서버사이드에서는 당연하지 않지만, 그 내용은 그 어떠한 모든 것을 할 수 있다. 이것은 여러분이 SOAP 메시지를 읽고 디버깅할 때 좀 더 쉽게 확인할 수 있는 URI과 메소드 이름을 세트 하는 좋은 생각이다.
        Connector.Property("EndPointURL") = URL
        Call Connector.Connect
        Connector.Property("SoapAction") = URI & "#" & Method
        Call Connector.BeginMessage

    * Associate your Serializer with your Connector.
여러분의 Serialize와 Connector를 관련시키다.
        Serializer.Init Connector.InputStream

    * Start the SOAP Envelope and specify the Encoding and XML-Schema.
SOAP Envelope를 시작하고 Encoding 과 XML -Schema를 명시한다.
        Serializer.startEnvelope , ENC
        Serializer.SoapNamespace "xsi", XSI
        Serializer.SoapNamespace "SOAP-ENC", ENC
        Serializer.SoapNamespace "xsd", XSD

    * Start the body of the message - the root element is always the Service URI and method.
메시지의 바디를 시작한다. 루트 원소는 항상 서비스 URI와 메소드여야 한다.
        Serializer.startBody
        Serializer.startElement Method, URI, , "method"

    * Write each method parameter out as a child to the root element.
루트 원소에 차일드는 각각의 메소드 파라미터에 대해 적어야 한다.
        Serializer.startElement "Author"
        Serializer.SoapAttribute "type", , "xsd:string", "xsi"
        Serializer.writeString "Wilde, Oscar"
        Serializer.endElement

    * End the root element, the body and the envelope.
루트 원소의 끝에 body와 envelope를 위치한다.
        Serializer.endElement
        Serializer.endBody
        Serializer.endEnvelope

    * Ending the message causes it to be sent.
보냈다면 메시지 끝을 종료 해야 한다.
        Connector.EndMessage

    * Load the result into the Reader.
리더안에 결과를 로드 하라.
        Reader.Load Connector.OutputStream

    * If no fault loading the Reader then you can go ahead and pull the result of the invocation out of the DOM (Document Object Model) contained in the reader. There are many ways to do this ranging from methods highly specialised to the task at hand (and thus quite efficient) to more general and reusable methods that are not so efficient (like the method you will see in the downloadable source).
만약 결점없이 리더를 로드하면 여러분은 실행할 수 있고 리더안에 포함된 DOM 밖에서 인보케이션(주문?)의 결과를 끌어 당길 것이다. 여기에
        If Not Reader.Fault Is Nothing Then
          MsgBox Reader.faultstring.text, vbExclamation
        Else
          Set Result = Reader.DOM
          //parse the DOM to extract the result set
        End If

Writing the Client
First, download the source code zip file (the VB forms) for the Visual Basic Quotation Service Client. Extract the entire contents of the zip to the directory of your choice. Then open up Visual Basic and Create a new project (of type Standard EXE), remove the default form and add ALL THREE downloaded forms to the project. Ensure that you set the main form (main.frm) to be the Startup Object (use: Project Properties / General tab). Before running you will need to add references to the MS SOAP Toolkit DLLs. Once done they should look like this (the last four references being the ones to add):
client-4 diagram-1

Running the Client
You can either compile the project into an executable and run that or just run it from within Visual Basic. The interface is fairly straightforward and does not require any explanation. Once again, the code as is presumes that you have the Quotation Service running on your machine (at localhost:8080). If this is not the case then you can run the clients against our demo SOAP server. To do this simply replace localhost:8080 with services.xmethods.net in the in the space provided for the URL. For more information on our demo server, refer to the Demo Section.

Incorporating into Microsoft Excel
It is relatively simple to incorporate the code that we have just written into Microsoft Excel as a VB Macro. Download and open up this Excel Spreadsheet [note: right click this link and save the file to your hard drive] to have an idea how this is done (note that, if asked by Excel, you will have to enable macros for this to run correctly). Take a look at the code behind the "Get All Quotations" button. Notice that all we really did was take the code from the VB example above and change it to read input and push output to the excel sheet rather than the VB form. Only the getAllQuotations method is implemented in this spreadsheet. It is left as an exercise for the reader to implement the other methods. For those not familiar with the VB Macro interface you will need to add the "Control Toolbox" Toolbar (see Tools/Customize/Toolbars), then activate Design Mode by hitting the blue set-square button. You will then be able to right click the "Get All Quotations" button on the spreadsheet and view the related code. Notice that the same four SOAP Toolkit DLLs have been added as project references (on the VB Macro Editor see Tools/References). Again, the code as is presumes that you have the Quotation Service running on your machine (at localhost:8080). If this is not the case then you can run the clients against our demo SOAP server. To do this simply replace localhost:8080 with services.xmethods.net in the in the space provided for the URL.

[ Nicholas Quaine ]

by 손둥번개 | 2008/08/28 14:08 | SOAP | 트랙백 | 덧글(0)

keytool 사용법

출처 - http://struts.linuxstudy.pe.kr/bbs/view.php?id=security&no=4



영어 원본 - http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/keytool.html



KEYTOOL - Key and Certificate Management Tool


private키및 그와 관련된 X.509인증고리를 관리한다. 또한 신뢰하는 인증서도 관리한다.

SYNOPSIS

keytool [commands]
DESCRIPTION

keytool은 키와 인증서를 관리하는 유틸리티이다.
keytool은 자신만의 개인키/공개된키 및 자신이 권한을 부여한 인증서를 관리할 수 있게하며, 자료의 보장과 전자서명에의한 인증을 관리할수 있게 하여준다.

인 증서는 특정인이나 회사로부터 전자서명된 하나의 객체로 공개된키와 또다른 정보를 가지고 있다. data가 전자서명되었을때에, 전자서명은 자료의 무결성과 신빙성을 위하여 검사된다. 무결성의 의미는 자료가 수정되거나 조작되지 않았다는것을 의미하고, 신빙성은 생성자로부터 보내어진 화일이 맞다는것을 의미한다.

keytool은 키와 인증서를 keystore라고 하는곳에 저장한다. 디폴트 keystore구현은 keystore를 화일로 구현하며, 비밀번호로 개인키를 보호한다.

jarsigner 에서는 Java ARchive(JAR)화일을 위한 전자서명을 생성하거나 확인하기 위하여 keystore를 사용한다. jarsigner는 JAR화일과 함께있는 인증서를 이용하여 JAR화일의 전자서명을 검증하고, 인증서의 공개키가 신뢰할수 있는지를 검사한다.
Note: keytool과 jarsigner는 JDK1.1의 javakey를 대체한다. 이 두가지 도구는 kavakey보다 많은 기능을 제공한다. jdk1.1.의 kavakey에서 사용하던 identify database는 keytool의 identitydb 명령어로 keystore로 저장할수 있다.



KeyStore Entries
keystore에는 두가지 다른 형태의 entries가 존재한다.
key entries - 아주 섬세안 암호화키 정보를 저장하고 있다. 이것은 불법적인 접근을 막기위하여 보호된 형태로 저장된다. 실질적으로 이키는 비밀키(개인키)와 인증서고리와 함께 오는 공개키를 저장한다. keytool과 jarsigner는 후자(공개키)만을 사용한다.(뒤에 뭐라고 있는데 모르겠다....)
trusted certificate entries - 또다른 곳에 속하는 하나의 공개키를 저장한다. 이것은 "trusted certificate"하고 하는것으로 keystore의 주인이 그 공개키를 신뢰할수 있다고 인정하는 경우에 keystore에 저장한다.

Keystore Aliases
모든 keystore 엔트리는 유일한 별명을 이용해서 접근한다. 별명은 대소문자를 구분하지 않으므로, Hugo와 hugo는 같은엔트리를 의미한다.

별 명은 keystore에 새로운 엔트리를 저장할때에 지정한다. -genkey는 새로운 키를 생성할때 사용하며, -import는 인증서나 인증서고리를 keystore에 저장할때에 사용하며 -alias를 이용하여 별명을 지정한다. 나중에 keytool에서는 반드시 동일한 별명으로 각가의 엔트리를 참조할수 있다.
예를들어, 다음의 명령어로 self-sign된 인증서의 비밀키/공개키를 생성하면,

keytool -genkey -alias duke -keypass dukepassword

다음에 비밀번호를 바꾸려고 할때에는 다음 명령어처럼 별명을 주고 사용한다.

keytool -keypasswd -alias duke -keypass dukekeypasswd -new newpass



Keystore Location
모든 keytool의 명령은 -keystore선택사항을 이용하여 keystore의 위치를 지정할수 있다. 미리정의된 keystore의 이름과 위치는 사용자의 홈디렉토리에 .keystore로 되어있다.

C:WinntProfilesuNmae (다중사용자 NT시스템)
C:WindowsProfilesuNmae (다중사용자 Windows 95시스템)
C:Wdindows (단일사용자 Windows 95시스템)



Keystore Creation
keystore 는 -genkey나 -import또는 -identitydb명령어에의해서 생성될수 있다. -keystore옵션을 사용하면 새로운 위치에 keystore를 생성할수 있다. 만약 -keystore옵션을 사용하지 않으면 기본적인 keystore는 .keystore라는 이름으로 사용자의 홈디랙토리에 생성된다.

Keystore Implementation
Keystore 클래스에 관한 내용.......생략

Supported Algorithms and Key Sizes
keytool 은 등록된 Cryptographic Service Providers를 이용해서 비밀키/공개키를 생성할수 있도록 하여준다. keyalg와 sigalg선택사항을 이용하여 여러가지 다른 알고리즘을 사용할수 있다. 미리정의된 키쌍의 생성알고리즘은 "DSA"이며 서명알고리즘은 비밀키의 알고리즘에따라서 선택할수 있다. 만약 비밀키의 형태가 "DSA"이면, 미리정의된 서명 알고리즘은 "SHA1withDSA"이고, "RSA"이면 "MD5withRSA"로 서명알고리즘을 사용한다.

DSA를 이용하는 키쌍을 생성할때에는 512부터 1024비트의 키사이즈를 사용하여야 하며, 반드시 64의 배수이여야 한다. 기본적으로는 1024를 사용한다.

Certificates
인증서(공개키 인증서)는 전자서명된 문장이다
인증서와 관련하여 나오는 용어를 정리하면, 다음과 같다.


Public Keys
특정엔트리에 연관된 숫자들로, 모든사람이 신뢰할수 있도록 배포된다. 또한 public key는 전자서명의 검증에 사용된다.
Digitally Signed
Identity
Signature
Private Keys
Entity
원본 : Keytool 사용법

by 손둥번개 | 2008/08/06 17:40 | 트랙백(1) | 덧글(0)

◀ 이전 페이지          다음 페이지 ▶