use of org.apache.cxf.service.model.BindingMessageInfo in project camel by apache.
the class CxfProducer method checkParameterSize.
private void checkParameterSize(CxfEndpoint endpoint, Exchange exchange, Object[] parameters) {
BindingOperationInfo boi = getBindingOperationInfo(exchange);
if (boi == null) {
throw new RuntimeCamelException("Can't find the binding operation information from camel exchange");
}
if (!endpoint.isWrapped()) {
if (boi.isUnwrappedCapable()) {
boi = boi.getUnwrappedOperation();
}
}
int experctMessagePartsSize = boi.getInput().getMessageParts().size();
if (parameters.length < experctMessagePartsSize) {
throw new IllegalArgumentException("Get the wrong parameter size to invoke the out service, Expect size " + experctMessagePartsSize + ", Parameter size " + parameters.length + ". Please check if the message body matches the CXFEndpoint POJO Dataformat request.");
}
if (parameters.length > experctMessagePartsSize) {
// need to check the holder parameters
int holdersSize = 0;
for (Object parameter : parameters) {
if (parameter instanceof Holder) {
holdersSize++;
}
}
// need to check the soap header information
int soapHeadersSize = 0;
BindingMessageInfo bmi = boi.getInput();
if (bmi != null) {
List<SoapHeaderInfo> headers = bmi.getExtensors(SoapHeaderInfo.class);
if (headers != null) {
soapHeadersSize = headers.size();
}
}
if (holdersSize + experctMessagePartsSize + soapHeadersSize < parameters.length) {
throw new IllegalArgumentException("Get the wrong parameter size to invoke the out service, Expect size " + (experctMessagePartsSize + holdersSize + soapHeadersSize) + ", Parameter size " + parameters.length + ". Please check if the message body matches the CXFEndpoint POJO Dataformat request.");
}
}
}
Aggregations