• Entries (RSS)
  • Comments (RSS)

Accessing an HTTPS web service from WAS web client

Posted by | Posted in WebSphere | Posted on 17-04-2008

Tagged Under : , , , ,

Accessing an HTTPS web service from WAS web client

Calling an HTTPS web service is a hell, if all our configurations are not correct. Accessing or calling a secured or HTTPS web service from a WAS web client, involves some configuration at the WAS side. If we miss these configurations we will get some nice SSL exceptions.

In order to get rid of all these SSL exceptions we need to import the server certificate to WAS trust store. So first extract the server certificate. To extract the server security certificate enter the URL in the browser (I was using IE). The browser will show the security alert pop up. Click on View Certificate

security alert popup

Now click on the Details tab and click on ‘Copy to File’ button

The certificate export wizard will be open. Click on Next button. From the export file format page accept the default values (DER encoded binary X.509 (.CER) will be selected by default) and click on next.

export file format

In the next screen enter the location where we want to store our certificate. (I used d:\wps.cer)

file to export

Click next and finish. We will be presented with a dialog box saying ‘The export was successful’. OK. We have done with our certificate export. The next step is to import the SSL certificate to server trust file.

For importing the SSL certificate to WebSphere Application Server’s trust store we need to know the location of the trust store file. To check the SSL setting, login to admin console. Click on SSL under security menu. From the SSL configuration repertoires page click on your SSL settings configuration link. Find out the trust file name and path under Trust file section.

ssl settings

If you are using the default settings the trust file name will be DummyServerTrustFile.jks. The default path will be WAS_INSTALL_DIR/profiles/ /etc/

Now go to WAS_INSTALL_DIR/bin directory and execute the iKeyMan.bat file. The IBM Key Management utility will be opened up. Click on ‘Key Database File’ and select open. From the dialog box opened select Key database type as JKS and enter the Server trust file name and path (DummyServerTrustFile.jks in my case).

ikeyman

Click on OK button. You will be prompted to enter the password. If you are using the default server trust file the default password for DummyServerTrustFile.jks is WebAS. Enter the password and click on OK.

Click on Add and select the server SSL certificate file which we extracted using Internet Explorer. (If you are not able to find the add button, select the Signer certificates under Key database content drop down) Click on OK button. You will be prompted to enter a label for the certificate. Enter the label you want for the certificate and click on OK. The server SSL certificate will be added to the WebSphere Application Server trust store. You are done. Close IBM Key Management tool and restart the application server. Now you will be able to access HTTPS web service from within your WebSphere Application Server without any problems.

Generating a web service proxy client

Posted by | Posted in RAD, WebSphere | Posted on 29-01-2008

Tagged Under : , , , ,

Java web service client applications use a web service proxy client to interact with the Web services APIs. A proxy client allows the developer to invoke the web service APIs as if it was a local method. For generating a web service proxy client, we need the WSDL files that describe the web service interfaces. The WSDL files for business process API is BFMWS.wsdl and for human task API is HTMWS.wsdl. The steps in generating a web service are as follows. (Before following the steps, copy your WSDL files to your workspace or to some location where the WID/RAD can see your WSDL files.

Step 1.
Right click on the web project (from web perspective) and select New -> Other. The select wizard opens. Expand the web service folder and select ‘Web Service Client’.

Web service client selection

Click Next.

Step 2.
From the web service client dialog box, accept the default values (The client proxy type would be Java Proxy, and ‘Create Folders when necessary’ checkbox would be checked and all other check boxes would be unchecked) or select the options that matches your environment.

Web service options page

Click Next.

Step 3.
The web service selection page opens. Click on Browse button. From the opened resource browser window, select the WSDL file. Click OK.

Web service selection page

Click Next.

Step 4.
The client environment configuration window opens. From this page select ‘IBM WebSphere’ as the Web service runtime by clicking the Edit button, if it is not selected already. Select the client type and the client projects.

Client Environment Configuration

Click Next.

Step 5.
The web service proxy client page appears. Accept all the default values.

Web service proxy page

Click Finish.

The web service proxy client will be generated and we can use the generated proxy client and helper classes for invoking the web service from our client application.

A search for Web service tutorial in Java

Posted by | Posted in WebSphere | Posted on 10-12-2007

Tagged Under : , , , ,

I was in bench for the last few days. Last day when I had a chat with my manager he said that my new project will be in WPS (WebSphere Process Server). I am totally new to WebSphere process server (even I haven’t seen that interface), so I though of learning some WebSphere Process Server stuff. I am not sure from where I came to a conclusion that WebSphere Process Server is something related to web services, anyway it happened. So I though it will be a great idea to learn Web Services tutorial first, before actually jumping into WebSphere Process Server.

As usual I opened my web browser (For most of the time I use Firefox and for serious browsing I use Internet Explorer as I think Internet Explorer is more secure ), and typed “Java web service tutorial”. Great!. more than millions of results came up and as expected the first result was a link to java.sun.com. I became so happy as I am a big fan of Sun Java tutorials. In fact I learned Java by reading the tutorials from Sun only. So I thought this would be great start again.

After the page got opened up, I just started going through the table of contents. In fact I did not want to read the complete tutorial as I was so lazy and I just wanted a Hello World tutorial to start with. I belive all our learning starts with Hello World and that should be the first program every developer should try :-) . But amazingly I did not find a Hello World web service tutorial there. I could see everything except web service in Sun’s web service tutorial. They are talking about JAXB, STAX, ABCD, XYZ etc. But no web service. Amazingly I couldn’t find any Hello World tutorial in most of the web service tutorial links I got from google search.

Did I miss something? or there is no Hello World web service tutorial or what? Its very unfortunate that there is no hello world web service tutorial on net. After reading this you may ask why you are not writing a hello world tutorial on web service? The answer is very simple, still I am in search for a Hello World tutorial. Let me write a Hello World web service, after that I will write the tutorial.