Hi,
We have CS 10.5 application and I am using CWS 10.5 for JAVA on Eclipse IDE.
I am trying to run the code samples that have been provided in the forum.
I was suucessfully able to generate the client proxies and create a jar file. But now , on running the given code , I am receiveing the error below :

This is the code I am trying to run :
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPHeaderElement;
import javax.xml.ws.soap.SOAPFaultException;
import com.opentext.ecm.api.OTAuthentication;
import com.opentext.livelink.service.core.Authentication;
import com.opentext.livelink.service.core.Authentication_Service;
import com.opentext.livelink.service.docman.DocumentManagement;
import com.opentext.livelink.service.docman.DocumentManagement_Service;
import com.opentext.livelink.service.docman.Node;
import com.sun.xml.internal.ws.api.message.Headers;
import com.sun.xml.internal.ws.developer.WSBindingProvider;
public class GettingStarted
{
// The user's credentials
public final static String USERNAME = "username";
public final static String PASSWORD = "password";
public static void main(String[] args)
{
// --------------------------------------------------------------------------
// 1) Authenticate the user
// --------------------------------------------------------------------------
// Create the Authentication service client
Authentication_Service authService = new Authentication_Service();
Authentication authClient = authService.getBasicHttpBindingAuthentication();
// Store the authentication token
String authToken = null;
// Call the AuthenticateUser() method to get an authentication token
try
{
System.out.print("Authenticating User...");
authToken = authClient.authenticateUser(USERNAME, PASSWORD);
System.out.println("SUCCESS!\n");
}
catch (SOAPFaultException e)
{
System.out.println("FAILED!\n");
System.out.println(e.getFault().getFaultCode() + " : " + e.getMessage());
return;
}
// --------------------------------------------------------------------------
// 2) Get the user's favorites
// --------------------------------------------------------------------------
// Create the DocumentManagement service client
DocumentManagement_Service docManService = new DocumentManagement_Service();
DocumentManagement docManClient = docManService.getBasicHttpBindingDocumentManagement();
// Create the OTAuthentication object and set the authentication token
OTAuthentication otAuth = new OTAuthentication();
otAuth.setAuthenticationToken(authToken);
// We need to manually set the SOAP header to include the authentication token
try
{
setSoapHeader((WSBindingProvider) docManClient, otAuth);
}
catch (SOAPException e)
{
System.out.println("Failed to set authentication SOAP header!\n");
System.out.println(e.getMessage());
System.out.println(e.getStackTrace());
return;
}
// Store the favorites
List<Node> favorites = null;
// Call the GetAllFavorites() method to get the user's favorites
try
{
System.out.print("Getting the user's favorites...");
favorites = docManClient.getAllFavorites();
System.out.println("SUCCESS!\n");
}
catch (SOAPFaultException e)
{
System.out.println("FAILED!\n");
System.out.println(e.getFault().getFaultCode() + " : " + e.getMessage());
return;
}
// Output the user's favorites
System.out.println("User's Favorites:\n");
if (favorites.size() > 0)
{
for (Node node : favorites)
{
System.out.println(node.getName());
}
}
else
{
System.out.println("No Favorites.");
}
System.out.println();
}
/**
* Sets the OTAuthentication SOAP header on the binding provider.
*
* @param bindingProvider
* The binding provider to set the header on.
* @param otAuth
* The OTAuthentication object containing the authentication token.
* @throws SOAPException
*/
public static void setSoapHeader(WSBindingProvider bindingProvider, OTAuthentication otAuth) throws SOAPException
{
final String ECM_API_NAMESPACE = "urn:api.ecm.opentext.com";
// Create a SOAP header
SOAPHeader header = MessageFactory.newInstance().createMessage().getSOAPPart().getEnvelope().getHeader();
// Add the OTAuthentication SOAP header element
SOAPHeaderElement otAuthElement = header.addHeaderElement(new QName(ECM_API_NAMESPACE, "OTAuthentication"));
// Add the AuthenticationToken SOAP element
SOAPElement authTokenElement = otAuthElement.addChildElement(new QName(ECM_API_NAMESPACE, "AuthenticationToken"));
authTokenElement.addTextNode(otAuth.getAuthenticationToken());
// Set the header on the binding provider
bindingProvider.setOutboundHeaders(Headers.create(otAuthElement));
}
}
Can someone please let me knwo what am I doing wrong.
Thank You,
Nemish Nigam