Repository navigation
Expand file tree
/
Copy pathSendProxyAsync.java
More file actions
84 lines (59 loc) · 2.52 KB
/
Copy pathSendProxyAsync.java
File metadata and controls
84 lines (59 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package org.job;
import java.util.logging.Logger;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.xml.ws.WebServiceRef;
import com.sap.engine.services.webservices.espbase.client.api.XIManagementInterface;
import com.sap.engine.services.webservices.espbase.client.api.XIManagementInterfaceFactory;
import com.sap.engine.services.webservices.espbase.client.api.XIMessageContext;
import com.sap.scheduler.runtime.JobContext;
import com.sap.scheduler.runtime.mdb.MDBJobImplementation;
import com.sap.xi.xi.demo.airline.BookingID;
import com.sap.xi.xi.demo.airline.FlightBookingOrderConfirmation;
import com.sap.xi.xi.demo.airline.FlightBookingOrderConfirmationOut;
import com.sap.xi.xi.demo.airline.FlightBookingOrderConfirmationOutService;
/**
* Message-Driven Bean implementation class for: SendProxyAsync
*
*/
@MessageDriven(activationConfig = {
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
@ActivationConfigProperty(propertyName = "messageSelector", propertyValue = "JobDefinition=\'SendProxyAsync\' AND ApplicationName=\'sap.com/FlightOutEAR\'") })
public class SendProxyAsync extends MDBJobImplementation {
@WebServiceRef(name = "FlightBookingOrderConfirmationOutService")
private FlightBookingOrderConfirmationOutService service;
/**
* @see MDBJobImplementation#MDBJobImplementation()
*/
public SendProxyAsync() {
super();
// TODO Auto-generated constructor stub
}
@Override
public void onJob(JobContext jobContext) throws Exception {
Logger log = jobContext.getLogger();
try{
log.info("STARTING JOB ");
FlightBookingOrderConfirmationOut port = service
.getPort(FlightBookingOrderConfirmationOut.class);
log.info("STAGE 1 - Create XI MGMT Objects");
XIManagementInterface xiMngmnt = XIManagementInterfaceFactory
.create(port);
XIMessageContext msgCtx = xiMngmnt.getRequestXIMessageContext();
log.info("STAGE 2 - Add scenario specific values");
msgCtx.setSenderPartyName("");
msgCtx.setSenderService("BS_SENDER");
log.info("STAGE 3 - Update business data");
FlightBookingOrderConfirmation flightBookingOrderConfirmation = new FlightBookingOrderConfirmation();
BookingID id = new BookingID();
id.setAirlineID("SG");
id.setBookingNumber("452");
log.info("STAGE 4 - Try Send");
flightBookingOrderConfirmation.setBookingID(id);
port.flightBookingOrderConfirmationOut(flightBookingOrderConfirmation);
log.info("JOB COMPLETED !");
}catch( Exception e ){
log.info(e.toString());
}
}
}