The goal here is when a call is made to the service to add an iEngine it
queries that iEngine (which is also a service) to get the remote
system's date. This isn't particularly pratical, but it does make for a
pretty good test case as getDate is probably the most simplistic method
which the service exposes. I feel like there is some sort of addressing
problem occurring but I am not knowledgeable enough to know exactly
what. Also the service.xml and wsdl file were generated by the eclipse
plugin and I did not modify them at all.
Relevant pieces of code:
From IEngine.java (the web service):
/**
* @param ip
* address of the iengine to begin polling
* @throws Exception
* @throws AxisFault
*/
private synchronized void addIEngineHop(String ip, String nextHop) {
if (!iEngines.containsKey(ip)) {
// get the iengine that was just added's known devices and
iengines
// in order to build a tree structure
IEngineRPCConnection conn;
try {
conn = new IEngineRPCConnection(ip);
conn.open();
final SortedSet<String> devices = conn.getDevices();
final SortedSet<String> iEngines = conn.getIEngines();
// add all of the deivces and set up their
// routing table appropriately
for (String device : devices) {
addDevice(device, ip);
}
for (String iEngine : iEngines) {
IEngine.iEngines.put(iEngine, ip);
insertIEngine(iEngine, ip);
}
IEngine.iEngines.put(ip, nextHop);
insertIEngine(ip, nextHop);
} catch (Exception e) {
e.printStackTrace();
}
}
}
from IEngineRPCConnection (the service client):
public static final String XSD =
"http://iengine.rfid.odintechnologies.com/xsd";
public static final String URL = "/axis2/services/IEngine";
public IEngineRPCConnection(String ip) throws AxisFault {
this.ip = ip;
client = new RPCServiceClient();
}
/**
* opens the connections
*
* @throws AxisFault
*/
public void open() throws AxisFault {
// set up client options
final Options options = client.getOptions();
final EndpointReference er = new EndpointReference("http://" + ip
+ ":8080" + URL);
options.setTo(er);
final TransportOutDescription tod = new TransportOutDescription(
Constants.TRANSPORT_HTTP);
tod.setSender(new CommonsHTTPTransportSender());
options.setTransportOut(tod);
}
public Date getDate() throws AxisFault {
// set up a call to the service
final QName opName = new QName(XSD, "getDate");
final Object[] opArgs = new Object[] {};
final Class[] returnTypes = new Class[] { Date.class };
// call the service
final Object[] response = client.invokeBlocking(opName, opArgs,
returnTypes);
final Date date = (Date) response[0];
return date;
}
Deepal Jayasinghe wrote:
Hi Christian ,
Yes you can do that and I have done that too. Sometimes you might have
done smt wrong , so please send me the src code then I can try and see.
Thanks
Deepal
Is it possible to make calls to other Axis 2 services from within an
Axis 2 service using the RPCServiceClient? When I try this I receive
a vague AxisFault:
rg.apache.axis2.AxisFault: outboundNoAction
at
org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.processWSAAction(AddressingOutHandler.java:257)
at
org.apache.axis2.handlers.addressing.AddressingOutHandler$WSAHeaderWriter.writeHeaders(AddressingOutHandler.java:184)
at
org.apache.axis2.handlers.addressing.AddressingOutHandler.invoke(AddressingOutHandler.java:109)
at org.apache.axis2.engine.Phase.invoke(Phase.java:383)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:203)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:433)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:330)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
at
org.apache.axis2.rpc.client.RPCServiceClient.invokeBlocking(RPCServiceClient.java:97)
at
com.odintechnologies.iengine.connection.IEngineRPCConnection.getDevices(IEngineRPCConnection.java:189)
at
com.odintechnologies.rfid.iengine.IEngine.addIEngineHop(IEngine.java:452)
at
com.odintechnologies.rfid.iengine.IEngine.addIEngine(IEngine.java:497)
thanks!
-Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]