on 02-02-2016 2:40 PM
Hi All.
I've deployed a custom module from NWDS7.31 to SAP PO 7.4 as mentioned below.
and i've mentioned the module name in receiver file adapter channel as mentioned below
while processing i'm getting an below error
please note:
1. if i change the module name as "lacalejbs/EDIDataSplitChar" also i'm facing the above same error.
2. if i change the module name as "AF_Modules/EDIDataSplitChar" also i'm facing the below (similar) error.
3. for deploying the module I referred the blog
please suggest how to fix this error.
Regards
Ramesh
Hi All.
Please note:
I've not followed the exact requirement of http://scn.sap.com/community/pi-and-soa-middleware/blog/2014/08/08/pi-74--adapter-module-creation-us... this blog.
my requirement: Receiver File channel receive the EDI file which contain raw edi data format, Each line of the data can have more then 80 character as well as multiple line also comes. so i need to split the line based on my parameter value. i.e if i give parameter value as 80, each line of the data must be 80 character.
so i suggested to write a code to my java team. as they does't know how the input stream comes at run time, then they decided to check test scenario.i.e when ever the EDI data receives the channel, this (EDIDataSplitChar) module have to replace the whole EDI data as a "hello". if this testing works fine then java team can go further as per my requirement.
for your better analysis i can add the code here.
1. Class name: EDIDataSplitChar.java)
package com.sap.modules;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import javax.ejb.Stateless;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import com.sap.aii.af.lib.mp.module.Module;
import com.sap.aii.af.lib.mp.module.ModuleContext;
import com.sap.aii.af.lib.mp.module.ModuleData;
import com.sap.aii.af.lib.mp.module.ModuleException;
import com.sap.engine.interfaces.messaging.api.Message;
import com.sap.engine.interfaces.messaging.api.MessageKey;
import com.sap.tc.logging.Location;
/**
* Session Bean implementation class EDIDataSplitChar
*/
@Stateless
public class EDIDataSplitChar implements EDIDataSplitCharRemote, EDIDataSplitCharLocal, Module {
/**
* Default constructor.
*/
public EDIDataSplitChar() {
// TODO Auto-generated constructor stub
// process(ModuleContext.class, ModuleData.class);
}
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException
{
try
{
Location myLoc = Location.getLocation(EDIDataSplitChar.class);
myLoc.infoT("In process method");
// String SIGNATURE = "process(ModuleContext moduleContext, ModuleData inputModuleData)";
Object obj = null;
Message msg = null;
MessageKey amk = null;
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
com.sap.engine.interfaces.messaging.api.Payload payLoad = msg.getMainPayload();
DocumentBuilderFactory factory;
factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse((InputStream) payLoad.getInputStream());
// Element rootNode = document.getDocumentElement();
document.setTextContent("hello");
TransformerFactory tfactory = TransformerFactory.newInstance();
Transformer transformer = tfactory.newTransformer();
Source src = new DOMSource(document);
ByteArrayOutputStream myBytes = new ByteArrayOutputStream();
Result dest = new StreamResult(myBytes);
transformer.transform(src,dest);
byte[] docContent = myBytes.toByteArray();
payLoad.setContent(docContent);
inputModuleData.setPrincipalData(msg);
}
catch (Exception e)
{
}
finally
{
return inputModuleData;
}
}
}
2. local. EDIDataSplitCharLocal.java
package com.sap.modules;
import javax.ejb.Local;
import com.sap.aii.af.lib.mp.module.ModuleContext;
import com.sap.aii.af.lib.mp.module.ModuleData;
import com.sap.aii.af.lib.mp.module.ModuleException;
@Local
public interface EDIDataSplitCharLocal {
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException;
}
3. remote: EDIDataSplitCharRemote.java
package com.sap.modules;
import javax.ejb.Remote;
import com.sap.aii.af.lib.mp.module.ModuleContext;
import com.sap.aii.af.lib.mp.module.ModuleData;
import com.sap.aii.af.lib.mp.module.ModuleException;
@Remote
public interface EDIDataSplitCharRemote {
public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData) throws ModuleException;
}
Best Regards.
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ramesh,
Just cross check whether you have configured everything as per the below link
Hi Ramesh,
In channel you need to give the module name as
localejbs/<JNDI Name>
I can see the JNDI Name of your module is sap.com/EDIDataSplitEAR/EDIDataSplitChar
in channel try module name as localejbs/sap.com/EDIDataSplitEAR/EDIDataSplitChar
Regards,
Vikas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ramesh,
Can you search your module not the name which i show you in the screen shot, i just shown my custom adapter module for example.
Your adapter module must be there in the JNDI browser if not then the module not deployed properly because at runtime system look in JNDI browser for the name specified in the channel .
Regards,
Praveen.
Hello Ramesh,
Make sure your module is deployed and exact name should be used in channel.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.