Main Menu
Home
About Me
Blog
Articles
FAQs
Contact Me
Search
Syndicate
feed image
 
   
Home arrow Blog arrow How I made the outbound service work on WAS 6.1
How I made the outbound service work on WAS 6.1 PDF Print E-mail
Written by Chintan Rajyaguru   
Saturday, 06 January 2007

A few days back, I asked IBM to give me my 3 days back. Obviously, that's not happening. So here is my contribution to the community so others don't have to loose time like I did. You can create a BUS and an outbound service as described in the series of articles at http://www-128.ibm.com/developerworks/websphere/techjournal/0512_reinitz/0512_reinitz.html. The link points to the last part of the article, which contains links to other parts.

 

Let's understand creating outbound service in little more detail. In WebSphere 6.0, creating an outbound service

  • Automatically creates a record in the SDO repository database
  • The record consists of your wsdl file inserted into the database as a blob
  • The record uses a string in dest:<bus_name>:<service_name> format as the primary key. So, for an outbound service destination named MyService in bus MyBus, the wsdl is inserted using dest:MyBus:MyService as the key
  • When you forward the message from queue to the outbound service, you must use a mediation to make WAS messaging engine aware that this is a soap message by applying a so called 'format string'
  • The format string must be of the format SOAP:dest:[busname]:[service destination name],[service namespace],[service name],[port name]
  • Out of this format string, WAS uses dest:[busname]:[service destination name] part as the key to retrieve the wsdl from the database

In WebSphere 6.1, everything else remained the same BUT format string and the key used to insert the wsdl in the database changed. In WebSphere 6.1, creating an outbound service

  • Automatically creates a record in the SDO repository database
  • The record consists of your wsdl file inserted into the database as a blob
  • The record uses wsdl location as the primary key. Something like http://localhost:<port>/<context_root>/services/MyService/wsdl/MyService.wsdl
  • When you forward the message from queue to the outbound service, you must use a mediation to make WAS messaging engine aware that this is a soap message by applying a so called 'format string'
  • The format string must be of the format SOAP:<wsdlLocation>,<serviceNameSpace>,<serviceName>,<portName>
  • Out of this format string, WAS uses <wsdlLocation> part as the key to retrieve the wsdl from the database 

If you use WAS 6.0 format string in WAS 6.1, you will get a validation error. The bug in WAS 6.1 is, when you create an outbound service, WAS 6.1 still uses the old format of key to insert the record BUT forces you to use the new format to retrieve the record so you will NEVER get any results back. Since WAS 6.1 uses entity beans to access SDO Repository, you will get ObjectNotFoundException.

To recreate this bug, create an outbound service following instructions in http://www-128.ibm.com/developerworks/websphere/techjournal/0506_reinitz/0506_reinitz.html

  • Make sure the server is running
  • Start the wsadmin tool by going to <profile_home>/bin and issuing wsadmin command (wsadmin.sh on linux/unix). If you are on a secure server, you will have to use -user and -password flags to use admin commands in wsadmin tool
  • Use the following commands to list the resources in your SDO repository
    • wsadmin> set sdoRep [$AdminControl queryNames *,type=SdoRepository,node=[$AdminControl getNode]] this command defines a variable called sdoRep
    • wsadmin> puts [$AdminControl invoke $sdoRep listResources] this command lists the keys by which xml files are stored as blobs in your SDO repository
  • If you have defined outbound service correctly, you will see an entry dest:<bus_name>:<service_name>. For example, if you had an outbound service named MyService in bus MyBus, you will see an entry dest:MyBus:MyService
  • Use "SOAP:dest:MyBus:MyService" as the format string in your mediation and you will get a validation error in ffdc log files. This is because WAS 6.1 forces you to use wsdl location
  • Use SOAP:<wsdlLocation>,<serviceNameSpace>,<serviceName>,<portName> as the key and you will get ObjectNotFoundException because there is no record with your wsdl location as the primary key

 

The workaround:

To work around this problem, you have to manually insert your wsdl in the SDO repository database using your wsdl location as the key. To do this,

  • Create a scrip file called sdoWsdlImport.jacl and put the following content in it:

# script to add wsdl to SDO repository

set xsdFile [lindex $argv 0]

set xsdKey  [lindex $argv 1]

set sdoRep [$AdminControl queryNames *,type=SdoRepository,node=[$AdminControl  getNode]]

puts [$AdminControl invoke $sdoRep importResource [list $xsdKey $xsdFile]]

 

# comment the puts line above and uncomment the following $AdminControl line 

# to remove wsdl from SDO repository

#$AdminControl invoke $sdoRep removeResource [list $xsdKey false]

  • Go to <profile_home>/bin directory and issue the following command:

wsadmin -f <path_to_jacl_file> <path_to_wsdl_file> <wsdl_url>

  • For example,

wsadmin -f c:/temp/sdoWsdlImport.jacl C:/MySoftware/RAD7workspace/my_messaging_ejb/ejbModule/META-INF/wsdl/MyService.wsdl  http://localhost:9080/my_messaging_ejbHttpRouter/services/MyService/wsdl/MyService.wsdl where,

o        wsadmin -f invokes the wsadmin tool and runs the script

o        c:/temp/sdoWsdlImport.jacl is the full path to the jacl file (notice forward slash in windows environment)

o path        C:/MySoftware/RAD7workspace/my_messaging_ejb/ejbModule/META-INF/wsdl/MyService.wsdl is the physical location of wsdl file. On the server, you can use location of wsdl in 'installedApps' directory. Again, notice forward slash

o url        http://localhost:9080/my_messaging_ejbHttpRouter/services/MyService/wsdl/MyService.wsdl is the url to your wsdl. If your service is deployed and if the server is running, typing this url in the browser should show  you the wsdl

  • Now, start the wsadmin tool as described above and use the same commands to list the contents of the SDO repository
    • wsadmin> set sdoRep [$AdminControl queryNames *,type=SdoRepository,node=[$AdminControl getNode]] this command defines a variable called sdoRep
    • wsadmin> puts [$AdminControl invoke $sdoRep listResources] this command lists the keys by which xml files are stored as blobs in your SDO repository
  • This time you should see an entry with your wsdl location. This means there is a record in the SDO repository database with your wsdl location as the primary key
  • Now run your test code to forward the soap message form the queue to outbound service using format string in SOAP:<wsdlLocation>,<serviceNameSpace>,<serviceName>,<portName> format in your mediation and your web service should be invoked correctly

Write your comment here (support html tag):

Random Code
Random Code Verification
 
Last Updated ( Saturday, 06 January 2007 )
 
< Prev   Next >
BlogSidebar
 
 

Copyright Chintan Rajyaguru
Contact me if you have any questions or comments.