Thursday, July 8, 2010

Using Soap Channel in SALES FORCE and using soap lookups

Technical concepts you learn
1. soap lookups in message mapping and javaMapping( parameterized mapping calling soap channel in message mapping).
2. using soap channels in Sales force.
3. Dynamically Setting soap receiver channel parameters.
4. useSoap Envlope Parameter in Receiver communication channel
Links for above things
1. http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50a76cfa-4966-2d10-aba7-da496d9b5bcf?QuickLink=index&overridelayout=true
if not use sdn.sap.com articles then select SOA integration section, select sales force use case.
2. http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b07ce666-fdf1-2c10-96b0-be959a344ede?QuickLink=index&overridelayout=true

simple exaplanation above topics using above docs
1. Behind machanisum in SALES FORCE
PI is able communicate with this using SOAP receiver.
but SALES FORCE has login webservice, application related webserices
first we need fallow this sequence 1.Login websercie 2. application related Webserice
1. Login Webserice provides you Target url and session id.
2. By using these two you can get required service.
So these services are inter - related and sequence manner.
soap ui , soap client( freely downloadable) we can test webserices.
Both of the webservices are getting from sales force website / 3rd party system.
Image:
2.Dynamically set soap receiver channel parameters.
image:
3. Using Soap Lookup in message mapping.( from 2nd document)

lookup code.

public String calculateDiscount(String cust_no, String region, Channel
soapDiscount, Container container) throws StreamTransformationException{
SystemAccessor accessor = null;
String discount = "";
StringBuffer sb = new StringBuffer();
try{
// 1. Get a system accessor for the channel.
accessor = LookupService.getSystemAccessor(soapDiscount);
// 2. Build up request
InputStream reqStream;
String reqString =""
+ "OrderDiscountRule xmlns:ns0=\"http://www.sap.com\">"
+ ""
+ ""+cust_no+" "+region+""
+ "0
"
+ "
OrderDiscountRule>";
reqStream = (InputStream) new
ByteArrayInputStream(reqString.getBytes());
XmlPayload reqPayload = LookupService.getXmlPayload(reqStream);
// 3. Call BRM
XmlPayload resPayload = (XmlPayload)accessor.call(reqPayload);
// 4. Parse result
byte[] b = new byte[4096];
for (int n; (n = resPayload.getContent().read(b)) != -1;) {
sb.append(new String(b, 0, n));
}
int i =sb.indexOf("") + 10;
int j =sb.indexOf("
");
discount = sb.substring(i, j);
}
catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
finally {
// 5. Close the accessor in order to free resources.
if (accessor!=null) accessor.close();
}
return discount;

Avoiding Brides in ccBPM using modules

file - RFC - file , or file- Soap - file , in these case we used the fallowing approach.
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/19888

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1926

By using this modules we can acheive the same funcationality with out BPM also
Using Request Response Bean Module in FILE Adapter .
http://wiki.sdn.sap.com/wiki/display/HOME/Using+Request+Response+Bean+Module+in+FILE+Adapter user ful link from forum
http://forums.sdn.sap.com/thread.jspa?messageID=3075228

sap pi help
http://help.sap.com/saphelp_nw04/helpdata/en/45/20c210c20a0732e10000000a155369/frameset.htm