Use the following parameters to be assigned in the next screen:
/**
*
*/
package com.sap.adaptermodule;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.TimedObject;
import javax.ejb.Timer;
//XML parsing and transformation classes
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Element;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
//Classes for Module development & Trace
import com.sap.aii.af.lib.mp.module.*;
import com.sap.engine.interfaces.messaging.api.*;
/**
* @author awandre
*
*/
public class TraceQueueBean implements SessionBean, TimedObject {
private static final long serialVersionUID=100L;
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbActivate()
*/
@Override
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbPassivate()
*/
@Override
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#ejbRemove()
*/
@Override
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.SessionBean#setSessionContext(javax.ejb.SessionContext)
*/
@Override
public void setSessionContext(SessionContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.TimedObject#ejbTimeout(javax.ejb.Timer)
*/
@Override
public void ejbTimeout(Timer arg0) {
// TODO Auto-generated method stub
}
public void ejbCreate() throws javax.ejb.CreateException {
}
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)
throws ModuleException{
try {
String param1 = (String) moduleContext.getContextData("param1");
String param2 = (String) moduleContext.getContextData("param2");
Message msg = (Message) inputModuleData.getPrincipalData();
Payload payload = msg.getDocument();
InputStream inps = (InputStream) payload.getInputStream();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(inps);
NodeList nodeLst1 = doc.getElementsByTagName(param1);
NodeList nodeLst2 = doc.getElementsByTagName(param2);
Element Elmnt1 = (Element) nodeLst1.item(0);
Element Elmnt2 = (Element) nodeLst2.item(0);
NodeList ndLst1 = Elmnt1.getChildNodes();
NodeList ndLst2 = Elmnt2.getChildNodes();
String queueId;
if (ndLst1.item(0) != null)
queueId =((Node) ndLst1.item(0)).getNodeValue();
else if (ndLst2.item(0) != null)
queueId =((Node) ndLst2.item(0)).getNodeValue();
else
queueId = msg.getSequenceId();
return inputModuleData;
} catch (Exception e) {
ModuleException me = new ModuleException("Unable to create Queue", e);
throw me;
}
}
}
A class file gets generated in the Workspace of NWDS at the following path-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<application-j2ee-engine
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">
<reference
reference-type="hard">
<reference-target
provider-name="sap.com"
target-type="library">com.sap.aii.af.lib</reference-target>
</reference>
<reference
reference-type="hard">
<reference-target
provider-name="sap.com"
target-type="service">com.sap.aii.adapter.xi.svc</reference-target>
</reference>
<reference
reference-type="hard">
<reference-target
provider-name="sap.com"
target-type="service">com.sap.aii.af.svc</reference-target>
</reference>
<reference
reference-type="hard">
<reference-target
provider-name="sap.com"
target-type="service">com.sap.aii.af.cpa.svc</reference-target>
</reference>
<fail-over-enable
mode="disable"
xsi:type="fail-over-enableType_disable"/>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
11 | |
10 | |
7 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |