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 Batist <ba...@gmail.com> on 2012/08/31 10:20:37 UTC

Axis2 create persistent connection

I want to consume a webservice made in .NET. For generating my source code, I
used Axis2 based on the WSDL of the web service. I launched Axis without
options. 

I can call the first method of the webservice. This is the authentification
method "Connect" of the web service. After this, I call again a new method,
but the webservice indicate that I'm not any more connected. The support of
the web service told me it's because after I call the connect method, the
connection is closed by java. And this, the webservice assume that I'm
disconnected and close my session. 

To solve this problem, my successif call of the both method should maintain
the connection in live. However, I'm not sure that Axis2 suggest this
functionalities, is it true? 

How can I maintain connection between different calls? 

Here is my java code : 

WinbooksWebServiceStub stub = new
WinbooksWebServiceStub("http://myUrl/Service.asmx"); 
Connect c = new Connect(); 
c.setKey("KEY"); 
c.setUser("USER"); 
c.setPass("PSW"); 

ConnectResponse resp = stub.connect(c); 
ConnectParser connecterParser = new ConnectParser();//works and return the
Token 

HelloWorld h = new HelloWorld(); 
HelloWorldResponse Hresp = stub.helloWorld(h); //the result tell me that I'm
not connected; connection lost

-- 
View this message in context: http://old.nabble.com/Axis2-create-persistent-connection-tp34372125p34372125.html
Sent from the Axis - User mailing list archive at Nabble.com.


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


Re: Axis2 create persistent connection

Posted by Kishanthan Thangarajah <ks...@gmail.com>.
On Fri, Aug 31, 2012 at 1:50 PM, Batist <ba...@gmail.com>wrote:

>
> I want to consume a webservice made in .NET. For generating my source
> code, I
> used Axis2 based on the WSDL of the web service. I launched Axis without
> options.
>
> I can call the first method of the webservice. This is the authentification
> method "Connect" of the web service. After this, I call again a new method,
> but the webservice indicate that I'm not any more connected. The support of
> the web service told me it's because after I call the connect method, the
> connection is closed by java. And this, the webservice assume that I'm
> disconnected and close my session.
>
> To solve this problem, my successif call of the both method should maintain
> the connection in live. However, I'm not sure that Axis2 suggest this
> functionalities, is it true?
>
> How can I maintain connection between different calls?
>
> Here is my java code :
>
> WinbooksWebServiceStub stub = new
> WinbooksWebServiceStub("http://myUrl/Service.asmx");
> Connect c = new Connect();
> c.setKey("KEY");
> c.setUser("USER");
> c.setPass("PSW");
>

Axis2 uses httpclient in its http transport-sender implementation. And
there is a property that you can set to reuse the same httpclient for all
the service invocation from client over the same connection.

serviceClient.getOptions().setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
Constants.VALUE_TRUE);

This may be helpful in this situation.

Thanks,
Kishanthan.

>
> ConnectResponse resp = stub.connect(c);
> ConnectParser connecterParser = new ConnectParser();//works and return the
> Token
>
> HelloWorld h = new HelloWorld();
> HelloWorldResponse Hresp = stub.helloWorld(h); //the result tell me that
> I'm
> not connected; connection lost
>
> --
> View this message in context:
> http://old.nabble.com/Axis2-create-persistent-connection-tp34372125p34372125.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>