Spring Framework/Project
[SOAP]프로젝트 생성 방법
johye0
2022. 2. 14. 21:57
반응형
SOAP 프로토콜 송수신 프로젝트를 생성하는 방법에는 Springframework를 이용하는 것이 있다.
[spring-ws-core], [wsdl4j] Dependency를 추가하여 개발하는 방법으로, 서비스를 제공하고 데이터를 처리하는 Server / 서비스를 요청하고 데이터를 전송하는 Client 별로 프로젝트를 각각 생성하여 SOAP Web Service를 개발할 수 있다.
프로젝트를 생성하는 방법은 Spring Docs에서 친절히 설명해주고 있으며, 사실 내가 개발한 프로젝트는 이 방법을 사용하지 않았으므로 주소만 정리 후 넘어갈 생각이다.
아래 방법을 사용하지 않은 이유중에 가장 큰 이유는, 새로운 서비스를 생성하기 위하여 XSD 파일을 생성해줘야 하기 때문이다. (아래와 같은 XSD파일을 직접 생성해줘야 한다.)
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://spring.io/guides/gs-producing-web-service"
targetNamespace="http://spring.io/guides/gs-producing-web-service" elementFormDefault="qualified">
<xs:element name="getCountryRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="getCountryResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="country" type="tns:country"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="country">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="population" type="xs:int"/>
<xs:element name="capital" type="xs:string"/>
<xs:element name="currency" type="tns:currency"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="currency">
<xs:restriction base="xs:string">
<xs:enumeration value="GBP"/>
<xs:enumeration value="EUR"/>
<xs:enumeration value="PLN"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
원하는 서비스나 파라미터를 클래스로 생성해두면 알아서 WSD 파일이 생성되면 얼마나 좋을까 생각하였고, 긴 구글링 끝에 ApacheCXF + Springframework 조합으로 생성하는 방법을 알아냈다!!
이 방법은 다음 포스팅부터 정리해 보도록 한다.
1. Producing a SOAP web service
https://spring.io/guides/gs/producing-web-service/
2. Consuming a SOAP web service
https://spring.io/guides/gs/consuming-web-service/
반응형