Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.4.1
-
Novice
Description
I found the cause of the problem to be a bug in this method in CXF (I have version 2.4.1):
private Map<String, QName> createPayloadEleOpNameMap(BindingInfo bindingInfo) {
Map<String, QName> payloadElementMap = new java.util.HashMap<String, QName>();
for (BindingOperationInfo bop : bindingInfo.getOperations()) {
SoapOperationInfo soi = (SoapOperationInfo)bop.getExtensor(SoapOperationInfo.class);
if (soi != null) {
if ("document".equals(soi.getStyle())) {
// if doc
if (bop.getOperationInfo().getInput() != null
&& !bop.getOperationInfo().getInput().getMessageParts().isEmpty())
} else if ("rpc".equals(soi.getStyle()))
{ // if rpc payloadElementMap.put(bop.getOperationInfo().getName().toString(), bop.getOperationInfo() .getName()); } }
}
return payloadElementMap;
}
The problem is that it requires the SoapOperationInfo to have a style attribute, but in the W3C spec for WSDL it says the style attribute on the soap operation is optional, specifically 'If the attribute is not specified, it defaults to the value specified in the soap:binding element. If the soap:binding element does not specify a style, it is assumed to be "document".' So the code needs to check if the soi has a style and if not read it from the binding and if not then set it as "document". This is not a problem in the WSDLs generated by CXF (as I found out with a HelloWorld test) because it creates these optional style attributes, but since W3C says people can generate WSDLs without these (and I ran into one) I think it's worth fixing.