Forum Discussion
Tim_Arp_112576
Nimbostratus
Aug 12, 2004Handling returned parameters with SOAP and Java
Hi, I have been working on some code to basically mimic the b virtual command line. I'm trying to display the pool members status (up or down) . According to the SDK , the function is like this.
...
Aug 12, 2004
The problem I see is that the method takes an array as input for the member_defs.
void get_member_active_states(
in String pool_name,
in IPPortDefinition [] member_defs,
out MemberState[] member_states);
You are passing in a single value:
MemberStatisticsEntry[] PoolMembers = (MemberStatisticsEntry[]) resp.getReturnValue().getValue();
for (int i=0; i < PoolMembers.length; i++) {
>> PoolParams.addElement(new Parameter("member_defs", IPPortDefinition.class,PoolMembers[i].getMember_definition(), null));
call.setParams(PoolParams);
call.setMethodName("get_member_active_states");
resp = call.invoke(destURI, urn);
//this is wrong below
MemberState[] PoolMemberState = (MemberState[]) resp.getReturnValue().getValue(); //this is wrong
You can either
1. Pass in an array of size 1 (right now you are just passing in the element).
-or-
2. Create an array of all the member_defs and pass them in a single call:
// Extract statistics return value
MemberStatisticsEntry[] PoolMembers = (MemberStatisticsEntry[]) resp.getReturnValue().getValue();
// build input array
long num_members = PoolMembers.length;
IPPortDefinition [] member_defs = new IPPortDefinition[num_members];
for(int i=0; i {
member_defs[i] = PoolMembers[i].getMember_definition();
}
PoolParams.addElement(new Parameter("member_defs", IPPortDefinition[].class, member_defs, null));
call.setParams(PoolParams);
call.setMethodName("get_member_active_states");
resp = call.invoke(deskURI, urn);
// Extract return values...
That would explain the error of element "address" not found. It's expecting an array in and you are passing it by value.
-Joe
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects