Solved

Java Webservices using AXIS2 in distributed environment

Posted on 2008-06-18
7
598 Views
Last Modified: 2013-12-15
Hi,

I developed a web services using AXIS2 2.1.4, JDK1.5 and Tomcat5.5 using eclipse IDE. It is working fine in my machine. But remotely it is not working. I have the following doubts.

1. How to access the web services from another machine?
2. How to create a seperate client and server?
3. How to create a .aar file and deployed it in distributed environment
4. What is the role of 'CallBackHandler' class while creating the client

While creating the client part from the WSDL from another machine, and accessing the WEB services I am getting error like 'Connection Refused'.

Skeleton Part
=============
 public com.hbc.ccas.inquiry.impl.GetAliasOnlyFromCCResponse getAliasOnlyFromCC(
        com.hbc.ccas.inquiry.impl.GetAliasOnlyFromCC getAliasOnlyFromCC) {
    	String creditCardNo ="";
    	System.out.println("Methods getAliasOnlyFromCC() Starts");
    	
    	creditCardNo = getAliasOnlyFromCC.getCreditCardNoForAliasOnly();
    	System.out.println("CC NO in Method: "+creditCardNo);
    	//TODO: Write Logic for getting alias no starts
    	String aliasNo = "Not GENERATED";
    	if(!"".equals(creditCardNo)&& creditCardNo != null){
    		System.out.println("*****");
    		aliasNoGenerator = new AliasNoGeneratorUtil();
    		aliasNo = aliasNoGenerator.generateAliasNo(creditCardNo);
    	}
    	//TODO: Write Logic for getting alias no ends
    	
    	GetAliasOnlyFromCCResponse aliasResponse = new GetAliasOnlyFromCCResponse();
    	aliasResponse.setGetAliasOnlyFromCCReturn(aliasNo);
    	
    	System.out.println("Methods getAliasOnlyFromCC() Ends");
    	return aliasResponse;
    }
 
Client Part
===========
try {
			String ccNumberInput="5176845698741256";
			creditCardStub = new CreditCardInquiryImplServiceStub("http://10.238.232.82:8080/CCASTest1/services/CreditCardInquiryImplService");
			
			//Alias Only Starts
			CreditCardInquiryImplServiceStub.GetAliasOnlyFromCC  getAliasOnly = new CreditCardInquiryImplServiceStub.GetAliasOnlyFromCC();
			getAliasOnly.setCreditCardNoForAliasOnly(ccNumberInput);
			System.out.println(getAliasOnly.getCreditCardNoForAliasOnly());
			
			
			ccres = new CreditCardInquiryImplServiceStub.GetAliasOnlyFromCCResponse();
			System.out.println("CHECK1********");
			ccres= creditCardStub.getAliasOnlyFromCC(getAliasOnly);
			System.out.println("CHECK2********");
			System.out.println(ccres.getGetAliasOnlyFromCCReturn());
			//Alias Only Ends

Open in new window

0
Comment
Question by:cakurien
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
7 Comments
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 21820867
>>But remotely it is not working.

How did u try accessing it remotely?

>>How to create a separate client and server?

By default they are separated you don't need to do any thing infact any one can create there own client to invoke you web service, if in you case both have got generated at the same place then you check src all the Stub classes have to be separated and DataTypes also. I suggest better generate a separate project for client all together it take hardly 2 mins.

>>How to create a .aar file and deployed it in distributed environment

you can deploy a .aar file only if you are using a server like WSAS (web Service application server of WSo2) but let me see if there is any other way. you may have to use http://ws.apache.org/axis2/tools/1_2/maven-plugins/maven-aar-plugin.html

>> What is the role of 'CallBackHandler' class while creating the client

Have you created a asynchronous web service??

0
 

Author Comment

by:cakurien
ID: 21820960
>>How did u try accessing it remotely?
In another machine, from the WSDL (that I used to create the server parts), I changed the IP address to my system IP , right click the wsdl and create a client. It is creating one stub and callbackhandler class.
Then I create a client using the stub, pointing to my system IP and access the methods.

creditCardStub = new CreditCardInquiryImplServiceStub("http://10.238.232.82:8080/CCASTest1/services/CreditCardInquiryImplService");

Then I tried to invoke the servuce methods

>>Have you created a asynchronous web service??

From the eclipse IDE, the default one 'both sync and async' option is selected.

>>How to create a .aar file and deployed it in distributed environment

Can you provide me and eclipse plugin for that. I used eclipse 3.3 version
                  
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 21821940
0
 
LVL 23

Accepted Solution

by:
Siva Prasanna Kumar earned 500 total points
ID: 21821958
>>From the eclipse IDE, the default one 'both sync and async' option is selected.

Call back handler are needed only for Asyn web services, you may not need them until and you web services does something which may take a very very long time.

I think the axis 2 plugin has the aar packager, I think you have used Eclipse WTP for generating the web service, if you have installed axis2 eclipse plugin, you can see the aar package.
0
 
LVL 23

Expert Comment

by:Siva Prasanna Kumar
ID: 21858839
Take a look at the service archiver plugin of Axis 2

http://ws.apache.org/axis2/tools/1_4/eclipse/servicearchiver-plugin.html
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question