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 juliocest <ju...@gmail.com> on 2007/11/19 18:51:36 UTC

How to capture Message Context in sendReceive (Blocking) call

Hi everybody!!!

I have a client code that have 2 calls. One of them is blocking and other
nonblocking.

Part of my code is writing as follow:

    		  	synchronized (callback) 
                        {
    		  		if (!ClienteServico.finish) {
    		  			//callback.wait(1000);
    		  			
    		  			initb = System.nanoTime();
    		  			
    		  			//blocking invocation
    		  			resultado = emissor01.sendReceive(payload01);
    		  			System.out.println("	--> Localization: "+ urlremoto01);
    		  			response = result.getFirstElement().getText();
    		  			
    		  LINE X   ->       MessageContext msg =
MessageContext.getCurrentMessageContext(); 
    		  LINE Y   ->       SOAPBody soapBody = msg.getEnvelope().getBody();

    		  			fimb = System.nanoTime();
    		  			
    		  			resultadobloc = Double.toString((double)(fimb-initb)/1000000000);


    	                                System.out.println("Esperando
callback");
    	                                callback.wait();
    	                                System.out.println("Fim do callback");
			     }

As you can see, I am calling a sendreceive (blocking) into a callback (which
takes care of nonblocking invocation). As there are two messages, they are
in differents contexts. Am I right? I would like to know how to capture
messagecontext of the sendreceive (blocking)? Is it possible?

I ask it, because when I compile my program the lines X and Y are not called
and I have an error like:

java.langNullPointerException

Someone could help me?

Thanks a lot.

Julio
-- 
View this message in context: http://www.nabble.com/How-to-capture-Message-Context-in-sendReceive-%28Blocking%29-call-tf4838078.html#a13841248
Sent from the Axis - User mailing list archive at Nabble.com.


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


Re: How to capture Message Context in sendReceive (Blocking) call

Posted by juliocest <ju...@gmail.com>.
Hi Deepal!

Thank you very much.

It really works.

Julio
Sao Carlos - SP - Brazil


-- 
View this message in context: http://www.nabble.com/How-to-capture-Message-Context-in-sendReceive-%28Blocking%29-call-tf4838078.html#a13895907
Sent from the Axis - User mailing list archive at Nabble.com.


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


Re: How to capture Message Context in sendReceive (Blocking) call

Posted by Deepal jayasinghe <de...@gmail.com>.
> Hi Deepal!
>
> Thanks for help! 
>
> How could I to do it?
>
> Could you show me how to do with an example?
>   
ServiceClient client = new ServiceClient();
---------

client.sendRecieve();
client.getLastOperationConetxt().getMessageContext("In");

Thanks
Deepal

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


Re: How to capture Message Context in sendReceive (Blocking) call

Posted by juliocest <ju...@gmail.com>.
Hi Deepal!

Thanks for help! 

How could I to do it?

Could you show me how to do with an example?

Thanks a lot.

Julio



Deepal Jayasinghe wrote:
> 
> Hi ,
> From the service client you can get the operation context , and once you
> have the operation context you can get both message contexts.
> 
> Thanks
> Deepal
> 
> juliocest wrote:
>> Hi everybody!!!
>>
>> I have a client code that have 2 calls. One of them is blocking and other
>> nonblocking.
>>
>> Part of my code is writing as follow:
>>
>>     		  	synchronized (callback) 
>>                         {
>>     		  		if (!ClienteServico.finish) {
>>     		  			//callback.wait(1000);
>>     		  			
>>     		  			initb = System.nanoTime();
>>     		  			
>>     		  			//blocking invocation
>>     		  			resultado = emissor01.sendReceive(payload01);
>>     		  			System.out.println("	--> Localization: "+ urlremoto01);
>>     		  			response = result.getFirstElement().getText();
>>     		  			
>>     		  LINE X   ->       MessageContext msg =
>> MessageContext.getCurrentMessageContext(); 
>>     		  LINE Y   ->       SOAPBody soapBody =
>> msg.getEnvelope().getBody();
>>
>>     		  			fimb = System.nanoTime();
>>     		  			
>>     		  			resultadobloc =
>> Double.toString((double)(fimb-initb)/1000000000);
>>
>>
>>     	                                System.out.println("Esperando
>> callback");
>>     	                                callback.wait();
>>     	                                System.out.println("Fim do
>> callback");
>> 			     }
>>
>> As you can see, I am calling a sendreceive (blocking) into a callback
>> (which
>> takes care of nonblocking invocation). As there are two messages, they
>> are
>> in differents contexts. Am I right? I would like to know how to capture
>> messagecontext of the sendreceive (blocking)? Is it possible?
>>
>> I ask it, because when I compile my program the lines X and Y are not
>> called
>> and I have an error like:
>>
>> java.langNullPointerException
>>
>> Someone could help me?
>>
>> Thanks a lot.
>>
>> Julio
>>   
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-capture-Message-Context-in-sendReceive-%28Blocking%29-call-tf4838078.html#a13855572
Sent from the Axis - User mailing list archive at Nabble.com.


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


Re: How to capture Message Context in sendReceive (Blocking) call

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi ,
>From the service client you can get the operation context , and once you
have the operation context you can get both message contexts.

Thanks
Deepal

juliocest wrote:
> Hi everybody!!!
>
> I have a client code that have 2 calls. One of them is blocking and other
> nonblocking.
>
> Part of my code is writing as follow:
>
>     		  	synchronized (callback) 
>                         {
>     		  		if (!ClienteServico.finish) {
>     		  			//callback.wait(1000);
>     		  			
>     		  			initb = System.nanoTime();
>     		  			
>     		  			//blocking invocation
>     		  			resultado = emissor01.sendReceive(payload01);
>     		  			System.out.println("	--> Localization: "+ urlremoto01);
>     		  			response = result.getFirstElement().getText();
>     		  			
>     		  LINE X   ->       MessageContext msg =
> MessageContext.getCurrentMessageContext(); 
>     		  LINE Y   ->       SOAPBody soapBody = msg.getEnvelope().getBody();
>
>     		  			fimb = System.nanoTime();
>     		  			
>     		  			resultadobloc = Double.toString((double)(fimb-initb)/1000000000);
>
>
>     	                                System.out.println("Esperando
> callback");
>     	                                callback.wait();
>     	                                System.out.println("Fim do callback");
> 			     }
>
> As you can see, I am calling a sendreceive (blocking) into a callback (which
> takes care of nonblocking invocation). As there are two messages, they are
> in differents contexts. Am I right? I would like to know how to capture
> messagecontext of the sendreceive (blocking)? Is it possible?
>
> I ask it, because when I compile my program the lines X and Y are not called
> and I have an error like:
>
> java.langNullPointerException
>
> Someone could help me?
>
> Thanks a lot.
>
> Julio
>   



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