Hello Folks,
I'm working on a way to describe webservices for usage within an
agent-platform. To make it possible that softwareagents on this platform
can use it I need to read out informations about the classes needed to
invoke the service. Eventually I need the name of the parameterclass and
a classobject of that class.
At the moment I try to get these informations from the dynamicClient
created with the DynamicClientFactory. Which seems to work fine for
RPC/literal services.
As using document/literal the only messagepart encapsulates the true
parameters of the invoke call. And that's where the trouble starts.
I managed to get the name of the classes involved (listing included
below), but I need to get classobjects for these classes at runtime
without knowing anything about them at coding time.
Does somebody know how to get a classobject from the parameters and
perhaps some informations about the minOccur and maxOccur properties of
these parameters?
Collection<BindingOperationInfo> binOpInfos =
dynamicClient.getEndpoint().getBinding().getBindingInfo().getOperations();
for (BindingOperationInfo opInfo : binOpInfos){
ArrayList<Class<?>> inputs = new ArrayList<Class<?>>();
ArrayList<String> inputTypeNames = new ArrayList<String>();
if (!opInfo.isUnwrapped() && opInfo.isUnwrappedCapable()){
opInfo = opInfo.getUnwrappedOperation();
}
BindingMessageInfo mesInputInfo = opInfo.getInput();
BindingMessageInfo mesOutputInfo = opInfo.getOutput();
// processing input
for ( MessagePartInfo part : mesInputInfo.getMessageParts()){
if (part.isElement()){
// document/literal wrapped
for (Field f: part.getTypeClass().getDeclaredFields()){
ParameterizedTypeImpl parmTI =
(ParameterizedTypeImpl)
f.getGenericType();
for (Type t : parmTI.getActualTypeArguments()){
//adding typename of arguments to the
list:
inputTypeNames.add(t.toString().substring(6));
}
}
} else {
}
}
}
hopeful greetings
Martin