in modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java [2268:2486]
protected Element generateMethodElement(Document doc,
String endpointName,
AxisBindingOperation bindingOperation) throws DOMException {
AxisOperation axisOperation = bindingOperation.getAxisOperation();
Element methodElement;
List soapHeaderInputParameterList = new ArrayList();
List soapHeaderOutputParameterList = new ArrayList();
methodElement = doc.createElement("method");
String localPart = axisOperation.getName().getLocalPart();
if (this.codeGenConfiguration.isUseOperationName()) {
addAttribute(doc, "name", JavaUtils.xmlNameToJava(localPart), methodElement);
} else {
addAttribute(doc, "name", JavaUtils.xmlNameToJavaIdentifier(localPart), methodElement);
}
addAttribute(doc, "originalName", localPart, methodElement);
addAttribute(doc, "namespace", axisOperation.getName().getNamespaceURI(), methodElement);
addAttribute(doc, "style", (String) getBindingPropertyFromOperation(
WSDLConstants.WSDL_1_1_STYLE, axisOperation.getName()), methodElement);
// add documentation for this operation
String comment = "";
if (axisOperation.getDocumentation() != null){
comment = axisOperation.getDocumentation().trim();
}
addAttribute(doc, "comment", comment, methodElement);
String messageExchangePattern = axisOperation.getMessageExchangePattern();
//Jaxws Specific
if("jax-ws".equals(codeGenConfiguration.getOutputLanguage())){
boolean wrapped = false;
if (WSDLUtil.isInputPresentForMEP(messageExchangePattern)) {
AxisMessage msg = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if(msg.getParameter(Constants.UNWRAPPED_KEY) != null){
wrapped = true;
}
}
addAttribute(doc, "parameterstyle", (wrapped)?"WRAPPPED":"BARE", methodElement);
}
addAttribute(doc, "dbsupportname",
endpointName + localPart + DATABINDING_SUPPORTER_NAME_SUFFIX,
methodElement);
addAttribute(doc, "mep", Utils.getAxisSpecifMEPConstant(messageExchangePattern) + "",
methodElement);
addAttribute(doc, "mepURI", messageExchangePattern, methodElement);
Parameter wsdl2StyleParameter = axisOperation.getParameter(WSDL2Constants.OPERATION_STYLE);
if (wsdl2StyleParameter != null) {
// provide WSDL2 styles to allow templates to take advantage of them, if desired
addAttribute(doc, "wsdl2Styles", arrayToString((URI[])wsdl2StyleParameter.getValue()), methodElement);
}
// check for this operation to be handled directly by databinding code generation
Parameter dbmethname = axisOperation.getParameter(Constants.DATABINDING_GENERATED_RECEIVER);
if (dbmethname != null) {
addAttribute(doc, "usedbmethod", (String) dbmethname.getValue(), methodElement);
}
Parameter dbgenimpl =
axisOperation.getParameter(Constants.DATABINDING_GENERATED_IMPLEMENTATION);
if (dbgenimpl != null && Boolean.TRUE.equals(dbgenimpl.getValue())) {
addAttribute(doc, "usdbimpl", "true", methodElement);
} else {
addAttribute(doc, "usdbimpl", "false", methodElement);
}
addSOAPAction(doc, methodElement, bindingOperation.getName());
addOutputAndFaultActions(doc, methodElement, axisOperation);
addHeaderOperations(soapHeaderInputParameterList, bindingOperation, true);
// addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false);
if (WSDLUtil.isInputPresentForMEP(messageExchangePattern)) {
if("jax-ws".equals(codeGenConfiguration.getOutputLanguage())){
useHolderClass_jaxws = false;
AxisMessage inMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
if (WSDLUtil.isOutputPresentForMEP(messageExchangePattern)) {
AxisMessage outMessage = axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
if(inMessage.getName().equals(outMessage.getName())){
// in/out message
useHolderClass_jaxws = true;
addAttribute(doc, "useholder", "true", methodElement);
}
}
}
methodElement.appendChild(getInputElement(doc,
bindingOperation, soapHeaderInputParameterList));
}
if (WSDLUtil.isOutputPresentForMEP(messageExchangePattern)) {
methodElement.appendChild(getOutputElement(doc,
bindingOperation,
soapHeaderOutputParameterList));
}
methodElement.appendChild(getFaultElement(doc,
axisOperation));
setTransferCoding(axisOperation, methodElement, doc);
String property = (String) getBindingPropertyFromOperation(
WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR",
"\"" + property + "\""));
}
property = (String) getBindingPropertyFromOperation(
WSDL2Constants.ATTR_WHTTP_LOCATION,
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_LOCATION",
"\"" + property + "\""));
}
String mep = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WSOAP_MEP,
axisOperation.getName());
String bindingType = null;
if (axisBinding != null) {
bindingType = axisBinding.getType();
}
if (WSDL2Constants.URI_WSOAP_MEP.equalsIgnoreCase(mep)) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.ENABLE_REST",
"true"));
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.HTTP_METHOD",
"\"" +
org.apache.axis2.Constants.Configuration
.HTTP_METHOD_GET +
"\""));
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.CONTENT_TYPE",
"\"" +
org.apache.axis2.kernel.http.HTTPConstants
.MEDIA_TYPE_X_WWW_FORM +
"\""));
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.MESSAGE_TYPE",
"\"" +
org.apache.axis2.kernel.http.HTTPConstants
.MEDIA_TYPE_X_WWW_FORM +
"\""));
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.SOAP_RESPONSE_MEP",
"true"));
} else if (bindingType != null && bindingType.equals(WSDL2Constants.URI_WSDL2_HTTP)) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.ENABLE_REST",
"true"));
property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_METHOD,
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.HTTP_METHOD",
"\"" + property + "\""));
} else if (!WSDL2Constants.URI_WSOAP_MEP.equalsIgnoreCase(mep)) {
// If there is no WHTTP_METHOD defined then we better compute the default value which is get if the operation
// is wsdlx:safe or post otherwise
Parameter safe = axisOperation.getParameter(WSDL2Constants.ATTR_WSDLX_SAFE);
if (safe != null) {
if (((Boolean) safe.getValue()).booleanValue()) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.HTTP_METHOD",
"\"" +
org.apache.axis2.Constants.Configuration
.HTTP_METHOD_GET +
"\""));
} else {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.HTTP_METHOD",
"\"" +
org.apache.axis2.Constants.Configuration
.HTTP_METHOD_POST +
"\""));
}
}
}
Boolean value = (Boolean) getBindingPropertyFromOperation(
WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED,
axisOperation.getName());
if (value != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_IGNORE_UNCITED",
"\"" + value.booleanValue() +
"\""));
}
property = (String) getBindingPropertyFromOperation(WSDL2Constants.ATTR_WHTTP_CODE,
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_CODE",
"\"" + property + "\""));
}
property = (String) getBindingPropertyFromOperation(
WSDL2Constants.ATTR_WHTTP_INPUT_SERIALIZATION,
axisOperation.getName());
if (property != null) {
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.CONTENT_TYPE",
"\"" + property + "\""));
methodElement.appendChild(generateOptionParamComponent(doc,
"org.apache.axis2.Constants.Configuration.MESSAGE_TYPE",
"\"" + property + "\""));
}
}
return methodElement;
}