블로그 이미지
평범하게 살고 싶은 월급쟁이 기술적인 토론 환영합니다.같이 이야기 하고 싶으시면 부담 말고 연락주세요:이메일-bwcho75골뱅이지메일 닷컴. 조대협


Archive»


 
 

WCF가 몬가 했더니..

프로그래밍/C# & .NET | 2010.06.25 11:52 | Posted by 조대협
간단하게 튜토리얼 보고 테스트 프로그램 하나 짜서 송수신 전문을 봤더니...

송신 전문
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:s="http://www.w3.org/2003/05/soap-envelope">
  <s:Header>
    <a:Action s:mustUnderstand="1">http://tempuri.org/IEvalService/GetEvals</a:Action>
    <a:MessageID>urn:uuid:489b8c48-e094-418e-8f6b-60321ffc9d38</a:MessageID>
    <a:ReplyTo>
      <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
  </s:Header>
  <s:Body>
    <GetEvals xmlns="http://tempuri.org/" />
  </s:Body>
</s:Envelope>

수신 전문
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <s:Header>
    <a:Action s:mustUnderstand="1" u:Id="_2">http://tempuri.org/IEvalService/GetEvalsResponse</a:Action>
    <a:RelatesTo u:Id="_3">urn:uuid:dfac6ed4-fbcc-46d6-9fd8-38ed4604aa4c</a:RelatesTo>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <u:Timestamp u:Id="uuid-20a62935-2716-472d-ba79-1581763744f3-17">
        <u:Created>2010-06-25T02:50:53.419Z</u:Created>
        <u:Expires>2010-06-25T02:55:53.419Z</u:Expires>
      </u:Timestamp>
      <c:DerivedKeyToken u:Id="uuid-20a62935-2716-472d-ba79-1581763744f3-7" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
        <o:SecurityTokenReference>
          <o:Reference URI="urn:uuid:9ab8a01d-b2fb-40b4-bcee-e057f49e1a93" ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" />
        </o:SecurityTokenReference>
        <c:Offset>0</c:Offset>
        <c:Length>24</c:Length>
        <c:Nonce>pxd/ozyLoq7PsUk2mw2X2A==</c:Nonce>
      </c:DerivedKeyToken>
      <c:DerivedKeyToken u:Id="uuid-20a62935-2716-472d-ba79-1581763744f3-8" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
        <o:SecurityTokenReference>
          <o:Reference URI="urn:uuid:9ab8a01d-b2fb-40b4-bcee-e057f49e1a93" ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" />
        </o:SecurityTokenReference>
        <c:Nonce>3eijqwLZYaqrBjcduAkjow==</c:Nonce>
      </c:DerivedKeyToken>
      <e:ReferenceList xmlns:e="http://www.w3.org/2001/04/xmlenc#">
        <e:DataReference URI="#_1" />
        <e:DataReference URI="#_4" />
      </e:ReferenceList>
      <e:EncryptedData Id="_4" Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
        <e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc" />
        <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
          <o:SecurityTokenReference>
            <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/dk" URI="#uuid-20a62935-2716-472d-ba79-1581763744f3-8" />
          </o:SecurityTokenReference>
        </KeyInfo>
        <e:CipherData>
          <e:CipherValue>OHkE4mba4bbl+afwbRxjKTDQfRazYw+KiMLjCYX/FpgZ3nKmgUbLlZGWe3Q6Z6x1zvIX5WstoP2Cy9U49LgoGkNvGqbaAqKkZBYmjuyWbrcNXnNwLVWo5OMxhSUOT0Kr9lwRTSUw/g1c83EnkD69tM0jsuYWlKiIVRjOJ5zcpIH86LHWXMlwcgpP1gdP1eX+XePKHG59vtl6B7XOVOQW7DSTdUI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/mUuQnCH/Hbcyl4FLP7WDtibD5iK1IfT84taSgzXNsn/PnBaI2hcmO76wSqIxKntsmyZwDvIHh139x2dXUsPDJoQEBwNDPSvue2xGFgsxjOw/8l+z/83TNSInwscDtxOsuUSaF/Yi/EsKRljfi/whDgz85eWvZpdw4gDVxGFEKvJzMfre1G47WQQCC52rAMEtw7aHrFS2AdHbzXGZmLHX336MmHxE09eAiwB2jkjoGdlPPuqlhxY65ZEiq2neALmtsCjXpv1ALll1YOqJve8bqZMO9g0prB++TFovGSNFa2EfGcVhKNA89Xh40BRqrNRA/eDdJDa3vC1kyI1JbyF/kPHiyJo7rqcWI+vNW5smflOprb1UGApqKYrDeKRJzFw9kVrxY17qXxWAQFnK6F3toK4yqGkwp1AwpVFTAS7W2tkuLujMtmwTX9TWXdIwWjEf+2VB1c2yEEuW9YJUMYztim+wEbCAUy/CFZJaugScDtWm+cbLersOq4Iq9xLua3uixxogPFxNGj4/Ha9prrmtAJdm+mzqPu5m92Wnb9wcAevw/nvqqc8AcFybDCdHPMtfbRsbnU1oaCGJRVPC1TK01Obsj8s6SWMLv3P5ygZZoUm7Bp7xirsP3LhFT4L+6/rqy9syMHAhyKjbv6o0EgRpKqPQbKz8nZk9QpzGKWnln23X/NfRDInwJODvIVBWP2txSW24WVzlXplcmdxmYiVcm1JTjeNREu5DruFYgVuoYwnfgRvWaN35X87kLs06Zl8Ryga8SO1D9BNkv5fCNV3W9xjubKGusuNHsbObkL/LwSGEonc0bkk+F+4HgTAdpVIQkMmu2ta5WC5YWpqeJVoj8F9RmmitF8rbzlBFJ2noptLAoy</e:CipherValue>
        </e:CipherData>
      </e:EncryptedData>
    </o:Security>
  </s:Header>
  <s:Body u:Id="_0">
    <GetEvalsResponse xmlns="http://tempuri.org/">
      <GetEvalsResult xmlns:a="http://schemas.datacontract.org/2004/07/EvalServiceLibrary" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <a:Eval>
          <a:Comments>Test Comment</a:Comments>
          <a:Id>7c88a50c-cb86-4a94-934a-8552532bc2db</a:Id>
          <a:Submitter>bycho</a:Submitter>
          <a:TimeSubmitted>2010-06-25T11:48:00</a:TimeSubmitted>
        </a:Eval>
      </GetEvalsResult>
    </GetEvalsResponse>
  </s:Body>
</s:Envelope>

웹서비스다... 설마 이게 다는 아니겄지... REST 구현 함 찾아봐야 쓰겄다.

Soap Handler

프로그래밍/XML 관련 | 2009.04.17 10:42 | Posted by 조대협

SOA 아키텍쳐중에 요건중의 하나가 웹서비스로 들어오고 나가는 데이타에 대한 Transformation과 Filtering이 문제인데, 일반적으로 ESB에서 이를 구현하고 결과적으로 과도한 XQuery로 성능저하로 아주 많은 문제를 일으키는 경우가 있는데, 이에 대한 대응 아키텍쳐로 SoapHandler를 사용해 보는 방법을 고려해볼 수 있다.

WebService는 일반적인 형태로 개발하고, Filtering이 필요할 경우 앞에 Filter의 기능에 따라서 SoapHandler를 붙이고 다른 endpoint를 부여 하는 방식을 사용할 수 있다.
자세한 내용은 여기에..


조만간 Reference implementation을 만들어봐야 겠다.

'프로그래밍 > XML 관련' 카테고리의 다른 글

XML 변환 성능  (0) 2009.04.17
Soap Handler  (0) 2009.04.17
WebLogic Workshop을 이용한 웹서비스 프로그래밍  (0) 2009.04.17
XMLBean  (3) 2008.12.22
JAX-WS를 이용한 쉬운 웹서비스 개발 방법  (0) 2008.12.12
XML에서 Namespace 제거하는 XSLT  (0) 2008.12.10
WebLogic Workshop에서 JAX-WS로, WebService 개발하기.
예전에 올렸던 동영상인데, 화질이 나쁘다는 피드백이 있어서 편집했는데. 어렵네요...

'프로그래밍 > XML 관련' 카테고리의 다른 글

XML 변환 성능  (0) 2009.04.17
Soap Handler  (0) 2009.04.17
WebLogic Workshop을 이용한 웹서비스 프로그래밍  (0) 2009.04.17
XMLBean  (3) 2008.12.22
JAX-WS를 이용한 쉬운 웹서비스 개발 방법  (0) 2008.12.12
XML에서 Namespace 제거하는 XSLT  (0) 2008.12.10
JAX-WS를 이용해서 웹서비스를 만드는 방법입니다.
영어로 작성했지만 내용은 쉽습니다.

Overview

This is a programming guide for component developer to make a webservice easily.

Technical Standard

This is webservice creation guide for component team.
We will use webservice development standard like this.

  • JAX-WS
  • JAXB

Standard IDE is WebLogic workshop 10.3. You can use any IDE that you want. JAX-WS is standard.WebLogic provides eaisest development environment. If you want to find any alternatives, i want to recommend CXF in Apache. It is easily integrated with Spring framework

Restriction

Here is webservice development restriction for more easy development

  • Synchronous WebService Call
    You can just use synchronous message exchange pattern. If you want to use async,pub-sub, or queuing etc. Please talk with Application Architect.
  • DataTypes in Value Object has a restriction.
    Because of we are using JAXB. We have a restriction to use data type in Value Object that is used as parameter or return type of webservice.
    Here is list of data type you can use it to define ValueObject
    Java Data Types XML Scheme Data Type
    boolean boolean
    byte byte
    double double
    float float
    long long
    int int
    String string
    java.math.BigInteger integer
    java.util.Calendar dateTime
    java.util.Data dateTime

    In addtion you properbly need a use a some of array type. Here is a guide. You have to remember that you cannot use Map or Hashtable data type. You have to covert the types into ArrayList etc.

    Java Data Types XML Scheme Data Type
    java.util.Collection Literal Array
    java.util.List Literal Array
    java.util.ArrayList Literal Array
    java.util.LinkedList Literal Array
    java.util.Vector Literal Array
    java.util.Stack Literal Array
    java.util.Set Literal Array
    java.util.TreeSet Literal Array
    java.utils.SortedSet Literal Array
    java.utils.HashSet Literal Array

Programming Steps

1. Make a ValueObject
Make a ValueObject.You can easily make a ValueObject with datatype decribed above.
You have to use some notation to provide more clarified WSDL generation.

Item.java
package osp.sample.valueObject;
import javax.xml.bind.annotation.*;
@XmlAccessorType(XmlAccessType.FIELD) @XmlType (propOrder={ "name", "price", "quantity"} )
public class Item { @XmlElement(required=true) String name;
@XmlElement(required=true) int price;
@XmlElement(required=true) int quantity;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public int getPrice() { return price; }
public void setPrice(int price) { this.price = price; }
public int getQuantity() { return quantity; }
public void setQuantity(int quantity) { this.quantity = quantity; }

}
  • First import java.xml.bind.annotation.* to use JAXB annotation
  • specify XmlAccessorType with XmlAccessType.FIELD
  • specify XmlType and propOrder. This for sequence of element generated by Java Class.
  • Each of java variable. Specify XmlElement and required=true. This is just for the Xml parsing performance. If the data type is List or Array. You don't have to specify XmlElement

2. Create WebService
Create WebService in WebLogic Workshop IDE and implement a Webservice.

OrderWebService.java
package bcho.sample.webservice;
import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService;

import bcho.sample.valueObject.PurchaseOrder;

@WebService public class OrderWebService {
@WebMethod public @WebResult(name="purchaseOrder")PurchaseOrder addOrder( @WebParam(name="purchaseOrder")PurchaseOrder po)
{ return po; }
}
  • You also import javax.jws.* to use JAX-WS annotation.
  • Use @WebService annotation into a class to declare the class is webservice.
  • Use @WebMethod annotation into method, the method will be automatically generated "operation" in webserivce.
  • Use @WebResult and @WebParam in return value and parameter. As i mentioned earlier, please use one result value and one result parameter.
    The name of @WebResult and @WebMethod should be equals with ClassName.

3. Run a Test
You can test a webservice in WebLogic Workshop IDE.

4. Package and deploy

  • After testing, in WebLogic Workshop . Select a project in Project explorer.
  • Click right button of Mouse and select Export.
  • Select war in export menu. The *.war file automatically generated.
  • Please delpoy the war file into Pilot Project environment (WebLogic Server)

Here is a short tutorial movie of WebService development.
[pilot:JAX-WS based Web Service Programming Guide^WebLogic 10.3 JAX-WS Creation guide.mpeg]

Reference

JAXB Development http://edocs.bea.com/wls/docs103/webserv/data_types.html#wp223908
JAX-WS WebService Development http://edocs.bea.com/wls/docs103/webserv/jws.html#program_jws_file