Showing posts with label WSDL. Show all posts
Showing posts with label WSDL. Show all posts

Monday, October 13, 2014

Invoke a SOAP API written in Salesforce using Axis

I had to consume an API written by someone else in Salesforce. I got the WSDL and the EndPoint.

Essentially what I had to do is to replace existing code I wrote a year ago to perform User Provisioning in Salesforce and rely on this API to perform that logic.

Now the interesting part is how to write my client, the obvious answer was to use WSDL2Java (Axis), because I don't want to write much code. And this is my final code: This is a simple Cooking recipe with the exception of these lines: Things to keep in mind (otherwise you'll get "INVALID_SESSION_ID: Invalid Session ID found in SessionHeader: Illegal Session"):
  1. Open a session in Salesforce (that's how get permission to invoke the API)
  2. Populate SessionHeader object (with Salesforce sessionId)
  3. Set the Header to your Port before making your call

Saturday, June 26, 2010

WebServices with CXF - Configuration files III

Now I'll cover my Apache CXF configuration file

As I said before this is not rocket science. It follows the same logic used in every Spring configuration file, everything is based on Beans tags

If you remember my serviceApplicationContext, I declared a Bean called LibraryService

Well, we're going to make reference to this particular Bean on our CXF configuration file, so we can expose it (We already changed our Interface & Implementation using annotations)

Now if you analyze carefully my CXF configuration file, this section links my Spring Bean (Service) with my endpoint on CXF through implementor & implementorClass attributes, which basically link my Java Code (implementorClass) and my Spring Bean (implementor);
The only thing you must add is "#" character before Spring's Bean name: #LibraryService

Finally, I'm using another attribute called address to declare the address for this WebService, by declaring it as address="/LibraryService", this will be my URI for this WebService: http://localhost:8080/little-library-lite/services/LibraryService


Why /services/LibraryService?? I declared on my web.xml that URL Pattern.

In my next and last entry I'll test this WebService using JUnit, if you want to see the WSDL file for all your available WebServices, you can do it by going to http://localhost:8080/little-library-lite/services

There you'll see a list of available WebServices and by clicking them you'll see each one's WSDL