290.6. 예
이 예에서는 여기에서 인터넷을 통해 온라인으로 사용할 수 있는 SAP의 연결 데모 예제를 사용하고 있습니다.
아래 경로에서는 다음 URL을 사용하여 SAP NetWeECDHE 데모 서버를 요청합니다.
https://sapes1.sapdevcenter.com/sap/opu/odata/IWBEP/RMTSAMPLEFLIGHT_2/
https://sapes1.sapdevcenter.com/sap/opu/odata/IWBEP/RMTSAMPLEFLIGHT_2/
다음 명령을 실행하려고 합니다.
FlightCollection(AirLineID='AA',FlightConnectionID='0017',FlightDate=datetime'2012-08-29T00%3A00%3A00')
FlightCollection(AirLineID='AA',FlightConnectionID='0017',FlightDate=datetime'2012-08-29T00%3A00%3A00')
지정된 터미널에 대한 세부 정보를 얻으려면 다음을 수행하십시오. 명령 구문은 MSECDHE.Net 데이터 서비스 형식입니다.
Camel 경로는 다음과 같습니다.
from("direct:start") .setHeader(NetWeaverConstants.COMMAND, constant(command)) .toF("sap-netweaver:%s?username=%s&password=%s", url, username, password) .to("log:response") .to("velocity:flight-info.vm")
from("direct:start")
.setHeader(NetWeaverConstants.COMMAND, constant(command))
.toF("sap-netweaver:%s?username=%s&password=%s", url, username, password)
.to("log:response")
.to("velocity:flight-info.vm")
여기서 url, username, password 및 command는 다음과 같이 정의됩니다.
private String username = "P1909969254"; private String password = "TODO"; private String url = "https://sapes1.sapdevcenter.com/sap/opu/odata/IWBEP/RMTSAMPLEFLIGHT_2/"; private String command = "FlightCollection(AirLineID='AA',FlightConnectionID='0017',FlightDate=datetime'2012-08-29T00%3A00%3A00')";
private String username = "P1909969254";
private String password = "TODO";
private String url = "https://sapes1.sapdevcenter.com/sap/opu/odata/IWBEP/RMTSAMPLEFLIGHT_2/";
private String command = "FlightCollection(AirLineID='AA',FlightConnectionID='0017',FlightDate=datetime'2012-08-29T00%3A00%3A00')";
암호가 잘못되었습니다. 먼저 데모를 실행하려면 SAP에서 계정을 만들어야 합니다.
속도 템플릿은 기본 HTML 페이지에 대한 응답을 포맷하는 데 사용됩니다.
애플리케이션을 실행하면 sampel 출력이 표시됩니다.