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 Deborah Wus <de...@activant.com> on 2008/09/03 23:04:35 UTC
Junit Test, Cookies and Axis
I am working with Webservices through a third party application. I have
loaded the axis jars and am able to get a response of ACK from the ping
Service. I am also able to use the Login method without receiving a
fault code. However, when I attempt to perform another function after
the login (one which requires a login) I receive an error of Invalid
Access. The support line for the third party services said that if
using .NET I would need to set the CookieContainer(). I thought this
translated to the setMaintainSession propery for Axis on the
Locator/Stub.
I have created the following Junit test and receive the same error. The
login is successful but the subsequent call does not have the proper
information and returns an Invalid Access fault code. How do I maintain
the cookies needed for subsequent calls after the login?
public void test52ProjectDataSoapLogin() throws Exception {
com.perseus.www.Pdc_WS.ProjectDataSoapStub binding;
try {
binding = (com.perseus.www.Pdc_WS.ProjectDataSoapStub)
new
com.perseus.www.Pdc_WS.ProjectDataLocator().getProjectDataSoap();
binding.setMaintainSession(true);
}
catch (javax.xml.rpc.ServiceException jre) {
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC
ServiceException caught: " + jre);
}
assertNotNull("binding is null", binding);
// Time out after a minute
binding.setTimeout(60000);
// Test operation
java.lang.String value = null;
value = binding.login("username","password");
// Test operation
com.perseus.www.Pdc_WS.GetProfileListResponseGetProfileListResult pvalue
= null;
pvalue = binding.getProfileList();
}
Thank you,
Deborah Wus
_________________________________
Deborah Wus
Senior Development Engineer
Wholesale Distribution Group
Activant Solutions Inc.(tm)
19 W. College Ave.
Yardley, PA 19067
T: 215.493.8900 x6725
E-mail: deborah.wus@activant.com <ma...@activant.com>
Web site: www.activant.com <http://www.activant.com/>
_________________________________
RE: Junit Test, Cookies and Axis
Posted by Deborah Wus <de...@activant.com>.
http://efm.activant.com/ws/projectdata.asmx
________________________________
From: Martin Gainty [mailto:mgainty@hotmail.com]
Sent: Wednesday, September 03, 2008 5:10 PM
To: axis-user@ws.apache.org
Subject: RE: Junit Test, Cookies and Axis
please supply wsdl
thanks,
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official
business of Sender. This transmission is of a confidential nature and
Sender does not endorse distribution to any party other than intended
recipient. Sender does not necessarily endorse content contained within
this transmission.
________________________________
Subject: Junit Test, Cookies and Axis
Date: Wed, 3 Sep 2008 17:04:35 -0400
From: deborah.wus@activant.com
To: axis-user@ws.apache.org
I am working with Webservices through a third party application. I have
loaded the axis jars and am able to get a response of ACK from the ping
Service. I am also able to use the Login method without receiving a
fault code. However, when I attempt to perform another function after
the login (one which requires a login) I receive an error of Invalid
Access. The support line for the third party services said that if
using .NET I would need to set the CookieContainer(). I thought this
translated to the setMaintainSession propery for Axis on the
Locator/Stub.
I have created the following Junit test and receive the same error. The
login is successful but the subsequent call does not have the proper
information and returns an Invalid Access fault code. How do I maintain
the cookies needed for subsequent calls after the login?
public void test52ProjectDataSoapLogin() throws Exception {
com.perseus.www.Pdc_WS.ProjectDataSoapStub binding;
try {
binding = (com.perseus.www.Pdc_WS.ProjectDataSoapStub)
new
com.perseus.www.Pdc_WS.ProjectDataLocator().getProjectDataSoap();
binding.setMaintainSession(true);
}
catch (javax.xml.rpc.ServiceException jre) {
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC
ServiceException caught: " + jre);
}
assertNotNull("binding is null", binding);
// Time out after a minute
binding.setTimeout(60000);
// Test operation
java.lang.String value = null;
value = binding.login("username","password");
// Test operation
com.perseus.www.Pdc_WS.GetProfileListResponseGetProfileListResult pvalue
= null;
pvalue = binding.getProfileList();
}
Thank you,
Deborah Wus
_________________________________
Deborah Wus
Senior Development Engineer
Wholesale Distribution Group
Activant Solutions Inc.(tm)
19 W. College Ave.
Yardley, PA 19067
T: 215.493.8900 x6725
E-mail: deborah.wus@activant.com <ma...@activant.com>
Web site: www.activant.com <http://www.activant.com/>
_________________________________
________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live. Learn
Now
<http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-c
ns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_getmore_092008>
RE: Junit Test, Cookies and Axis
Posted by Martin Gainty <mg...@hotmail.com>.
please supply wsdl
thanks,
Martin
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
Subject: Junit Test, Cookies and Axis
Date: Wed, 3 Sep 2008 17:04:35 -0400
From: deborah.wus@activant.com
To: axis-user@ws.apache.org
I am working with
Webservices through a third party application. I have loaded the axis jars
and am able to get a response of ACK from the ping Service. I am also able
to use the Login method without receiving a fault code. However, when I
attempt to perform another function after the login (one which requires a login)
I receive an error of Invalid Access. The support line for the third party
services said that if using .NET I would need to set the
CookieContainer(). I thought this translated to the setMaintainSession
propery for Axis on the Locator/Stub.
I have created the
following Junit test and receive the same error. The login is successful
but the subsequent call does not have the proper information and returns an
Invalid Access fault code. How do I maintain the cookies needed for
subsequent calls after the login?
public void test52ProjectDataSoapLogin() throws Exception
{
com.perseus.www.Pdc_WS.ProjectDataSoapStub
binding;
try
{
binding
=
(com.perseus.www.Pdc_WS.ProjectDataSoapStub)
new
com.perseus.www.Pdc_WS.ProjectDataLocator().getProjectDataSoap();
binding.setMaintainSession(true);
}
catch
(javax.xml.rpc.ServiceException jre)
{
if(jre.getLinkedCause()!=null)
jre.getLinkedCause().printStackTrace();
throw new junit.framework.AssertionFailedError("JAX-RPC ServiceException caught:
" + jre);
}
assertNotNull("binding is null",
binding);
// Time out
after a minute
binding.setTimeout(60000);
// Test
operation
java.lang.String value =
null;
value =
binding.login("username","password");
// Test
operation
com.perseus.www.Pdc_WS.GetProfileListResponseGetProfileListResult pvalue =
null;
pvalue =
binding.getProfileList();
}
Thank
you,
Deborah Wus
_________________________________
Deborah Wus
Senior Development Engineer
Wholesale Distribution
Group
Activant Solutions
Inc.™
19 W.
College Ave.
Yardley,
PA 19067
T: 215.493.8900 x6725
E-mail: deborah.wus@activant.com
Web site: www.activant.com
_________________________________
_________________________________________________________________
Get more out of the Web. Learn 10 hidden secrets of Windows Live.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008