splitParameters(bodyParams, headerParams, method.getRequestParameters());
SOAPBinding soapBinding = method.getBinding();
operation.soap12Operation().soapAction(soapBinding.getSOAPAction());
// input
TypedXmlWriter input = operation.input();
extension.addBindingOperationInputExtension(input, method);
com.sun.xml.ws.wsdl.writer.document.soap12.BodyType body = input._element(com.sun.xml.ws.wsdl.writer.document.soap12.Body.class);
boolean isRpc = soapBinding.getStyle().equals(Style.RPC);
if (soapBinding.getUse().equals(Use.LITERAL)) {
body.use(LITERAL);
if (headerParams.size() > 0) {
if (bodyParams.size() > 0) {
ParameterImpl param = bodyParams.iterator().next();
if (isRpc) {
StringBuffer parts = new StringBuffer();
int i=0;
for (ParameterImpl parameter : ((WrapperParameter)param).getWrapperChildren()) {
if (i++>0)
parts.append(' ');
parts.append(parameter.getPartName());
}
body.parts(parts.toString());
} else {
body.parts(param.getPartName());
}
} else {
body.parts("");
}
generateSOAP12Headers(input, headerParams, requestMessage);
}
if (isRpc) {
body.namespace(method.getRequestParameters().iterator().next().getName().getNamespaceURI());
}
} else {
// TODO localize this
throw new WebServiceException("encoded use is not supported");
}
if (method.getMEP() != MEP.ONE_WAY) {
// output
boolean unwrappable = headerParams.size() == 0;
bodyParams.clear();
headerParams.clear();
splitParameters(bodyParams, headerParams, method.getResponseParameters());
unwrappable = unwrappable ? headerParams.size() == 0 : unwrappable;
TypedXmlWriter output = operation.output();
extension.addBindingOperationOutputExtension(output, method);
body = output._element(com.sun.xml.ws.wsdl.writer.document.soap12.Body.class);
body.use(LITERAL);
if (headerParams.size() > 0) {
if (bodyParams.size() > 0) {
ParameterImpl param = bodyParams.iterator().next();
if (isRpc) {