on 05-17-2016 8:10 AM
Hi Experts,
Could please me help me on this scenario as below.
ECC-- SAP PI -- 3rd Party
Sender is a Proxy, Receiver is a SOAP
1. Login into 3rd Party and need to get the SESSION ID with valid user name and password
2. Need to pass the SESSION ID as SOAP Header with actual payload.
I came to know that this can be done at mapping level using UDF to get the Session ID.
I have gone through the Bhavesh Kantilal Blog.
Could you please provide help on this.
Thank you in advance.
Check these 2 articles. They provide detailed examples and codes etc
Salesforce.com Integration Using SAP PI: A Case Study
Regards
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
/* method is to login to SFDC with the username and password to get the sessionId from the response*/
private void getSessionIdFromSFDC(String username, String password)
{
String sessionId ="";
try
{
Channel channel = LookupService.getChannel("BC_SFDC","CC_Login");
SystemAccessor accessor = null;
accessor = LookupService.getSystemAccessor(channel);
String loginxml = "<login xmlns=\"urn:enterprise.soap.sforce.com\"> <username>"
+ username
+ "</username> <password>"
+ password
+ "</password> </login>";
InputStream inputStream = new ByteArrayInputStream(loginxml.getBytes());
Payload payload = LookupService.getXmlPayload(inputStream);
Payload SOAPOutPayload = null;
SOAPOutPayload = accessor.call(payload);
InputStream inp = SOAPOutPayload.getContent();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(inp);
NodeList sessionId1 = document.getElementsByTagName("sessionId");
Node node = sessionId1.item(0);
if (node != null)
{
node = node.getFirstChild();
if (node != null)
{
sessionId = node.getNodeValue();
}
}
}
catch(Exception e)
{e.printStackTrace();
}
return sessionId;
}
Regards,
Bhavesh
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.