Hi
I am trying to deploy a Messaging Web Service which communicates with
another Web Service using RPC.
Following is my Messaging Service code.
---------------------------------------------------------------------
public Element[] ReactionSearch(Element [] SOAPElements) {
try{
//getting the string from the incoming SOAP Message from the client
querystring=SOAPElements[0].getFirstChild().getNodeValue();
//Code to call the other Web Service using RPC
service=new Service();
call=(Call)service.createCall();
call.setTargetEndpointAddress(new URL(rpcServerURL));
QName qname=new QName("SearchDatabaseWebService","getReactionID");
call.setOperationName(qname);
call.addParameter("query",XMLType.XSD_STRING,ParameterMode.INOUT);
call.setReturnType( XMLType.XSD_STRING );
paramlist=new Object[1];
paramlist [0]=querystring;
Object response=call.invoke(paramlist);
//Getting a response from the other web service
responsestring=response.toString();
//Parsing the response string
DocumentBuilderFactory builder=DocumentBuilderFactory.newInstance();
Document document=builder.newDocumentBuilder().parse(new
InputSource(new StringReader(responsestring)));
//Creating the response element array
SOAPresponse=new Element[2];
SOAPresponse [0]=document.getDocumentElement();
return SOAPresponse;
}
--
-------------------------------------------------------------------------------------------------------------
I have tested the RPC part of the above code separately and it is
working fine. The problem is that I am getting an Out of
BoundException in the above code. With the help of TCP Packet Monitor
and my firewall, I know that the client is communicating with the
above messaging service and the messaging service is also
communicating with the other web service. I guess the problem is when
the above messaging service wants to send a response back to the
client. The problem seems to be in the last three lines (the
SOAPresponse array) but cant figure out what it is ?
----------------------------------------------------------------------------------------
The stack Trace
ava.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:507)
at java.util.ArrayList.get(ArrayList.java:324)
at org.apache.axis.message.SOAPBody.getFirstBody(SOAPBody.java:161)
at
org.apache.axis.message.SOAPEnvelope.getFirstBody(SOAPEnvelope.java:190)
at org.apache.axis.client.Call.invokeEngine(Call.java:2757)
at org.apache.axis.client.Call.invoke(Call.java:2718)
at org.apache.axis.client.Call.invoke(Call.java:1754)
-------------------------------------------------------------------------------------------------------------------------------------
Any kind of help will be appreciated
Kunal
--
Kunal Gandhi
Graduate Student
Phone # (909)913-3245