Alex Boisvert wrote:
> I'm not sure I followed the entire conversation but this sounds interesting
> and useful.
>
> Are you saying you can perform a request-response WSDL operation over 2
> separate HTTP channels? I'm curious as to how the mechanics of this works
> in Axis2 and whether this message exchange would be recoverable (e.g. if the
> server goes down in-between)
Exactly. I've attached the example. If you want to give it a try, you'd
need an axis2 repository with an axis2.xml and the addressing module. On
the Ode side take the recent trunk war, engage the addressing module in
the axis2.xml and deploy the helloWorld2 example. Then you can
(hopefully) try the client.
>
> I'm guessing the existing "mex.timeout" endpoint property could be used to
> configure the timeout for the exchange. It's probably worth trying...
Yeah, but how should the timeout look for a process with a
<wait>
<for>'PT1Y'</for>
</wait>
lasting for one year? I think its more a conceptual issue that even a
synchronous process can last very long. I'm not entirely sure how the
Axis2-IL-engine-bridge tackles this but at the first look I saw a
invokeBlocking which seems to me like it's waiting until the process
completes (i.e. the MEX completes).
Cheers,
Tammo
package client;
import javax.xml.namespace.QName;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.client.async.AxisCallback;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.axis2.context.MessageContext;
public class AsyncHelloWorldMain {
public static final String AXIS_PATH = "C:\\usr\\local\\axis2-1.4.1\\";
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
//BasicConfigurator.configure();
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement request = omFactory.createOMElement(new QName(
"http://ode/bpel/unit-test.wsdl", "hello"));
OMElement input = omFactory.createOMElement(new QName(
"", "TestPart"));
input.setText("Hallo");
request.addChild(input);
Options options = new Options();
options.setTo(new EndpointReference(
"http://localhost:8080/ode/processes/helloWorld"));
//options.getTo().addReferenceParameter(new QName("urn:xx",
"xx"), "value");
options.setUseSeparateListener(true);
options.setAction("http://helloworld/hello");
ConfigurationContext context = ConfigurationContextFactory
.createConfigurationContextFromFileSystem(AXIS_PATH
+ "repository", AXIS_PATH +
"conf/axis2.xml");
context.getAxisConfiguration().getTransportIn("http").getParameter("port").setValue("7777");
context.getAxisConfiguration().engageModule(Constants.MODULE_ADDRESSING);
ServiceClient client = new ServiceClient(context, null);
client.setOptions(options);
client.sendReceiveNonBlocking(request, new AxisCallback() {
public void onComplete() {
System.err.println("onComplete");
}
public void onError(Exception e) {
System.err.println("onError:");
e.printStackTrace();
}
public void onFault(MessageContext mc) {
System.err.println("onFault: " +
mc.getEnvelope().toString());
}
public void onMessage(MessageContext mc) {
System.err.println(mc.getEnvelope().toString());
}
});
System.in.read();
System.exit(0);
}
}