You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Clark, Stephen" <st...@fairisaac.com> on 2007/12/14 10:13:20 UTC

NonBlockingDual Client Question

All,
 
I am new to Axis and have been trying to update the NonBlockingDual
client to use Transport Asynchrony for a specific web service.  The
example works OK if i do not use a separate listener but as soon as I
set options.setUseSeparateListener(true); and run the example it simply
hangs.  I am using the default axis2.xml file supplied with the
userguide samples.  I have included the source code at the end of this
e-mail.
 
Is there anything I am doing that is obviously wrong?
 
Thanks
 
Steve
 
package userguide.clients;
 
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
 
import org.apache.axis2.AxisFault;
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.AsyncResult;
import org.apache.axis2.client.async.Callback;
 
import javax.xml.namespace.QName;
 
/**
 * Sample for asynchronous dual channel non-blocking service invocation.
 * Message Exchage Pattern IN-OUT
 * Ulitmate asynchronous service invocation sample.
 */
public class EchoNonBlockingDualClient {
    private static EndpointReference targetEPR = new
EndpointReference("http://www.webservicex.net/uklocation.asmx
<http://www.webservicex.net/uklocation.asmx> ");
 
    public static void main(String[] args) {
        ServiceClient sender = null;
        try {
            OMFactory fac = OMAbstractFactory.getOMFactory();
            OMNamespace ns =
fac.createOMNamespace("http://www.webserviceX.NET
<http://www.webserviceX.NET> ", "");
            OMElement method =
fac.createOMElement("GetUKLocationByTown", ns);
            OMElement value = fac.createOMElement("Town", ns);
            value.setText("Coventry");
            method.addChild(value);
 
            Options options = new Options();
            options.setTo(targetEPR);            
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
 
options.setAction("http://www.webserviceX.NET/GetUKLocationByTown
<http://www.webserviceX.NET/GetUKLocationByTown> ");
            options.setTimeOutInMilliSeconds(60000);
            options.setUseSeparateListener(true);    
 
            //Callback to handle the response
            Callback callback = new Callback() {
                public void onComplete(AsyncResult result) {
                    System.out.println(result.getResponseEnvelope());
                }
 
                public void onError(Exception e) {
                    e.printStackTrace();
                }
            };
 
            //Non-Blocking Invocation
            sender = new ServiceClient();
            sender.setOptions(options);
 
            sender.engageModule(Constants.MODULE_ADDRESSING);
            sender.sendReceiveNonBlocking(method, callback);
 
            //Wait till the callback receives the response.
            while (!callback.isComplete()) {
                Thread.sleep(1000);
            }
            //Need to close the Client Side Listener.
 
        } catch (AxisFault axisFault) {
            axisFault.printStackTrace();
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            try {
                sender.cleanup();
            } catch (AxisFault axisFault) {
                //have to ignore this
            }
        }
 
    }
}

This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.


Re: NonBlockingDual Client Question

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
On 17 Dec 2007, at 09:40, Clark, Stephen wrote:

> Hi Michele,
>
> Thanks for all your help.
>
> I have had a look through the WSDL for the web service I am connecting
> to and it does not contain a UsingAddressing element so I don't think
> that it supports WS-Addressing.
>
> In this situation wouldn't it be better for Axis to return an error to
> the effect that WS-Addressing is not supported on the server?

The problem is on the server side (.NET, right?), not on the client  
side.

>
> Additionally, do you know of any public web services that support
> WS-Addressing that I can test my client against?

No, but I would give a try to Google/Amazon/Yahoo  WS.



Michele

>
> Thanks
>
> Steve
>
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: 14 December 2007 15:58
> To: axis-user@ws.apache.org
> Subject: Re: NonBlockingDual Client Question
>
>
> On 14 Dec 2007, at 14:57, Clark, Stephen wrote:
>
>> Michele,
>>
>> How do I look at the logs on the server?  It is not a service that I
>> have any internal access to.  Are there any tools you can recommend
>> for me to use to look on the server?
>
> Ah, it looks like the only option you have is to proxy your client  
> with
> tools like tcpmon [1]. This way you'll find out where the problem is.
>
>>
>> Note that the sample works OK when using a single transport, it is
>> only when I set 'options.setUseSeparateListener(true);' that the
>> problem occurs.
>
> hmmm... this could happen because in order to use a separate listener
> (i.e. 2 http connections) both sides (i.e. client and server) must use
> WS-addressing. Do you know whether the service WS-addressing enabled?
>
>
> Michele
>
>
> [1] http://ws.apache.org/commons/tcpmon/index.html
>>
>> Thanks
>>
>> Steve
>>
>> -----Original Message-----
>> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>> Sent: 14 December 2007 14:50
>> To: axis-user@ws.apache.org
>> Subject: Re: NonBlockingDual Client Question
>>
>>
>> On 14 Dec 2007, at 14:05, Clark, Stephen wrote:
>>
>>> Michele,
>>>
>>> Thanks for the quick response and the pointers.
>>>
>>> I think that in this case the soap action is correct since the WSDL
>>> has the following statement in it:
>>> 	
>>>       <soap:operation
>>> soapAction="http://www.webserviceX.NET/GetUKLocationByTown"
>>> style="document" />
>>>
>>> In terms of hanging, it is my client that is waiting on the callback
>>> to complete that appears to be suspended.  Do you know of an  
>>> external
>
>>> web service that works when running the NonBlockingDual client with
>>> an
>>
>>> asynchronous transport?  The service that I am currently connecting
>>> to
>>
>>> is written in .NET so it may be that other options need to be set in
>>> Axis in order for it to work correctly using two transports.
>>>
>> Are you sure that the request is executed on the service side? Any
>> log/error on the server?
>>
>>
>>
>> Michele
>>
>>> Thanks for your help,
>>>
>>> Steve
>>>
>>>
>>> -----Original Message-----
>>> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>>> Sent: 14 December 2007 09:49
>>> To: axis-user@ws.apache.org
>>> Subject: Re: NonBlockingDual Client Question
>>>
>>> Steve,
>>>
>>>
>>> what do you mean by hang?, does the service wait forever?, what
>>> happens on the server side, any log?
>>>
>>> Maybe it won't fix your problem, but here are a couple of advices:
>>> - the soap action usually starts with "urn:" and it's followed by  
>>> the
>
>>> operation name
>>> - in the finally block you change the state of your sender object,
>>> which may be null
>>>
>>>
>>> Michele
>>>
>>>
>>> On 14 Dec 2007, at 09:13, Clark, Stephen wrote:
>>>
>>>> All,
>>>>
>>>> I am new to Axis and have been trying to update the NonBlockingDual
>>>> client to use Transport Asynchrony for a specific web service.  The
>>>> example works OK if i do not use a separate listener but as soon as
>>>> I set options.setUseSeparateListener(true); and run the example it
>>>> simply hangs.  I am using the default axis2.xml file supplied with
>>>> the
>>>
>>>> userguide samples.  I have included the source code at the end of
>>>> this
>>>
>>>> e-mail.
>>>>
>>>> Is there anything I am doing that is obviously wrong?
>>>>
>>>> Thanks
>>>>
>>>> Steve
>>>>
>>>> package userguide.clients;
>>>>
>>>> import org.apache.axiom.om.OMAbstractFactory;
>>>> import org.apache.axiom.om.OMElement; import
>>>> org.apache.axiom.om.OMFactory; import
>>>> org.apache.axiom.om.OMNamespace;
>>>>
>>>> import org.apache.axis2.AxisFault;
>>>> 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.AsyncResult;
>>>> import org.apache.axis2.client.async.Callback;
>>>>
>>>> import javax.xml.namespace.QName;
>>>>
>>>> /**
>>>>  * Sample for asynchronous dual channel non-blocking service
>>>> invocation.
>>>>  * Message Exchage Pattern IN-OUT
>>>>  * Ulitmate asynchronous service invocation sample.
>>>>  */
>>>> public class EchoNonBlockingDualClient {
>>>>     private static EndpointReference targetEPR = new
>>>> EndpointReference("http://www.webservicex.net/uklocation.asmx");
>>>>
>>>>     public static void main(String[] args) {
>>>>         ServiceClient sender = null;
>>>>         try {
>>>>             OMFactory fac = OMAbstractFactory.getOMFactory();
>>>>             OMNamespace ns = fac.createOMNamespace("http://
>>>> www.webserviceX.NET", "");
>>>>             OMElement method = fac.createOMElement
>>>> ("GetUKLocationByTown", ns);
>>>>             OMElement value = fac.createOMElement("Town", ns);
>>>>             value.setText("Coventry");
>>>>             method.addChild(value);
>>>>
>>>>             Options options = new Options();
>>>>             options.setTo(targetEPR);
>>>>             options.setTransportInProtocol
>>>> (Constants.TRANSPORT_HTTP);
>>>>             options.setAction("http://www.webserviceX.NET/
>>>> GetUKLocationByTown");
>>>>             options.setTimeOutInMilliSeconds(60000);
>>>>             options.setUseSeparateListener(true);
>>>>
>>>>             //Callback to handle the response
>>>>             Callback callback = new Callback() {
>>>>                 public void onComplete(AsyncResult result) {
>>>>                     System.out.println(result.getResponseEnvelope
>>>> ());
>>>>                 }
>>>>
>>>>                 public void onError(Exception e) {
>>>>                     e.printStackTrace();
>>>>                 }
>>>>             };
>>>>
>>>>             //Non-Blocking Invocation
>>>>             sender = new ServiceClient();
>>>>             sender.setOptions(options);
>>>>
>>>>             sender.engageModule(Constants.MODULE_ADDRESSING);
>>>>             sender.sendReceiveNonBlocking(method, callback);
>>>>
>>>>             //Wait till the callback receives the response.
>>>>             while (!callback.isComplete()) {
>>>>                 Thread.sleep(1000);
>>>>             }
>>>>             //Need to close the Client Side Listener.
>>>>
>>>>         } catch (AxisFault axisFault) {
>>>>             axisFault.printStackTrace();
>>>>         } catch (Exception ex) {
>>>>             ex.printStackTrace();
>>>>         } finally {
>>>>             try {
>>>>                 sender.cleanup();
>>>>             } catch (AxisFault axisFault) {
>>>>                 //have to ignore this
>>>>             }
>>>>         }
>>>>
>>>>     }
>>>> }
>>>> This email and any files transmitted with it are confidential,
>>>> proprietary and intended solely for the individual or entity to  
>>>> whom
>
>>>> they are addressed. If you have received this email in error please
>>>> delete it immediately.
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>> This email and any files transmitted with it are confidential,
>>> proprietary and intended solely for the individual or entity to whom
>>> they are addressed.
>>> If you have received this email in error please delete it
>>> immediately.
>>>
>>>
>>> -------------------------------------------------------------------- 
>>> -
>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>> This email and any files transmitted with it are confidential,
>> proprietary and intended solely for the individual or entity to whom
>> they are addressed.
>> If you have received this email in error please delete it  
>> immediately.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
> This email and any files transmitted with it are confidential,  
> proprietary
> and intended solely for the individual or entity to whom they are  
> addressed.
> If you have received this email in error please delete it immediately.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: NonBlockingDual Client Question

Posted by "Clark, Stephen" <st...@fairisaac.com>.
Hi Michele,

Thanks for all your help.

I have had a look through the WSDL for the web service I am connecting
to and it does not contain a UsingAddressing element so I don't think
that it supports WS-Addressing.

In this situation wouldn't it be better for Axis to return an error to
the effect that WS-Addressing is not supported on the server?

Additionally, do you know of any public web services that support
WS-Addressing that I can test my client against?

Thanks

Steve

-----Original Message-----
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk] 
Sent: 14 December 2007 15:58
To: axis-user@ws.apache.org
Subject: Re: NonBlockingDual Client Question


On 14 Dec 2007, at 14:57, Clark, Stephen wrote:

> Michele,
>
> How do I look at the logs on the server?  It is not a service that I 
> have any internal access to.  Are there any tools you can recommend 
> for me to use to look on the server?

Ah, it looks like the only option you have is to proxy your client with
tools like tcpmon [1]. This way you'll find out where the problem is.

>
> Note that the sample works OK when using a single transport, it is 
> only when I set 'options.setUseSeparateListener(true);' that the 
> problem occurs.

hmmm... this could happen because in order to use a separate listener
(i.e. 2 http connections) both sides (i.e. client and server) must use
WS-addressing. Do you know whether the service WS-addressing enabled?


Michele


[1] http://ws.apache.org/commons/tcpmon/index.html
>
> Thanks
>
> Steve
>
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: 14 December 2007 14:50
> To: axis-user@ws.apache.org
> Subject: Re: NonBlockingDual Client Question
>
>
> On 14 Dec 2007, at 14:05, Clark, Stephen wrote:
>
>> Michele,
>>
>> Thanks for the quick response and the pointers.
>>
>> I think that in this case the soap action is correct since the WSDL 
>> has the following statement in it:
>> 	
>>       <soap:operation
>> soapAction="http://www.webserviceX.NET/GetUKLocationByTown"
>> style="document" />
>>
>> In terms of hanging, it is my client that is waiting on the callback 
>> to complete that appears to be suspended.  Do you know of an external

>> web service that works when running the NonBlockingDual client with 
>> an
>
>> asynchronous transport?  The service that I am currently connecting 
>> to
>
>> is written in .NET so it may be that other options need to be set in 
>> Axis in order for it to work correctly using two transports.
>>
> Are you sure that the request is executed on the service side? Any 
> log/error on the server?
>
>
>
> Michele
>
>> Thanks for your help,
>>
>> Steve
>>
>>
>> -----Original Message-----
>> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>> Sent: 14 December 2007 09:49
>> To: axis-user@ws.apache.org
>> Subject: Re: NonBlockingDual Client Question
>>
>> Steve,
>>
>>
>> what do you mean by hang?, does the service wait forever?, what 
>> happens on the server side, any log?
>>
>> Maybe it won't fix your problem, but here are a couple of advices:
>> - the soap action usually starts with "urn:" and it's followed by the

>> operation name
>> - in the finally block you change the state of your sender object, 
>> which may be null
>>
>>
>> Michele
>>
>>
>> On 14 Dec 2007, at 09:13, Clark, Stephen wrote:
>>
>>> All,
>>>
>>> I am new to Axis and have been trying to update the NonBlockingDual 
>>> client to use Transport Asynchrony for a specific web service.  The 
>>> example works OK if i do not use a separate listener but as soon as 
>>> I set options.setUseSeparateListener(true); and run the example it 
>>> simply hangs.  I am using the default axis2.xml file supplied with 
>>> the
>>
>>> userguide samples.  I have included the source code at the end of 
>>> this
>>
>>> e-mail.
>>>
>>> Is there anything I am doing that is obviously wrong?
>>>
>>> Thanks
>>>
>>> Steve
>>>
>>> package userguide.clients;
>>>
>>> import org.apache.axiom.om.OMAbstractFactory;
>>> import org.apache.axiom.om.OMElement; import 
>>> org.apache.axiom.om.OMFactory; import 
>>> org.apache.axiom.om.OMNamespace;
>>>
>>> import org.apache.axis2.AxisFault;
>>> 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.AsyncResult;
>>> import org.apache.axis2.client.async.Callback;
>>>
>>> import javax.xml.namespace.QName;
>>>
>>> /**
>>>  * Sample for asynchronous dual channel non-blocking service 
>>> invocation.
>>>  * Message Exchage Pattern IN-OUT
>>>  * Ulitmate asynchronous service invocation sample.
>>>  */
>>> public class EchoNonBlockingDualClient {
>>>     private static EndpointReference targetEPR = new 
>>> EndpointReference("http://www.webservicex.net/uklocation.asmx");
>>>
>>>     public static void main(String[] args) {
>>>         ServiceClient sender = null;
>>>         try {
>>>             OMFactory fac = OMAbstractFactory.getOMFactory();
>>>             OMNamespace ns = fac.createOMNamespace("http:// 
>>> www.webserviceX.NET", "");
>>>             OMElement method = fac.createOMElement 
>>> ("GetUKLocationByTown", ns);
>>>             OMElement value = fac.createOMElement("Town", ns);
>>>             value.setText("Coventry");
>>>             method.addChild(value);
>>>
>>>             Options options = new Options();
>>>             options.setTo(targetEPR);
>>>             options.setTransportInProtocol 
>>> (Constants.TRANSPORT_HTTP);
>>>             options.setAction("http://www.webserviceX.NET/
>>> GetUKLocationByTown");
>>>             options.setTimeOutInMilliSeconds(60000);
>>>             options.setUseSeparateListener(true);
>>>
>>>             //Callback to handle the response
>>>             Callback callback = new Callback() {
>>>                 public void onComplete(AsyncResult result) {
>>>                     System.out.println(result.getResponseEnvelope
>>> ());
>>>                 }
>>>
>>>                 public void onError(Exception e) {
>>>                     e.printStackTrace();
>>>                 }
>>>             };
>>>
>>>             //Non-Blocking Invocation
>>>             sender = new ServiceClient();
>>>             sender.setOptions(options);
>>>
>>>             sender.engageModule(Constants.MODULE_ADDRESSING);
>>>             sender.sendReceiveNonBlocking(method, callback);
>>>
>>>             //Wait till the callback receives the response.
>>>             while (!callback.isComplete()) {
>>>                 Thread.sleep(1000);
>>>             }
>>>             //Need to close the Client Side Listener.
>>>
>>>         } catch (AxisFault axisFault) {
>>>             axisFault.printStackTrace();
>>>         } catch (Exception ex) {
>>>             ex.printStackTrace();
>>>         } finally {
>>>             try {
>>>                 sender.cleanup();
>>>             } catch (AxisFault axisFault) {
>>>                 //have to ignore this
>>>             }
>>>         }
>>>
>>>     }
>>> }
>>> This email and any files transmitted with it are confidential, 
>>> proprietary and intended solely for the individual or entity to whom

>>> they are addressed. If you have received this email in error please 
>>> delete it immediately.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>> This email and any files transmitted with it are confidential, 
>> proprietary and intended solely for the individual or entity to whom 
>> they are addressed.
>> If you have received this email in error please delete it 
>> immediately.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
> This email and any files transmitted with it are confidential, 
> proprietary and intended solely for the individual or entity to whom 
> they are addressed.
> If you have received this email in error please delete it immediately.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org

This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: NonBlockingDual Client Question

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
On 14 Dec 2007, at 14:57, Clark, Stephen wrote:

> Michele,
>
> How do I look at the logs on the server?  It is not a service that I
> have any internal access to.  Are there any tools you can recommend  
> for
> me to use to look on the server?

Ah, it looks like the only option you have is to proxy your client  
with tools like tcpmon [1]. This way you'll find out where the  
problem is.

>
> Note that the sample works OK when using a single transport, it is  
> only
> when I set 'options.setUseSeparateListener(true);' that the problem
> occurs.

hmmm... this could happen because in order to use a separate listener  
(i.e. 2 http connections) both sides (i.e. client and server) must  
use WS-addressing. Do you know whether the service WS-addressing  
enabled?


Michele


[1] http://ws.apache.org/commons/tcpmon/index.html
>
> Thanks
>
> Steve
>
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: 14 December 2007 14:50
> To: axis-user@ws.apache.org
> Subject: Re: NonBlockingDual Client Question
>
>
> On 14 Dec 2007, at 14:05, Clark, Stephen wrote:
>
>> Michele,
>>
>> Thanks for the quick response and the pointers.
>>
>> I think that in this case the soap action is correct since the WSDL
>> has the following statement in it:
>> 	
>>       <soap:operation
>> soapAction="http://www.webserviceX.NET/GetUKLocationByTown"
>> style="document" />
>>
>> In terms of hanging, it is my client that is waiting on the callback
>> to complete that appears to be suspended.  Do you know of an external
>> web service that works when running the NonBlockingDual client  
>> with an
>
>> asynchronous transport?  The service that I am currently  
>> connecting to
>
>> is written in .NET so it may be that other options need to be set in
>> Axis in order for it to work correctly using two transports.
>>
> Are you sure that the request is executed on the service side? Any
> log/error on the server?
>
>
>
> Michele
>
>> Thanks for your help,
>>
>> Steve
>>
>>
>> -----Original Message-----
>> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>> Sent: 14 December 2007 09:49
>> To: axis-user@ws.apache.org
>> Subject: Re: NonBlockingDual Client Question
>>
>> Steve,
>>
>>
>> what do you mean by hang?, does the service wait forever?, what
>> happens on the server side, any log?
>>
>> Maybe it won't fix your problem, but here are a couple of advices:
>> - the soap action usually starts with "urn:" and it's followed by the
>> operation name
>> - in the finally block you change the state of your sender object,
>> which may be null
>>
>>
>> Michele
>>
>>
>> On 14 Dec 2007, at 09:13, Clark, Stephen wrote:
>>
>>> All,
>>>
>>> I am new to Axis and have been trying to update the NonBlockingDual
>>> client to use Transport Asynchrony for a specific web service.  The
>>> example works OK if i do not use a separate listener but as soon  
>>> as I
>>> set options.setUseSeparateListener(true); and run the example it
>>> simply hangs.  I am using the default axis2.xml file supplied with
>>> the
>>
>>> userguide samples.  I have included the source code at the end of
>>> this
>>
>>> e-mail.
>>>
>>> Is there anything I am doing that is obviously wrong?
>>>
>>> Thanks
>>>
>>> Steve
>>>
>>> package userguide.clients;
>>>
>>> import org.apache.axiom.om.OMAbstractFactory;
>>> import org.apache.axiom.om.OMElement;
>>> import org.apache.axiom.om.OMFactory;
>>> import org.apache.axiom.om.OMNamespace;
>>>
>>> import org.apache.axis2.AxisFault;
>>> 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.AsyncResult;
>>> import org.apache.axis2.client.async.Callback;
>>>
>>> import javax.xml.namespace.QName;
>>>
>>> /**
>>>  * Sample for asynchronous dual channel non-blocking service
>>> invocation.
>>>  * Message Exchage Pattern IN-OUT
>>>  * Ulitmate asynchronous service invocation sample.
>>>  */
>>> public class EchoNonBlockingDualClient {
>>>     private static EndpointReference targetEPR = new
>>> EndpointReference("http://www.webservicex.net/uklocation.asmx");
>>>
>>>     public static void main(String[] args) {
>>>         ServiceClient sender = null;
>>>         try {
>>>             OMFactory fac = OMAbstractFactory.getOMFactory();
>>>             OMNamespace ns = fac.createOMNamespace("http://
>>> www.webserviceX.NET", "");
>>>             OMElement method = fac.createOMElement
>>> ("GetUKLocationByTown", ns);
>>>             OMElement value = fac.createOMElement("Town", ns);
>>>             value.setText("Coventry");
>>>             method.addChild(value);
>>>
>>>             Options options = new Options();
>>>             options.setTo(targetEPR);
>>>             options.setTransportInProtocol 
>>> (Constants.TRANSPORT_HTTP);
>>>             options.setAction("http://www.webserviceX.NET/
>>> GetUKLocationByTown");
>>>             options.setTimeOutInMilliSeconds(60000);
>>>             options.setUseSeparateListener(true);
>>>
>>>             //Callback to handle the response
>>>             Callback callback = new Callback() {
>>>                 public void onComplete(AsyncResult result) {
>>>                     System.out.println(result.getResponseEnvelope 
>>> ());
>>>                 }
>>>
>>>                 public void onError(Exception e) {
>>>                     e.printStackTrace();
>>>                 }
>>>             };
>>>
>>>             //Non-Blocking Invocation
>>>             sender = new ServiceClient();
>>>             sender.setOptions(options);
>>>
>>>             sender.engageModule(Constants.MODULE_ADDRESSING);
>>>             sender.sendReceiveNonBlocking(method, callback);
>>>
>>>             //Wait till the callback receives the response.
>>>             while (!callback.isComplete()) {
>>>                 Thread.sleep(1000);
>>>             }
>>>             //Need to close the Client Side Listener.
>>>
>>>         } catch (AxisFault axisFault) {
>>>             axisFault.printStackTrace();
>>>         } catch (Exception ex) {
>>>             ex.printStackTrace();
>>>         } finally {
>>>             try {
>>>                 sender.cleanup();
>>>             } catch (AxisFault axisFault) {
>>>                 //have to ignore this
>>>             }
>>>         }
>>>
>>>     }
>>> }
>>> This email and any files transmitted with it are confidential,
>>> proprietary and intended solely for the individual or entity to whom
>>> they are addressed. If you have received this email in error please
>>> delete it immediately.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>> This email and any files transmitted with it are confidential,
>> proprietary
>> and intended solely for the individual or entity to whom they are
>> addressed.
>> If you have received this email in error please delete it  
>> immediately.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
> This email and any files transmitted with it are confidential,  
> proprietary
> and intended solely for the individual or entity to whom they are  
> addressed.
> If you have received this email in error please delete it immediately.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: NonBlockingDual Client Question

Posted by "Clark, Stephen" <st...@fairisaac.com>.
Michele,

How do I look at the logs on the server?  It is not a service that I
have any internal access to.  Are there any tools you can recommend for
me to use to look on the server?

Note that the sample works OK when using a single transport, it is only
when I set 'options.setUseSeparateListener(true);' that the problem
occurs.

Thanks

Steve

-----Original Message-----
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk] 
Sent: 14 December 2007 14:50
To: axis-user@ws.apache.org
Subject: Re: NonBlockingDual Client Question


On 14 Dec 2007, at 14:05, Clark, Stephen wrote:

> Michele,
>
> Thanks for the quick response and the pointers.
>
> I think that in this case the soap action is correct since the WSDL 
> has the following statement in it:
> 	
>       <soap:operation
> soapAction="http://www.webserviceX.NET/GetUKLocationByTown"
> style="document" />
>
> In terms of hanging, it is my client that is waiting on the callback 
> to complete that appears to be suspended.  Do you know of an external 
> web service that works when running the NonBlockingDual client with an

> asynchronous transport?  The service that I am currently connecting to

> is written in .NET so it may be that other options need to be set in 
> Axis in order for it to work correctly using two transports.
>
Are you sure that the request is executed on the service side? Any
log/error on the server?



Michele

> Thanks for your help,
>
> Steve
>
>
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: 14 December 2007 09:49
> To: axis-user@ws.apache.org
> Subject: Re: NonBlockingDual Client Question
>
> Steve,
>
>
> what do you mean by hang?, does the service wait forever?, what 
> happens on the server side, any log?
>
> Maybe it won't fix your problem, but here are a couple of advices:
> - the soap action usually starts with "urn:" and it's followed by the 
> operation name
> - in the finally block you change the state of your sender object, 
> which may be null
>
>
> Michele
>
>
> On 14 Dec 2007, at 09:13, Clark, Stephen wrote:
>
>> All,
>>
>> I am new to Axis and have been trying to update the NonBlockingDual
>> client to use Transport Asynchrony for a specific web service.  The
>> example works OK if i do not use a separate listener but as soon as I
>> set options.setUseSeparateListener(true); and run the example it
>> simply hangs.  I am using the default axis2.xml file supplied with  
>> the
>
>> userguide samples.  I have included the source code at the end of  
>> this
>
>> e-mail.
>>
>> Is there anything I am doing that is obviously wrong?
>>
>> Thanks
>>
>> Steve
>>
>> package userguide.clients;
>>
>> import org.apache.axiom.om.OMAbstractFactory;
>> import org.apache.axiom.om.OMElement;
>> import org.apache.axiom.om.OMFactory;
>> import org.apache.axiom.om.OMNamespace;
>>
>> import org.apache.axis2.AxisFault;
>> 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.AsyncResult;
>> import org.apache.axis2.client.async.Callback;
>>
>> import javax.xml.namespace.QName;
>>
>> /**
>>  * Sample for asynchronous dual channel non-blocking service
>> invocation.
>>  * Message Exchage Pattern IN-OUT
>>  * Ulitmate asynchronous service invocation sample.
>>  */
>> public class EchoNonBlockingDualClient {
>>     private static EndpointReference targetEPR = new
>> EndpointReference("http://www.webservicex.net/uklocation.asmx");
>>
>>     public static void main(String[] args) {
>>         ServiceClient sender = null;
>>         try {
>>             OMFactory fac = OMAbstractFactory.getOMFactory();
>>             OMNamespace ns = fac.createOMNamespace("http://
>> www.webserviceX.NET", "");
>>             OMElement method = fac.createOMElement
>> ("GetUKLocationByTown", ns);
>>             OMElement value = fac.createOMElement("Town", ns);
>>             value.setText("Coventry");
>>             method.addChild(value);
>>
>>             Options options = new Options();
>>             options.setTo(targetEPR);
>>             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>>             options.setAction("http://www.webserviceX.NET/
>> GetUKLocationByTown");
>>             options.setTimeOutInMilliSeconds(60000);
>>             options.setUseSeparateListener(true);
>>
>>             //Callback to handle the response
>>             Callback callback = new Callback() {
>>                 public void onComplete(AsyncResult result) {
>>                     System.out.println(result.getResponseEnvelope());
>>                 }
>>
>>                 public void onError(Exception e) {
>>                     e.printStackTrace();
>>                 }
>>             };
>>
>>             //Non-Blocking Invocation
>>             sender = new ServiceClient();
>>             sender.setOptions(options);
>>
>>             sender.engageModule(Constants.MODULE_ADDRESSING);
>>             sender.sendReceiveNonBlocking(method, callback);
>>
>>             //Wait till the callback receives the response.
>>             while (!callback.isComplete()) {
>>                 Thread.sleep(1000);
>>             }
>>             //Need to close the Client Side Listener.
>>
>>         } catch (AxisFault axisFault) {
>>             axisFault.printStackTrace();
>>         } catch (Exception ex) {
>>             ex.printStackTrace();
>>         } finally {
>>             try {
>>                 sender.cleanup();
>>             } catch (AxisFault axisFault) {
>>                 //have to ignore this
>>             }
>>         }
>>
>>     }
>> }
>> This email and any files transmitted with it are confidential,
>> proprietary and intended solely for the individual or entity to whom
>> they are addressed. If you have received this email in error please
>> delete it immediately.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
> This email and any files transmitted with it are confidential,  
> proprietary
> and intended solely for the individual or entity to whom they are  
> addressed.
> If you have received this email in error please delete it immediately.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org

This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: NonBlockingDual Client Question

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
On 14 Dec 2007, at 14:05, Clark, Stephen wrote:

> Michele,
>
> Thanks for the quick response and the pointers.
>
> I think that in this case the soap action is correct since the WSDL  
> has
> the following statement in it:
> 	
>       <soap:operation
> soapAction="http://www.webserviceX.NET/GetUKLocationByTown"
> style="document" />
>
> In terms of hanging, it is my client that is waiting on the  
> callback to
> complete that appears to be suspended.  Do you know of an external web
> service that works when running the NonBlockingDual client with an
> asynchronous transport?  The service that I am currently connecting to
> is written in .NET so it may be that other options need to be set in
> Axis in order for it to work correctly using two transports.
>
Are you sure that the request is executed on the service side? Any  
log/error on the server?



Michele

> Thanks for your help,
>
> Steve
>
>
> -----Original Message-----
> From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
> Sent: 14 December 2007 09:49
> To: axis-user@ws.apache.org
> Subject: Re: NonBlockingDual Client Question
>
> Steve,
>
>
> what do you mean by hang?, does the service wait forever?, what  
> happens
> on the server side, any log?
>
> Maybe it won't fix your problem, but here are a couple of advices:
> - the soap action usually starts with "urn:" and it's followed by the
> operation name
> - in the finally block you change the state of your sender object,  
> which
> may be null
>
>
> Michele
>
>
> On 14 Dec 2007, at 09:13, Clark, Stephen wrote:
>
>> All,
>>
>> I am new to Axis and have been trying to update the NonBlockingDual
>> client to use Transport Asynchrony for a specific web service.  The
>> example works OK if i do not use a separate listener but as soon as I
>> set options.setUseSeparateListener(true); and run the example it
>> simply hangs.  I am using the default axis2.xml file supplied with  
>> the
>
>> userguide samples.  I have included the source code at the end of  
>> this
>
>> e-mail.
>>
>> Is there anything I am doing that is obviously wrong?
>>
>> Thanks
>>
>> Steve
>>
>> package userguide.clients;
>>
>> import org.apache.axiom.om.OMAbstractFactory;
>> import org.apache.axiom.om.OMElement;
>> import org.apache.axiom.om.OMFactory;
>> import org.apache.axiom.om.OMNamespace;
>>
>> import org.apache.axis2.AxisFault;
>> 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.AsyncResult;
>> import org.apache.axis2.client.async.Callback;
>>
>> import javax.xml.namespace.QName;
>>
>> /**
>>  * Sample for asynchronous dual channel non-blocking service
>> invocation.
>>  * Message Exchage Pattern IN-OUT
>>  * Ulitmate asynchronous service invocation sample.
>>  */
>> public class EchoNonBlockingDualClient {
>>     private static EndpointReference targetEPR = new
>> EndpointReference("http://www.webservicex.net/uklocation.asmx");
>>
>>     public static void main(String[] args) {
>>         ServiceClient sender = null;
>>         try {
>>             OMFactory fac = OMAbstractFactory.getOMFactory();
>>             OMNamespace ns = fac.createOMNamespace("http://
>> www.webserviceX.NET", "");
>>             OMElement method = fac.createOMElement
>> ("GetUKLocationByTown", ns);
>>             OMElement value = fac.createOMElement("Town", ns);
>>             value.setText("Coventry");
>>             method.addChild(value);
>>
>>             Options options = new Options();
>>             options.setTo(targetEPR);
>>             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>>             options.setAction("http://www.webserviceX.NET/
>> GetUKLocationByTown");
>>             options.setTimeOutInMilliSeconds(60000);
>>             options.setUseSeparateListener(true);
>>
>>             //Callback to handle the response
>>             Callback callback = new Callback() {
>>                 public void onComplete(AsyncResult result) {
>>                     System.out.println(result.getResponseEnvelope());
>>                 }
>>
>>                 public void onError(Exception e) {
>>                     e.printStackTrace();
>>                 }
>>             };
>>
>>             //Non-Blocking Invocation
>>             sender = new ServiceClient();
>>             sender.setOptions(options);
>>
>>             sender.engageModule(Constants.MODULE_ADDRESSING);
>>             sender.sendReceiveNonBlocking(method, callback);
>>
>>             //Wait till the callback receives the response.
>>             while (!callback.isComplete()) {
>>                 Thread.sleep(1000);
>>             }
>>             //Need to close the Client Side Listener.
>>
>>         } catch (AxisFault axisFault) {
>>             axisFault.printStackTrace();
>>         } catch (Exception ex) {
>>             ex.printStackTrace();
>>         } finally {
>>             try {
>>                 sender.cleanup();
>>             } catch (AxisFault axisFault) {
>>                 //have to ignore this
>>             }
>>         }
>>
>>     }
>> }
>> This email and any files transmitted with it are confidential,
>> proprietary and intended solely for the individual or entity to whom
>> they are addressed. If you have received this email in error please
>> delete it immediately.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
> This email and any files transmitted with it are confidential,  
> proprietary
> and intended solely for the individual or entity to whom they are  
> addressed.
> If you have received this email in error please delete it immediately.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: NonBlockingDual Client Question

Posted by "Clark, Stephen" <st...@fairisaac.com>.
Michele,

Thanks for the quick response and the pointers.

I think that in this case the soap action is correct since the WSDL has
the following statement in it:
	
      <soap:operation
soapAction="http://www.webserviceX.NET/GetUKLocationByTown"
style="document" />

In terms of hanging, it is my client that is waiting on the callback to
complete that appears to be suspended.  Do you know of an external web
service that works when running the NonBlockingDual client with an
asynchronous transport?  The service that I am currently connecting to
is written in .NET so it may be that other options need to be set in
Axis in order for it to work correctly using two transports.

Thanks for your help,

Steve


-----Original Message-----
From: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk] 
Sent: 14 December 2007 09:49
To: axis-user@ws.apache.org
Subject: Re: NonBlockingDual Client Question

Steve,


what do you mean by hang?, does the service wait forever?, what happens
on the server side, any log?

Maybe it won't fix your problem, but here are a couple of advices:
- the soap action usually starts with "urn:" and it's followed by the
operation name
- in the finally block you change the state of your sender object, which
may be null


Michele


On 14 Dec 2007, at 09:13, Clark, Stephen wrote:

> All,
>
> I am new to Axis and have been trying to update the NonBlockingDual 
> client to use Transport Asynchrony for a specific web service.  The 
> example works OK if i do not use a separate listener but as soon as I 
> set options.setUseSeparateListener(true); and run the example it 
> simply hangs.  I am using the default axis2.xml file supplied with the

> userguide samples.  I have included the source code at the end of this

> e-mail.
>
> Is there anything I am doing that is obviously wrong?
>
> Thanks
>
> Steve
>
> package userguide.clients;
>
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
>
> import org.apache.axis2.AxisFault;
> 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.AsyncResult;
> import org.apache.axis2.client.async.Callback;
>
> import javax.xml.namespace.QName;
>
> /**
>  * Sample for asynchronous dual channel non-blocking service 
> invocation.
>  * Message Exchage Pattern IN-OUT
>  * Ulitmate asynchronous service invocation sample.
>  */
> public class EchoNonBlockingDualClient {
>     private static EndpointReference targetEPR = new 
> EndpointReference("http://www.webservicex.net/uklocation.asmx");
>
>     public static void main(String[] args) {
>         ServiceClient sender = null;
>         try {
>             OMFactory fac = OMAbstractFactory.getOMFactory();
>             OMNamespace ns = fac.createOMNamespace("http:// 
> www.webserviceX.NET", "");
>             OMElement method = fac.createOMElement 
> ("GetUKLocationByTown", ns);
>             OMElement value = fac.createOMElement("Town", ns);
>             value.setText("Coventry");
>             method.addChild(value);
>
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>             options.setAction("http://www.webserviceX.NET/
> GetUKLocationByTown");
>             options.setTimeOutInMilliSeconds(60000);
>             options.setUseSeparateListener(true);
>
>             //Callback to handle the response
>             Callback callback = new Callback() {
>                 public void onComplete(AsyncResult result) {
>                     System.out.println(result.getResponseEnvelope());
>                 }
>
>                 public void onError(Exception e) {
>                     e.printStackTrace();
>                 }
>             };
>
>             //Non-Blocking Invocation
>             sender = new ServiceClient();
>             sender.setOptions(options);
>
>             sender.engageModule(Constants.MODULE_ADDRESSING);
>             sender.sendReceiveNonBlocking(method, callback);
>
>             //Wait till the callback receives the response.
>             while (!callback.isComplete()) {
>                 Thread.sleep(1000);
>             }
>             //Need to close the Client Side Listener.
>
>         } catch (AxisFault axisFault) {
>             axisFault.printStackTrace();
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         } finally {
>             try {
>                 sender.cleanup();
>             } catch (AxisFault axisFault) {
>                 //have to ignore this
>             }
>         }
>
>     }
> }
> This email and any files transmitted with it are confidential, 
> proprietary and intended solely for the individual or entity to whom 
> they are addressed. If you have received this email in error please 
> delete it immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org

This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: NonBlockingDual Client Question

Posted by Michele Mazzucco <Mi...@ncl.ac.uk>.
Steve,


what do you mean by hang?, does the service wait forever?, what  
happens on the server side, any log?

Maybe it won't fix your problem, but here are a couple of advices:
- the soap action usually starts with "urn:" and it's followed by the  
operation name
- in the finally block you change the state of your sender object,  
which may be null


Michele


On 14 Dec 2007, at 09:13, Clark, Stephen wrote:

> All,
>
> I am new to Axis and have been trying to update the NonBlockingDual  
> client to use Transport Asynchrony for a specific web service.  The  
> example works OK if i do not use a separate listener but as soon as  
> I set options.setUseSeparateListener(true); and run the example it  
> simply hangs.  I am using the default axis2.xml file supplied with  
> the userguide samples.  I have included the source code at the end  
> of this e-mail.
>
> Is there anything I am doing that is obviously wrong?
>
> Thanks
>
> Steve
>
> package userguide.clients;
>
> import org.apache.axiom.om.OMAbstractFactory;
> import org.apache.axiom.om.OMElement;
> import org.apache.axiom.om.OMFactory;
> import org.apache.axiom.om.OMNamespace;
>
> import org.apache.axis2.AxisFault;
> 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.AsyncResult;
> import org.apache.axis2.client.async.Callback;
>
> import javax.xml.namespace.QName;
>
> /**
>  * Sample for asynchronous dual channel non-blocking service  
> invocation.
>  * Message Exchage Pattern IN-OUT
>  * Ulitmate asynchronous service invocation sample.
>  */
> public class EchoNonBlockingDualClient {
>     private static EndpointReference targetEPR = new  
> EndpointReference("http://www.webservicex.net/uklocation.asmx");
>
>     public static void main(String[] args) {
>         ServiceClient sender = null;
>         try {
>             OMFactory fac = OMAbstractFactory.getOMFactory();
>             OMNamespace ns = fac.createOMNamespace("http:// 
> www.webserviceX.NET", "");
>             OMElement method = fac.createOMElement 
> ("GetUKLocationByTown", ns);
>             OMElement value = fac.createOMElement("Town", ns);
>             value.setText("Coventry");
>             method.addChild(value);
>
>             Options options = new Options();
>             options.setTo(targetEPR);
>             options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>             options.setAction("http://www.webserviceX.NET/ 
> GetUKLocationByTown");
>             options.setTimeOutInMilliSeconds(60000);
>             options.setUseSeparateListener(true);
>
>             //Callback to handle the response
>             Callback callback = new Callback() {
>                 public void onComplete(AsyncResult result) {
>                     System.out.println(result.getResponseEnvelope());
>                 }
>
>                 public void onError(Exception e) {
>                     e.printStackTrace();
>                 }
>             };
>
>             //Non-Blocking Invocation
>             sender = new ServiceClient();
>             sender.setOptions(options);
>
>             sender.engageModule(Constants.MODULE_ADDRESSING);
>             sender.sendReceiveNonBlocking(method, callback);
>
>             //Wait till the callback receives the response.
>             while (!callback.isComplete()) {
>                 Thread.sleep(1000);
>             }
>             //Need to close the Client Side Listener.
>
>         } catch (AxisFault axisFault) {
>             axisFault.printStackTrace();
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         } finally {
>             try {
>                 sender.cleanup();
>             } catch (AxisFault axisFault) {
>                 //have to ignore this
>             }
>         }
>
>     }
> }
> This email and any files transmitted with it are confidential,  
> proprietary and intended solely for the individual or entity to  
> whom they are addressed. If you have received this email in error  
> please delete it immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: NonBlockingDual Client Question

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Clark, Stephen wrote:
> All,
>  
> I am new to Axis and have been trying to update the NonBlockingDual
> client to use Transport Asynchrony for a specific web service.  The
> example works OK if i do not use a separate listener but as soon as I
> set options.setUseSeparateListener(true); and run the example it
> simply hangs.  I am using the default axis2.xml file supplied with the
> userguide samples.  I have included the source code at the end of this
> e-mail.
Yes when you use separate listener , Axis2 start a server at the client
side , that is why you see that your application hang . I probably think
you might have gotten the response though your application get hanged. ?

-Deepal


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org