in jelly-tags/soap/src/main/java/org/apache/commons/jelly/tags/soap/InvokeTag.java [53:106]
public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException {
if (endpoint == null) {
throw new MissingAttributeException("endpoint");
}
if (namespace == null) {
throw new MissingAttributeException("namespace");
}
if (method == null) {
throw new MissingAttributeException("method");
}
Object[] params = getParamArray();
if (params == null) {
params = new Object[]{ getBodyText() };
} else {
// invoke body just in case we have nested tags
invokeBody(output);
}
Service service = getService();
if (service == null) {
service = createService();
}
Object answer = null;
try {
Call call = (Call) service.createCall();
// @todo Jelly should have native support for URL and QName
// directly on properties
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName(namespace, method));
if ( userName != null && !userName.isEmpty() ) {
call.setUsername( userName );
call.setPassword( password );
}
answer = call.invoke(params);
} catch (MalformedURLException e) {
throw new JellyTagException(e);
} catch (ServiceException e) {
throw new JellyTagException(e);
} catch (RemoteException e) {
throw new JellyTagException(e);
}
if (var != null) {
context.setVariable(var, answer);
} else {
// should turn the answer into XML events...
throw new JellyTagException( "Not implemented yet; should stream results as XML events. Results: " + answer );
}
}