I'm going to assume you are using CXF 2.0.4 or the 2.1 snapshots If
not, definitely update as what I'm about to describe applies to code
enhanced for that version
It SOUNDS like you are using a wrapped doc/literal wsdl, which is fine.
However, in that case, the wsdl message only has a single part in it.
That is why your call to parts.size() is returning one as the raw
OperationInfo you are getting is exactly as it appears in the wsdl.
However, the OperationInfo has a isUnwrappedCapable() call, and if
true, a getUnwrappedOperation() call that can return a new OperationInfo
that describes the same operation, but in it's unwrapped form.
With 2.0.3, you pretty much HAD to user the Unwrapped OperationInfo form.
There wasn't any other option.
With 2.0.4, you have a choice of which form to use. The
Client.invoke(...) calls all expect the params to match what
the Unwrapped Operation says they will be. However, we
added Client.invokeUnwrapped(...) calls that match what the original
Wrapped operation says. (in your case, one part which would be the
wrapper type. Like a EchoFoo object returning a EchoFooResponse
object).
Hope that helps.
Dan
On Thursday 28 February 2008, MartyH wrote:
Hi,
I'm trying to figure out how to get the number of input and output
parameters using cxf. I had managed to do this using xfire, but since
upgrading I haven't been able to twig this one. Been trying
combinations of this:
ServiceInfo model
=client.getEndpoint().getService().getServiceInfos().get(0);
InterfaceInfo interfaceInfo = model.getInterface();
CollectionOperationInfo operationInfos2 =
interfaceInfo.getOperations();
OperationInfo toCall = null;
for (OperationInfo operationInfo:operationInfos2){
if
(operationInfo.getName().getLocalPart().equals(methodName)){ toCall =
operationInfo;
break;
}
}
List parts = toCall.getInput().getMessageParts();
serviceInfo.put(input,new Integer(parts.size()));
logger.info(Number of input parameters: + parts.size());
List outputParts = toCall.getOutput().getMessageParts();
serviceInfo.put(output,new Integer(outputParts.size()));
logger.info(Number of ouput parameters: +
outputParts.size());
and this:
CollectionBindingOperationInfo operationInfos =
client.getEndpoint().getBinding().getBindingInfo().getOperations();
BindingOperationInfo opToCall = null;
for(BindingOperationInfo oi: operationInfos) {
if (oi.getName().getLocalPart().equals(methodName)) {
opToCall = oi;
}
}
parts = opToCall.getInput().getMessageParts();
serviceInfo.put(input,new Integer(parts.size()));
logger.info(Number of input parameters: + parts.size());
outputParts = opToCall.getOutput().getMessageParts();
serviceInfo.put(output,new Integer(outputParts.size()));
logger.info(Number of ouput parameters: +
outputParts.size());
but it always seems to through back 1 and 1 as input and ouptput.
Hope you can help,
thanks.
Marty
--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog