// Retrieve binding and extension
InterfaceMessageReference iMsgRef = iMsgRefs[j];
BindingMessageReference bMsgRef = findBindingMessage(wsdlBindingOperation, iMsgRef);
HTTPBindingMessageReferenceExtensions msgExt = bMsgRef != null ? (HTTPBindingMessageReferenceExtensions) bMsgRef.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) : null;
// Create message
Wsdl2HttpMessageImpl message = new Wsdl2HttpMessageImpl();
// Standard WSDL2 attributes
message.setContentModel(ContentModel.parse(iMsgRef.getMessageContentModel()));
message.setElementName(iMsgRef.getElementDeclaration().getName());
if (!XSD_2001_SYSTEM.equals(iMsgRef.getElementDeclaration().getSystem())) {
throw new IllegalStateException("Unsupported type system: " + iMsgRef.getElementDeclaration().getSystem());
}
if (Constants.API_APACHE_WS_XS.equals(iMsgRef.getElementDeclaration().getContentModel())) {
XmlSchemaElement xsEl = (XmlSchemaElement) iMsgRef.getElementDeclaration().getContent();
message.setElementDeclaration(xsEl);
}
// HTTP extensions
if (msgExt != null) {
message.setHttpTransferCoding(msgExt.getHttpTransferCoding());
HTTPHeader[] headers = msgExt.getHttpHeaders();
for (int k = 0; k < headers.length; k++) {
Wsdl2HttpHeaderImpl h = new Wsdl2HttpHeaderImpl();
h.setName(headers[k].getName());
h.setRequired(headers[k].isRequired() ? headers[k].isRequired().booleanValue() : false);
if (!XSD_2001_SYSTEM.equals(headers[k].getTypeDefinition().getSystem())) {
throw new IllegalStateException("Unsupported type system: " + headers[k].getTypeDefinition().getSystem());
}
h.setType(headers[k].getTypeDefinition().getName());
message.addHttpHeader(h);
}
}
// Add the message
if (iMsgRef.getDirection() == Direction.IN) {
operation.setInput(message);