Wednesday, February 22, 2012

WSO2 MB - Samples : SQS SOAP Client Sample

Many users experiencing problems when testing this sample.



Here i am going to mention few simple steps to execute this sample.

1. Download WSO2MB 1.0.2 pack from http://wso2.org/downloads/message-broker

2. Extract and start the product.

3. Log in to the admin console of MB with credentials admin/admin



4. Navigate to the WSDL2Java tool which can be found in "Tools" left menu



5. Copy and paste the url of sqs wsdl to the provided test box in the "uri" option

6. Press generate button which can be found in the bottom of that page and it will give you the
zip file of generated source pack and save it.

7. Extract the source pack to your project folder. Once you extracted it, you can see a structure like :
.
|-- build.xml
|-- pom.xml
`-- src
`-- com
`-- amazonaws
`-- queue
`-- doc
`-- _2009_02_01
|-- MessageQueueCallbackHandler.java
|-- MessageQueueStub.java
|-- QueueServiceCallbackHandler.java
`-- QueueServiceStub.java


8. Go inside the project folder where you can find the above pom.xml file in the command line. Create the idea project by typing "mvn idea:idea".

9. Open the created project with IDEA

10. Add the SQSClient class to the project.

11. Change the "accessKey" and the "secretAccessKey" to the keys which can be found at "Home > Manage> Message Boxes(SQS)> Access Keys" of wso2mb server.


12.Build the project and execute the sqs client




NOTE:

Possible errors to be occurred when building the project

"cannot find symbol method createOMElement(org.apache.axiom.om.OMDataSource,javax.xml.namespace.QName)"

This is due to version mismatch of the axiom. Valid version of all axiom libraries is the version specified in the pom.xml

eg: 1.2.11.wso2v1

But where there are axiom libraries which is different from the above version, it gives above error.

You need to remove that version mismatching library from your class path .
Eg: axiom-api-1.2.7.jar

With this way you can get rid of this problem.

No comments:

Post a Comment