List<Argument> arguments = this.procedure.getArguments();
String style = (String)arguments.get(0).getArgumentValue().getValue();
String action = (String)arguments.get(1).getArgumentValue().getValue();
XMLType docObject = (XMLType)arguments.get(2).getArgumentValue().getValue();
StreamSource source = null;
try {
source = convertToSource(docObject);
String endpoint = (String)arguments.get(3).getArgumentValue().getValue();
if (style == null) {
style = executionFactory.getDefaultBinding().getBindingId();
} else {
try {
Binding type = Binding.valueOf(style.toUpperCase());
style = type.getBindingId();
} catch (IllegalArgumentException e) {
throw new TranslatorException(WSExecutionFactory.UTIL.getString("invalid_invocation", Arrays.toString(Binding.values()))); //$NON-NLS-1$
}
}
Dispatch<StreamSource> dispatch = conn.createDispatch(style, endpoint, StreamSource.class, executionFactory.getDefaultServiceMode());
if (Binding.HTTP.getBindingId().equals(style)) {
if (action == null) {
action = "POST"; //$NON-NLS-1$
}
dispatch.getRequestContext().put(MessageContext.HTTP_REQUEST_METHOD, action);
if (source != null && !"POST".equalsIgnoreCase(action)) { //$NON-NLS-1$
if (this.executionFactory.getXMLParamName() == null) {
throw new WebServiceException(WSExecutionFactory.UTIL.getString("http_usage_error")); //$NON-NLS-1$
}
try {
Transformer t = TransformerFactory.newInstance().newTransformer();
StringWriter writer = new StringWriter();
//TODO: prevent this from being too large
t.transform(source, new StreamResult(writer));
String param = Util.httpURLEncode(this.executionFactory.getXMLParamName())+"="+Util.httpURLEncode(writer.toString()); //$NON-NLS-1$
endpoint = WSConnection.Util.appendQueryString(endpoint, param);
} catch (TransformerException e) {
throw new WebServiceException(e);
}
}
} else {
if (action != null) {
dispatch.getRequestContext().put(Dispatch.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
dispatch.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, action);
}
}
if (source == null) {
// JBoss Native DispatchImpl throws exception when the source is null
source = new StreamSource(new StringReader("<none/>")); //$NON-NLS-1$
}
this.returnValue = dispatch.invoke(source);
} catch (SQLException e) {
throw new TranslatorException(e);
} catch (WebServiceException e) {