SOAP를 하는 방식은 많이 있지만 CM처럼 한번에 여러번 SOAP 접속을 해야하고 응답받는 XML을 파싱하기 힘들때 WSDL을 이용하여 SOAP를 개발하도록 한다.
장점 :
1. XML을 코딩으로 만들어 Request를 만들지 않아도 된다
2. 응답받은 XML을 코딩을 이용하여 parsing하지 않아도 된다 (어노테이션으로 객체로 불러와 데이터를 쉽게 받을 수 있다)
단점 :
1. 환경설정이 그지같다 (너무 어렵다)
2. 개발에 필요한 프로그램이 너무 많다
[환경설정 하기]
1. 필요 프로그램 :
- SOAP UI (오픈소스이며 SOAP를 통신하기 위한 테스트 작업과 cxf방식을 연동하여 class를 만들기 위해 필요)
- apach cxf 환경설정 파일 : http://www.apache.org/dyn/closer.lua/cxf/3.1.2/apache-cxf-3.1.2.zip
- eclipse
- java
2. CUCM으로부터 WSDL 파일 다운로드 받기
1) RISService70.xml (RealTime Information)
==> download URL : https://[CMIP]:8443/realtimeservice2/services/RISService70?wsdl
- selectCmDevice : Device에 대한 상세 정보를 가지고 온다.
- selectCMDeviceExt : accross Node 된 정보 (중복 정보)
- SelectCtiItem : Cisco CM Node의 CTI Manager 정보 (CTI Routing Point 정보??)
2) PerfmonService.xml
==>download URL : https://[CMIP]:8443/perfmonservice2/services/PerfmonService?wsdl
- perfmonAddCounter
- perfmonCloseSession
- perfmonCollectCounterData : Host에 등록되어있는 정보 Counter를 가지고 온다
- perfmonCollectSessionData
- perfmonListCounter
- perfmonListInstance
- perfmonOpenSession
- perfmonQueryCounterDescription
- perfmonRemoveCounter
3) ControlCenterServices.xml
==> download URL : https://[CMIP]:8443/controlcenterservice2/services/ControlCenterServices?wsdl
- getProductInformationList
- soapGetServiceStatus
- soapGetStaticServiceList
- soapDoControlServices
- soapDoServiceDeployment
ControlCenterServicesEx.xml
==> download URL : https://[CMIP]:8443/controlcenterservice2/services/ControlCenterServicesEx?wsdl
- getFileDirectoryList
- getStaticServiceListExtended
- soapDoControlServicesEx
- soapDoServiceDeploymentNoDbUpdate
4) LogCollectionPortTypeService.xml
==> download URL : https://[CMIP]:8443/logcollectionservice2/services/LogCollectionPortTypeService?wsdl
- listNodeServiceLogs
- selectLogFiles
DimeGetFileService.xml
==> download URL : https://[CMIP]:8443/logcollectionservice/services/DimeGetFileService?wsdl
- getOneFilel
3. apach cxf 환경설정
1) apach cxf 파일 다운로드 http://www.apache.org/dyn/closer.lua/cxf/3.1.2/apache-cxf-3.1.2.zip
2) 환경변수 설정
- 변수 이름 : CXF_HOME
- 변수 값 : C:\driverPath\apache-cxf-3.1.2
- 환경변수 PATH 수정
- %CXF_HOME%\bin
4. SOAP UI 프로그램을 이용하여 cxf을 이클립스의 소스 프로젝트로 넣어서 Java를 만든다
- WSDL을 import한 프로젝트에서 Apache CXF를 넣음
- Output Directory : 이클립스 소스위치를 지정한다
- package : 이클립스에서 src에서 Package를 생성한다.
- Tool : cxf파일 환경설정을 한다
tools눌렀을 경우 아래 그림 참조
- tools 에서 CXF 2x: 아파치 환경설정 한 위치를 넣어준다
5. 이클립스 설정
위에 설정까지 모두 마쳤다면 지정한 Class Package 안으로 java 파일이 만들어진다
이클립스에서는 따로 설정할 필요는 없으며 간단한 소스 코드를 넣어서 테스트를 실시한다.
6. 소스코드
- Basic Auth : 인증방식
- wsdl파일을 이용하여 Service에서 URL을 호출 할 경우 Service 부분에 인증 관련된 부분 삽입
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
package cxf.getPhone;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.Service;
/**
* This class was generated by Apache CXF 3.1.2
* 2015-09-24T16:44:33.428+09:00
* Generated source version: 3.1.2
*
*/
@WebServiceClient(name = "RISService70",
wsdlLocation = "file:/C:/Users/yjyoon/AppData/Local/Temp/tempdir2480626785582354837.tmp/RISService70_1.wsdl",
targetNamespace = "http://schemas.cisco.com/ast/soap")
public class RISService70 extends Service {
public final static URL WSDL_LOCATION;
public final static QName SERVICE = new QName("http://schemas.cisco.com/ast/soap", "RISService70");
public final static QName RisPort70 = new QName("http://schemas.cisco.com/ast/soap", "RisPort70");
static {
URL url = null;
//for localhost testing only
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(
new javax.net.ssl.HostnameVerifier(){
public boolean verify(String hostname,
javax.net.ssl.SSLSession sslSession) {
if (hostname.equals("[CMIP]")) {
return true;
}
return false;
}
});
try {
url = new URL("file:C:/Users/yjyoon/Documents/source_work/testSOAP/wsdl/RISService70.wsdl");
} catch (MalformedURLException e) {
java.util.logging.Logger.getLogger(RISService70.class.getName())
.log(java.util.logging.Level.INFO,
"Can not initialize the default wsdl from {0}", "file:/C:/Users/yjyoon/AppData/Local/Temp/tempdir2480626785582354837.tmp/RISService70_1.wsdl");
}
WSDL_LOCATION = url;
}
public RISService70(URL wsdlLocation) {
super(wsdlLocation, SERVICE);
}
public RISService70(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public RISService70() {
super(WSDL_LOCATION, SERVICE);
}
public RISService70(WebServiceFeature ... features) {
super(WSDL_LOCATION, SERVICE, features);
}
public RISService70(URL wsdlLocation, WebServiceFeature ... features) {
super(wsdlLocation, SERVICE, features);
}
public RISService70(URL wsdlLocation, QName serviceName, WebServiceFeature ... features) {
super(wsdlLocation, serviceName, features);
}
/**
*
* @return
* returns RisPortType
*/
@WebEndpoint(name = "RisPort70")
public RisPortType getRisPort70() {
return super.getPort(RisPort70, RisPortType.class);
}
/**
*
* @param features
* A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
* @return
* returns RisPortType
*/
@WebEndpoint(name = "RisPort70")
public RisPortType getRisPort70(WebServiceFeature... features) {
return super.getPort(RisPort70, RisPortType.class, features);
}
}
'Cisco > CUCM' 카테고리의 다른 글
CUCM - 3rd Party IVR 연동 문제 (0) | 2016.09.30 |
---|---|
Device Pool / Inter Cluster 의 상태 (0) | 2016.01.21 |
DB Replication 이 깨졌을 때 (0) | 2015.12.28 |
CUCM Sub Upgrade시 문제사항 (0) | 2015.12.28 |
CUCM AXL을 JAX-WS를 이용하여 설정하기 (0) | 2015.10.05 |