Hi developers

 

Hi, Håkon

Thank you for the very good examples delivered in the past.

 

I struggle with axis2 services and corresponding client  BUT mainly with the 
setup for a true asynchron wire transport, both at client and service... 

 

This in conjunction with the JAX-WS samples provided by axis2-1.6.1

 

If the parameter as shown below is added to the service.xml then we have to 
deliver / deploy this setup somehow with the service

Where would you add 

<parameter name="messageReceiver.invokeOnSeparateThread">true</parameter>

BUT if no service.xml is present, as in the case of JAX-WS services, axis2 gets 
all this data by scanning the Hello*.jar in the WEB-INF/servicesjars directory 
for annotations, where and how is this parameter added? 

 

Where is it explained in the documentation?

 

As each side client and server has a Sender and a Receiver, do we need to 
configure the same parameter for a client side messageReceiver as well as for a 
server side messageReceiver?

 

Due to the symmetry we have at Client and at Server this issue is explained 
very confusing. I mean each side has a message sender and a message receiver 
and each runs in a separate thread, that makes 4 threads working, two at the 
client and two at the server. hence I would expect that the parameter mentioned 
above responsible joint with addressing engagement at client and at server, is 
a piece of information the client needs as well as the server.

 

AND now --- how and where do I add this parameter (and maybe others) with 
JAX-WS style coding of a true async-server and a true async-client?

 

any examples and thoughts welcome because the one example demonstrating ASYNC 
behavior, provided with axis2-1.6.1, does not run in mode "ASYNC"

 

Josef

 

 

 

Von: Håkon Sagehaug [mailto:hakon.sageh...@uni.no] 
Gesendet: Dienstag, 18. Januar 2011 15:36
An: java-user@axis.apache.org
Betreff: Re: Axis2: Difficulty/misunderstanding using axis2 asynchronous calls

 

hi

I had to add this line 

 <parameter name="messageReceiver.invokeOnSeparateThread">true</parameter>



In my services.xml, have you tried that? 

Håkon

 

On 17 January 2011 16:57, James Oisin Flynn <den.galna....@hotmail.com> wrote:


I am having difficulties getting an asynchronous axis2 client to work, very 
possibly due to my misunderstanding of the way axis2 is supposed to work, 
though I have not been able to find any analogous examples.

 

I have a web service created in Eclipse using the bottom up approach. The web 
service in question works fine synchronously, but really needs to function 
asynchronously due to unpredictable latencies. The interface and 
implementations of a part of this web service are the following

 

Interface:

 

@WebService

@SOAPBinding( style = Style.DOCUMENT )

public interface DatabaseSource

{

@WebMethod

@WebResult( name = "TableColumns", targetNamespace = "http://rec.ws"; )

public TableColumn[] reflectTable(

@WebParam( name = "SessionId", targetNamespace = "http://rec.ws"; )

SessionId sessionId,

@WebParam( name = "DatabaseConfig", targetNamespace = "http://rec.ws"; )

String sourceName,

@WebParam( name = "Table", targetNamespace = "http://rec.ws"; )

String tableName ) throws SQLException, ReconciliationException;

}

 

Implementation:

 

public class DatabaseSourceWS implements DatabaseSource

{

private ReconciliationServices reconciliationServer;

public DatabaseSourceWS()

{

if ( reconciliationServer == null )

{

reconciliationServer = ReconciliationServiceWS.getService();

}

}

 

public TableColumn[]

reflectTable( SessionId sessionId, String sourceName, String tableName )

throws SQLException, ReconciliationException

{

ReconciliationServiceImpl service =

reconciliationServer.getSession( sessionId );

database.isl.DatabaseSource source =

service.getSource( sourceName );

Table table = service.getTable( tableName );

if ( source != null && table != null )

{

source.connect();

source.reflectTable( table );

return table.getColumns();

}

return null;

}

}

 

 

The client is also built using Eclipse and Axis2 from the WSDL generated when 
the service is generated.

The client, and it's callback handler are the following...

 

The callback handler:

 

private class SourceCallbackHandler extends DatabaseSourceWSCallbackHandler

implements Runnable

{

private SourceCallbackHandler()

{

Thread waitThread = new Thread( this );

waitThread.start();

}

 

public void run()

{

synchronized ( this )

{

try

{

this.wait();

}

catch ( InterruptedException cont )

{}

}

}

 

private void continu()

{

synchronized ( this )

{

this.notifyAll();

}

}

 

private TableColumn[] columns;

public void receiveResultreflectTable( ReflectTableResponse result )

{

columns = result.get_return();

continu();

}

 

public void receiveErrorreflectTable( java.lang.Exception e )

{

e.printStackTrace();

// throw a new exception and run continu() in finally clause.

continu();

}

 

public TableColumn[] getColumns()

{ return columns; }

}

 

 

The client:

 

public DatabaseSourceClient()

{

try

{

this.databaseSourceStub = new DatabaseSourceWSStub();

}

catch ( AxisFault af )

{

af.printStackTrace();

}

}

 

public void setSessionId( SessionId sessionId )

{

this.sessionId = sessionId;

}

 

public void setSourceConfig( DatabaseConfig sourceConfig )

{

this.sourceConfig = sourceConfig;

}

 

// ....

public void reflectTable( Table table ) throws SQLException

{

ReflectTable reflect = new ReflectTable();

reflect.setSessionId( buildSession());

reflect.setSourceName( sourceConfig.getSourceName());

reflect.setTableName( table.getName());

SourceCallbackHandler handler = new SourceCallbackHandler();

try

{

synchronized ( handler )

{

databaseSourceStub.startreflectTable( reflect, handler );

handler.wait();

}

}

catch ( RemoteException re )

{

re.printStackTrace();

}

catch ( InterruptedException cont ){}

if ( handler.getColumns() != null )

{

setColumns( table, handler.getColumns());

}

}

}

 

 

On execution, with the following code. The client successfully connects to the 
web service. The web service successfully completes, and directly returns the 
result of the operation, an array of columns, to the client. However, the reply 
is somehow not received. The client sits in wait until the socket times out, 
and then exits through the callback handlers receiveErrorreflectTable( 
java.lang.Exception e ) method with the following exception:

 

org.apache.axis2.AxisFault: Read timed out

at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)

at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:203)

at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:76)

at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:400)

at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:225)

at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435)

at 
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:402)

at 
org.apache.axis2.description.OutInAxisOperationClient$NonBlockingInvocationWorker.run(OutInAxisOperation.java:442)

at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

at java.lang.Thread.run(Thread.java:619)

Caused by: java.net.SocketTimeoutException: Read timed out

at java.net.SocketInputStream.socketRead0(Native Method)

at java.net.SocketInputStream.read(SocketInputStream.java:129)

at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)

at java.io.BufferedInputStream.read(BufferedInputStream.java:237)

at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:78)

at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:106)

at 
org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1116)

at 
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.readLine(MultiThreadedHttpConnectionManager.java:1413)

at 
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1973)

at 
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)

at 
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)

at 
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)

at 
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)

at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)

at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)

at 
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542)

at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:199)

...

 

Any help or suggestions would be welcome.

Cheers.

 

Reply via email to