public OMElement toWSDL20(OMNamespace wsdl,
OMNamespace tns,
OMNamespace wsoap,
OMNamespace whttp,
Map nameSpaceMap) {
String property;
ArrayList list;
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement bindingMessageElement;
// If this is a fault, create a fault element and add fault specific
// properties
if (this.isFault()) {
if (this.getParent() instanceof AxisBinding) {
bindingMessageElement = omFactory.createOMElement(
WSDL2Constants.FAULT_LOCAL_NAME, wsdl);
} else if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.equals(this
.getDirection())) {
bindingMessageElement = omFactory.createOMElement(
WSDL2Constants.IN_FAULT_LOCAL_NAME, wsdl);
} else {
bindingMessageElement = omFactory.createOMElement(
WSDL2Constants.OUT_FAULT_LOCAL_NAME, wsdl);
}
bindingMessageElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_REF, null, tns.getPrefix() + ":"
+ this.name));
WSDL20Util.extractWSDL20SoapFaultInfo(options,
bindingMessageElement, omFactory, wsoap);
Integer code = (Integer) this.options
.get(WSDL2Constants.ATTR_WHTTP_CODE);
if (code != null) {
bindingMessageElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_CODE, whttp, code.toString()));
}
// Checks whether the message is an input message
} else if (WSDLConstants.WSDL_MESSAGE_DIRECTION_IN.equals(this
.getDirection())) {
bindingMessageElement = omFactory.createOMElement(
WSDL2Constants.IN_PUT_LOCAL_NAME, wsdl);
// Message should be an output message
} else {
bindingMessageElement = omFactory.createOMElement(
WSDL2Constants.OUT_PUT_LOCAL_NAME, wsdl);
}
// Populate common properties
property = (String) this.options
.get(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING);
if (property != null) {
bindingMessageElement
.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_CONTENT_ENCODING, whttp,
property));
}
list = (ArrayList) this.options.get(WSDL2Constants.ATTR_WHTTP_HEADER);
if (list != null && list.size() > 0) {
WSDLSerializationUtil.addHTTPHeaderElements(omFactory, list, whttp,
bindingMessageElement, nameSpaceMap);
}
list = (ArrayList) this.options.get(WSDL2Constants.ATTR_WSOAP_HEADER);
if (list != null && list.size() > 0) {
WSDLSerializationUtil.addSOAPHeaderElements(omFactory, list, wsoap,
bindingMessageElement, nameSpaceMap);
}
list = (ArrayList) this.options.get(WSDL2Constants.ATTR_WSOAP_MODULE);
if (list != null && list.size() > 0) {
WSDLSerializationUtil.addSOAPModuleElements(omFactory, list, wsoap,
bindingMessageElement);
}
WSDLSerializationUtil.addWSDLDocumentationElement(this,
bindingMessageElement, omFactory, wsdl);
WSDLSerializationUtil.addPoliciesAsExtensibleElement(this,
bindingMessageElement);
return bindingMessageElement;
}
Generates the bindingMessage element (can be input, output, infault or
outfault) |