• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem using IBM-RAD / AXIS2

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am a newbie in WebServices.

I've got a problem in using a combination of 'IBM-RAD (6.0.0)' (for Service / running on websphere 6) and 'AXIS2(1.4)' (for Client / running in tomcat 5.5).

Simple Types / String / Bean objects are doing fine.
But, for 'array of Bean objects', I'm facing a problem. It's not working properly.

Giving you the details:

1. Bean Class for Service (IBM-RAD):

public class VectorVO
{

private String FName;


public String getFName()
{

return FName;

}



public void setFName(String name)
{

FName = name;

}

}



2. Service Class (IBM-RAD):

public class VectorTest
{

public VectorVO[] doCall(String p_str)

{

VectorVO l_objVO1 = new VectorVO();

VectorVO l_objVO2 = new VectorVO();

VectorVO l_objVO3 = new VectorVO();



VectorVO[] l_objVectorVO = new VectorVO[3];



l_objVectorVO[0] = l_objVO1;

l_objVectorVO[1] = l_objVO2;

l_objVectorVO[2] = l_objVO2;



return l_objVectorVO;

}

}

3. WSDL (made automatically by IBM-RAD):

<?xml version="1.0" encoding="UTF-8"?>

<wsdl efinitions targetNamespace="http://ss.com" xmlns:impl="http://ss.com" xmlns:intf="http://ss.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsi="http://ws-i.org/profiles/basic/1.1/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<wsdl:types>

<schema targetNamespace="http://ss.com" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:impl="http://ss.com" xmlns:intf="http://ss.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<element name="doCallResponse">

<complexType>

<sequence>

<element name="doCallReturn" nillable="true" type="impl:ArrayOfVectorVO"/>

</sequence>

</complexType>

</element>

<element name="doCall">

<complexType>

<sequence>

<element name="p_str" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

</element>

<complexType name="VectorVO">

<sequence>

<element name="FName" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

<complexType name="ArrayOfVectorVO">

<sequence>

<element maxOccurs="unbounded" minOccurs="0" name="VectorVO" nillable="true" type="impl:VectorVO"/>

</sequence>

</complexType>

</schema>

</wsdl:types>



<wsdl:message name="doCallRequest">



<wsdl art element="impl oCall" name="parameters"/>



</wsdl:message>



<wsdl:message name="doCallResponse">



<wsdl art element="impl oCallResponse" name="parameters"/>



</wsdl:message>



<wsdl ortType name="VectorTest">



<wsdl peration name="doCall">



<wsdl:input message="impl oCallRequest" name="doCallRequest"/>



<wsdl utput message="impl oCallResponse" name="doCallResponse"/>



</wsdl peration>



</wsdl ortType>



<wsdl:binding name="VectorTestSoapBinding" type="impl:VectorTest">



<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>



<wsdl peration name="doCall">



<wsdlsoap peration soapAction=""/>



<wsdl:input name="doCallRequest">



<wsdlsoap:body use="literal"/>



</wsdl:input>



<wsdl utput name="doCallResponse">



<wsdlsoap:body use="literal"/>



</wsdl utput>



</wsdl peration>



</wsdl:binding>



<wsdl:service name="VectorTestService">



<wsdl ort binding="impl:VectorTestSoapBinding" name="VectorTest">



<wsdlsoap:address location="http://localhost:9080/TestWebService4/services/VectorTest"/>



</wsdl ort>



</wsdl:service>



</wsdl efinitions>



4. Client Class (AXIS2 / NetBeans 5.5):

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

public class ClientMainWS
{
public static void main(String[] args1) throws AxisFault {

RPCServiceClient serviceClient = new RPCServiceClient();

Options options = serviceClient.getOptions();

EndpointReference targetEPR = new EndpointReference("http://192.168.1.192:9080/TestWebService4/services/VectorTest");

options.setTo(targetEPR);

options.setAction("doCall");

QName opSetWeather = new QName("http://service.pojo.sample", "doCall");

Object[] opGetWeatherArgs = new Object[] {"Suman"};
Class[] returnTypes = new Class[] { VectorVO[].class};


Object[] response = serviceClient.invokeBlocking(opSetWeather, opGetWeatherArgs, returnTypes);

System.out.println("Response Length: "+response.length);



VectorVO[] result = (VectorVO[]) response[0];

System.out.println("Result Length: "+result.length);


VectorVO vo1 = result[0];
//VectorVO vo2 = result[1];
//VectorVO vo3 = result[2];

System.out.println("Got Result1: "+result);


System.out.println("Got vo1: "+vo1);
//System.out.println("Got vo2: "+vo2);
//System.out.println("Got vo3: "+vo3);
}
}

[In the Client side I have the same Bean Class to get the values]

5. Output I'm Getting (Netbeans 5.5):

init:
deps-jar:
compile:
run:
log4j:WARN No appenders could be found for logger (org.apache.axis2.util.Loader).
log4j:WARN Please initialize the log4j system properly.
Response Length: 1
Result Length: 1
Got Result1: [LVectorVO;@406199
Got vo1: VectorVO@2a4983
BUILD SUCCESSFUL (total time: 4 seconds)

[I think Result Length should be 3]

6. If I omit the commented lines, I'm getting the exception:

init:
deps-jar:
compile:
run:
log4j:WARN No appenders could be found for logger (org.apache.axis2.util.Loader).
log4j:WARN Please initialize the log4j system properly.
Response Length: 1
Result Length1: 1
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at ClientMainWS.main(ClientMainWS.java:423)
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)


N.B.: The test Client made by IBM-RAD is running without any problem. I've got the AXIS2 Client code from different forums, and they say that It works fine. But, I'm at a loss. I've been searching for a week and trying to get a solution, but in vain.

What's the problem?
What's the solution?

Please help me.

Thanks in advance...

Suman
 
My pie came with a little toothpic holding up this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic