288.5. 예제
이 예에서는 SAP의 비행 데모 예제를 사용하며, 여기에서 인터넷을 통해 온라인으로 사용할 수 있습니다.
아래 경로에서 다음 URL을 사용하여 SAP NetWeaver 데모 서버를 요청합니다.
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')
지정된 항공편에 대한 자세한 내용은 다음을 참조하십시오. 명령 구문은 MS ADO.Net Data Service 형식으로 되어 있습니다.
다음 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 출력이 표시됩니다.