Sunday, 1 December 2013

SOAPUI: Integration Helper for Salesforce

Recently I connected with hundred of developers. While taking to them, I felt that 75% of them were scared when it came to integration. So I thought to write this to make their life bit easier.

If you have a perfect WSDL file, which can be parsed easily in Saleforce, and you are the luckiest one. You can easily use generated wsdl classes for integrating Salesforce with other application. Picture starts when you have wsdl, but Salesforce is unable to parse it because of some constraints. 

Few common issues are:
  1. You have wsdl, but that is not in Salesforce supported format.
  2. You start modifying the wsdl to make it in Salesforce supported format, but it’s getting too hard and complex.
  3. Now you decide to go with HTTP request, but you don’t know the request body format.
  4. What you need to set in the request header?
  5. You have username and password, but you don’t know how to use that.
Please add your ones if I missed anything above.

SOAPUI: I would highly recommend downloading (http://www.soapui.org/Downloads/latest-release.html) and installing this tool. This allows you to create projects using WSDL files. When you create a project using wsdl, SOAPUI creates separate requests for each operation.

Creating a project in SOAPUI using wsdl

  1. Once you have been downloaded and installed SOAPUI, open soapui.
  2. Go to File -> New Project
  3. Choose your wsdl file and click on okay.
  4. You will see a new project is created in WSDL and it has all the operations.
  5. Select any operation and click on request1. It will show you complete request format.
  6. Now put your variables in request xml and hit the service.
  7. Click on Raw tab to see the request and response headers.
So now what you have all is:
EndPoint: As shown in screen-shot above
Method: Post
Content-Type: text/xml;charset=UTF-8
SOAP Action: As shown above
Request Body: As shown above

This is all enough to create your HTTP request in Salesforce and hit the endpoint. So how this will be implemented in Salesforce now:

You can create the requestBody string in Salesforce either by using the DOM class or you can also create a direct string like 
String requestBody = ‘<……..></…….>’;

//Request
HttpRequest request = new HttpRequest();
request.setEndpoint(endpoint);
request.setMethod(‘POST’);
request.setHeader('SOAPAction', soapAction);
request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
request.setBody(requestBody);

//Response
Http http = new Http();
HttpResponse response = http.send(request);

Now if you wish the parse the response, you can use DOM class to parse that.

If you have credentials and that need to be passed for authorization, then you can use these credentials in SOAPUI as given below:


In Salesforce this will be passed as :
Blob headerValue = Blob.valueOf(username + ':' + password);
String authorizationHeader = 'Basic ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);

Please do not forget to leave your comments. It will help me to improve the quality in next.

33 comments:

  1. Salesforce Developer convert the typical task into an simple one. Due to the experiences they solve the task with ease.

    ReplyDelete
  2. Salesforce Admin Online Training - 21st Century Software ...
    www.21cssindia.com/courses/salesforce-admin-online-training-143.html
    Salesforce admin online training by 21cssindia the largest institute in providing online trainings in all technologies. Salesforce admin training, salesforce ...
    salesforce developer online training| salesforce developer ...
    www.21cssindia.com/.../salesforce-developer-online-training-144.html
    21cssindia provides Salesforce developer online training by real time Experts. Call us +91 9000444287 for online training and demo. Online Salesforce ...
    salesforce crm online training| salesforce crm training| call ...
    www.21cssindia.com/courses/salesforce-crm-online-training-212.html
    21cssindia provides Salesforce crm online training by real time Experts. Call us +91 9000444287 for online training and demo. Online Salesforce crm training ...

    ReplyDelete
  3. Nice content. To get trained in salesforce from professionals click this link http://www.salesforcetraining.in/ . This is very useful

    ReplyDelete
  4. This is definitely one of the best articles I have read in this website! Thanks Mate.

    Salesforce Course in Chennai

    ReplyDelete
  5. it was really a nice article and i was really impressed by reading this
    article We are also giving Linux Course Online Training.the Linux-
    -Online-Training
    is the one of the best Online Training institute.

    ReplyDelete
  6. It is very nice blog and very useful to ease integration in salesforce, Thanks

    ReplyDelete
  7. Thanks for sharing informative article on Salesforce technology. Your article helped me a lot to understand the career prospects in cloud computing technology. Salesforce.com Training in Chennai

    ReplyDelete
  8. I have read your post, it was good to read & i am getting some useful info's through your blog keep sharing...Salesforce is a new technology which helps you to get your career destination. Learn salesforce from corporate professionals with very good experience in Salesforce CRM.
    Salesforce training institutes in Chennai|Salesforce training center in Chennai

    ReplyDelete
  9. The information you have given here is truly helpful to me. CCNA- It’s a certification program based on routing & switching for starting level network engineers that helps improve your investment in knowledge of networking & increase the value of employer’s network, if you want to take ccna course in Chennai get into FITA, thanks for sharing…
    ccna training in Chennai | ccna training institute in Chennai | ccna course in Velachery

    ReplyDelete
  10. Thanks for sharing; Salesforce crm cloud application provides special cloud computing tools for your client management problems. It’s a fresh technology in IT industries for the business management.
    Salesforce training in Chennai

    ReplyDelete
  11. Your blog is really awesome and I got some useful information from your blog. This is really useful for me. Thanks for sharing such a informative blog. Keep posting.

    Regards..
    Cloud Computing Training in Chennai

    ReplyDelete
  12. Informative article on Salesforce technology!!! Your post helped me to understand the career prospects in cloud based CRM tool. Salesforce Training Institutes in Chennai | Salesforce Training in Chennai

    ReplyDelete
  13. The information you posted here is useful to make my career better. Thanks for sharing such a informative post. keep updates...

    Regards..
    Salesforce Administrator Training in Chennai

    ReplyDelete
  14. In coming years, cloud computing is going to rule the world. The cloud based CRM tool provider like Salesforce have massive demand in the market. Thus talking salesforce training in Chennai from reputed Salesforce training institutes in Chennai will ensure bright career prospects for aspiring professionals.

    ReplyDelete
  15. It was really a wonderful article and I was really impressed by reading this blog. Your technical information is very useful for me. Thanks for sharing your ideas.

    Regards...
    Hacking Course in Chennai

    ReplyDelete
  16. Thanks for sharing this information. Java is one of the popular object oriented programming language used for many of the multinational corporation. So learning Java Training Chennai is really helpful to make a bright future.

    ReplyDelete
  17. thanks for sharing this blog..really i got some useful information in your blog..really it's very nice..soup ui online training

    ReplyDelete
  18. Thanks for providing information. We are providing online training classes
    <a href="http://hyderabadsys.com/http://hyderabadsys.com/http://hyderabadsys.com/soap ui-online-training/”> soup ui Online Training</a>

    ReplyDelete
  19. Thanks for sharing these information. It’s a very nice topic. We are providing online training classes soapuionlinetraining

    ReplyDelete
  20. Thanks for sharing these information. It’s a very nice topic. We are providing online training classes soapuionlinetraining

    ReplyDelete
  21. Thank you for sharing this kind of useful information,
    It is very useful to me and like who are searching for SOAP UI online training from USA, UK and India.

    ReplyDelete
  22. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  23. It's very nice blog it has very useful information SalesForce online training

    ReplyDelete
  24. This includes the ability to send and receive text messages, as well as make and receive phone calls via the soapuI salesforce developer API. If want become learn for Hadoop Training with Java code using MapReduce concepts and learn Big Data knowledge to real-time projects reach us Besant Technologies.To click the training details,Hadoop Training in Chennai | Hadoop Training Institute in Chennai

    ReplyDelete