on 02-24-2006 5:35 AM
Hi Guys
I want to write a module where in I could be able to add the header segment to the XML Header.
I am not sure abt the methods to be used, is there any documentation giving details abt the methods which could be used.
Dheeraj
Hi Dheeraj,
Can you please elaborate your requirement?
My understanding from ur post is you are trying to insert a header segment in an XML payload which doesnot have any header segment.
Input before conversion Module:
XML
-
Item1
data
Item2
data
...
Input After conversion Module:
XML
-
Header segment
Hdr data
Item1
data
Item2
data
...
Is this correct?
Regards,
Ananth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
This is a sample soap message which i am trying to get, if you see in this, there are segment in the soap header part, which in normal way i cannot achieve in XI, so was just wondering if there is any method available in adapter module development where in i could do that.....
<b> <soapenv:Header>
<ns1:SessionHeader soapenv:mustUnderstand="0"
xmlns:ns1="urn:enterprise.soap.sforce.com">
<ns1:sessionId>6l9auFNpYPGRiIh9St82kkGBlUtIlWMt0_jXlNKOSU</ns1:sessionId>
</ns1:SessionHeader> </soapenv:Header> </b>
<soapenv:Body>
<convertLead xmlns="urn:enterprise.soap.sforce.com">
<leadConverts>
<accountId>001300000019ykD</accountId>
<ownerId xsi:nil="true"/>
<sendNotificationEmail>true</sendNotificationEmail>
</leadConverts>
</convertLead>
</soapenv:Body>
</soapenv:Envelope>
Hi Dheeraj,
Modify the following code and add your Header segments and deploy it as an EAR Archive.Note Implement your <b><i>YourClass </i></b> code in such a way that it should add Header segments in between your existing SOAP Message.
You can access the incoming message using
payloadData.getInputStream()
and after processing your message set your newly created message using
payloadData.setContent(outXML.toByteArray())
Regards,
Ananth
import java.io.ByteArrayOutputStream;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import com.sap.aii.af.mp.module.Module;
import com.sap.aii.af.mp.module.ModuleContext;
import com.sap.aii.af.mp.module.ModuleData;
import com.sap.aii.af.mp.module.ModuleException;
import com.sap.aii.af.ra.ms.api.Message;
import com.sap.aii.af.ra.ms.api.XMLPayload;
/**
* @author AnanthBabu Chinnaraj
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
/**
* @ejbHome <{com.sap.aii.af.mp.module.ModuleHome}>
* @ejbLocal <{com.sap.aii.af.mp.module.ModuleLocal}>
* @ejbLocalHome <{com.sap.aii.af.mp.module.ModuleLocalHome}>
* @ejbRemote <{com.sap.aii.af.mp.module.ModuleRemote}>
*/
public class YourBean implements SessionBean, Module {
public void ejbCreate() {
}
public void ejbRemove() {
}
public void ejbActivate() {
}
public void ejbPassivate() {
}
public void setSessionContext(SessionContext context) {
myContext = context;
}
private SessionContext myContext;
/* (non-Javadoc)
* @see com.sap.aii.af.mp.module.Module#process(com.sap.aii.af.mp.module.ModuleContext, com.sap.aii.af.mp.module.ModuleData)
*/
public ModuleData process(ModuleContext arg0, ModuleData modData)
throws ModuleException {
try {
Object dataObject = null;
Message xiMessage = null;
dataObject = modData.getPrincipalData();
xiMessage = (Message) dataObject;
XMLPayload payloadData = xiMessage.getDocument();
ByteArrayOutputStream outXML=null;
if (payloadData != null) {
outXML = new ByteArrayOutputStream();
YourClass obj= new YourClass();
obj.processXML(payloadData.getInputStream(), outXML);
payloadData.setContent(outXML.toByteArray());
}
modData.setPrincipalData(xiMessage);
} catch (Exception e) {
}
return modData;
}
}
<i></i>
Hi Dheeraj -
The SAP help site points you to where the JavaDocs for Adapter and Module development can be found:
http://help.sap.com/saphelp_nw04/helpdata/en/87/3ef4403ae3db12e10000000a155106/content.htm
You can also get it by downloading the latest Adapter Framework SP from Service MarketPlace (e.g. SAPXIAF15_0-20000273.sca). You can get that here:
https://smpdl.sap-ag.de/~swdc/012002523100000248062005D/SAPXIAF15_0-20000273.sca?_ACTION=DL_DIRECT
From this you would have to extract 'sample_ra.sda' and then within that 'sample_ra.rar' and then within that you'll find 'sample_ra.jar'. Once you extract the jar, open 'index.html'.
I did a quick scan of the <i>Message</i> interface and didn't really see a method to set a custom header. But maybe I missed something.
Regards,
Jin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.