You need to sign in to do that
Don't have an account?
Persisting HTTP Cookies in Web Service call out version 2
I am trying to call a third party Web Service. I have generated Apex classes from a WSDL file. I am getting the following error message:
I think it's because I am not persisting a cookie. I got it working in VB.
The following VB code works
Sub Main()
Dim service As New Service
service.CookieContainer = New System.Net.CookieContainer
service.Login()
...
service.Logout()
End Sub
Here is the corresponding code in Java (using Apache Axis)
public static void main(String[] args)
{
UseSessionsServiceLocator locator = new UseSessionsServiceLocator();
locator.setMaintainSession(true);
ServiceSoap service = locator.getServiceSoap();
service.login();
...
service.logout();
}
How do I achieve this in Apex? Below is what I have so far:
global class getAccountCyber {
webservice static String getCyberAccount() {
String exAccNo='Acme Hotel';
try {
AtexEnterpriseWeb.ServiceSoap ss = new AtexEnterpriseWeb.ServiceSoap();
// I THINK I NEED A COOKIE OBJECT IN HERE! BUT WHICH ONE?
ss.Login();
// ...
ss.Logout();
} catch (exception e) {
exAccNo = e.getMessage();
System.debug(e.getMessage());
}
return exAccNo;
}
}
Kind regards (and thanks in advance),
Max
Message Edited by Steve Max on 11-05-2008 09:12 PM
Message Edited by Steve Max on 11-05-2008 09:14 PM