Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTP Transport Error while connecting to LiveLink using webservices

Status
Not open for further replies.

RajaneeshJM

Programmer
Apr 22, 2014
27
IN
Hi,

I am new to OpenText LiveLink. We are using Content Server 10 SP2 Update 11. The Content Server has been installed on a machine [lets assume machine name as livelinkhost] using IIS. Also the Web Services have been deployed on the same machine using Tomcat. I am able to access the CS using the url Also I am able to access the WSDL using the url
To verify the webservices, I have written a sample Java program TestLiveLink.java [available in the attachment]. Also I have used the wsimport tool of JAX-WS [available in my local machine] to create a JAR file [livelink.jar]. While creating the JAR files I had copied the WSDL files from the server available in the path TOMCAT_HOME/webapps/les-services/WEB-INF/wsdl to a local path and used the below wsimport command

wsimport -keep -verbose E:\OpenText\WSDL\Authentication.wsdl -d E:\OpenText\WSDL\Build1_JAX-WS\classes -s E:\OpenText\WSDL\Build1_JAX-WS\src

livelink.jar created using the command jar -cvf livelink.jar *.*

As part of the IDE project [using IntelliJ] the below list of JAR files are associated to the project

activation-1.1.jar
FastInfoset.jar
http.jar
jaxb-api.jar
jaxb-impl.jar
jaxb-xjc.jar
jaxws-api.jar
jaxws-rt.jar
jaxws-tools.jar
jsr173_api.jar
jsr181-api.jar
jsr250-api.jar
livelink.jar
otjaxws.jar
resolver.jar
saaj-api.jar
saaj-impl.jar
sjsxp.jar
stax-ex.jar
streambuffer.jar

When I try to Run the TestLiveLink program I get the below error.

Exception in thread "main" com.sun.xml.ws.client.ClientTransportException: HTTP transport error: java.net.ConnectException: Connection refused: connect
at com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:134)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:140)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at com.sun.xml.ws.client.Stub.process(Stub.java:248)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
at $Proxy34.authenticateUser(Unknown Source)
at com.sysarris.register.livelink.TestLiveLink.getAuthenticationToken(TestLiveLink.java:66)
at com.sysarris.register.livelink.TestLiveLink.main(TestLiveLink.java:19)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at sun.net. at com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:122)
... 19 more

Process finished with exit code 1

Please help me in solving the problem. I am new to WebServices and LiveLink :)

package com.sysarris.register.livelink;

import java.util.*;

import javax.xml.soap.*;
import javax.xml.namespace.QName;

import com.sun.xml.internal.ws.developer.WSBindingProvider;
import com.sun.xml.internal.ws.api.message.Header;
import com.sun.xml.internal.ws.api.message.Headers;

import com.opentext.livelink.service.core.*;
import com.opentext.livelink.service.docman.*;
import com.opentext.livelink.service.docman.Node;
import com.opentext.ecm.api.OTAuthentication;

public class TestLiveLink{
public static void main(String[] args){
String admToken = getAuthenticationToken("Admin", "livelink");
try{
DocumentManagement dm = getDMService(admToken);
System.out.println("Token: " + admToken);
//Confirm Admin Home
Node nPersonalWS = dm.getRootNode("PersonalWS");
System.out.println(nPersonalWS.getName());
}catch(Exception e){
e.printStackTrace();
}
}

private static DocumentManagement getDMService(String authToken) throws Exception{
DocumentManagement_Service service = new DocumentManagement_Service();
DocumentManagement endpoint = service.getBasicHttpBindingDocumentManagement();
OTAuthentication otAuth = new OTAuthentication();
otAuth.setAuthenticationToken(authToken);
setSoapHeader((WSBindingProvider) endpoint, otAuth);
return endpoint;
}

public static void setSoapHeader(WSBindingProvider bindingProvider, OTAuthentication otAuth) throws Exception{
List<Header> headers = new ArrayList<Header>();
SOAPMessage message = MessageFactory.newInstance().createMessage();
SOAPPart part = message.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPHeader header = envelope.getHeader();
headers.add(getOTAuthenticationHeader(header, otAuth));
bindingProvider.setOutboundHeaders(headers);
}

public static Header getOTAuthenticationHeader(SOAPHeader header, OTAuthentication otAuth) throws Exception{
SOAPHeaderElement otAuthElement;
SOAPElement authTokenElement;
otAuthElement = header.addHeaderElement(new QName("urn:api.ecm.opentext.com", "OTAuthentication"));
otAuthElement.setPrefix("");
authTokenElement = otAuthElement.addChildElement(new QName("urn:api.ecm.opentext.com", "AuthenticationToken"));
authTokenElement.setPrefix( "" );
authTokenElement.addTextNode(otAuth.getAuthenticationToken());
return Headers.create(otAuthElement);
}

private static String getAuthenticationToken(String userName, String password) {
String token;
Authentication endpoint;
Authentication_Service service = new Authentication_Service();
endpoint = service.getBasicHttpBindingAuthentication();
token = endpoint.authenticateUser(userName, password);
return token;
}
}

Regards
Rajaneesh JM
 
Hi,

I have found a solution to the HTTP transport error. While trying to trace back the steps to confirm that I have not made any mistake, I realized that it was a mistake to copy the WSDL files to my local machine from the livelinkhost machine and then execute the wsimport command. I have changed the wsimport command and created a new livelink.jar.

wsimport -keep -verbose -d E:\OpenText\WSDL\Build2_JAX-WS\classes -s E:\OpenText\WSDL\Build2_JAX-WS\src

I have used similar wsimport command for the remaining wsdl files and have created the livelink.jar

After executing the below listed TestLiveLink.java, there is no HTTP transport error. But SOAPFaultException is being displayed.

javax.xml.ws.soap.SOAPFaultException: Could not access server
at com.sun.xml.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:188)
at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:116)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
at $Proxy34.authenticateUser(Unknown Source)
at com.sysarris.register.livelink.TestLiveLink.getAuthenticationToken(TestLiveLink.java:67)
at com.sysarris.register.livelink.TestLiveLink.main(TestLiveLink.java:21)
Caused by: javax.xml.ws.soap.SOAPFaultException: Could not access server
at com.opentext.livelink.service.core.ExceptionUtil.throwSOAPFaultException(ExceptionUtil.java:162)
at com.opentext.livelink.service.core.Authentication_JAXWS.authenticateUser(Authentication_JAXWS.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
Disconnected from the target VM, address: '127.0.0.1:54631', transport: 'socket'

------------------------------------------------------------------------------------------------------------------------------------

package com.sysarris.register.livelink;

import java.util.*;

import javax.xml.soap.*;
import javax.xml.namespace.QName;

import com.sun.xml.internal.ws.developer.WSBindingProvider;
import com.sun.xml.internal.ws.api.message.Header;
import com.sun.xml.internal.ws.api.message.Headers;

import com.opentext.livelink.service.core.*;
import com.opentext.livelink.service.docman.*;
import com.opentext.livelink.service.docman.Node;
import com.opentext.ecm.api.OTAuthentication;

public class TestLiveLink{
public static void main(String[] args){
String admToken;
try{
admToken = getAuthenticationToken("Admin", "livelink");
DocumentManagement dm = getDMService(admToken);
System.out.println("Token: " + admToken);
//Confirm Admin Home
Node nPersonalWS = dm.getRootNode("PersonalWS");
System.out.println(nPersonalWS.getName());
}catch(Exception e){
e.printStackTrace();
}
}

private static DocumentManagement getDMService(String authToken) throws Exception{
DocumentManagement_Service service = new DocumentManagement_Service();
DocumentManagement endpoint = service.getBasicHttpBindingDocumentManagement();
OTAuthentication otAuth = new OTAuthentication();
otAuth.setAuthenticationToken(authToken);
setSoapHeader((WSBindingProvider) endpoint, otAuth);
return endpoint;
}

public static void setSoapHeader(WSBindingProvider bindingProvider, OTAuthentication otAuth) throws Exception{
List<Header> headers = new ArrayList<Header>();
SOAPMessage message = MessageFactory.newInstance().createMessage();
SOAPPart part = message.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPHeader header = envelope.getHeader();
headers.add(getOTAuthenticationHeader(header, otAuth));
bindingProvider.setOutboundHeaders(headers);
}

public static Header getOTAuthenticationHeader(SOAPHeader header, OTAuthentication otAuth) throws Exception{
SOAPHeaderElement otAuthElement;
SOAPElement authTokenElement;
otAuthElement = header.addHeaderElement(new QName("urn:api.ecm.opentext.com", "OTAuthentication"));
otAuthElement.setPrefix("");
authTokenElement = otAuthElement.addChildElement(new QName("urn:api.ecm.opentext.com", "AuthenticationToken"));
authTokenElement.setPrefix( "" );
authTokenElement.addTextNode(otAuth.getAuthenticationToken());
return Headers.create(otAuthElement);
}

private static String getAuthenticationToken(String userName, String password) throws Exception{
String token;
Authentication endpoint;
Authentication_Service service = new Authentication_Service();
endpoint = service.getBasicHttpBindingAuthentication();
token = endpoint.authenticateUser(userName, password);
return token;
}
}

Please help me resolve the issue. I am new to Web Services and LiveLink.

Regards
Rajaneesh JM
 
Since you are consuming a ready made webservice from OT all it takes will be about 5 to 10 minutes to create a application on IIS and configure the dot net webservices
Are you game for that.Assuming you see the WSDL even before writing code using jaava or C# you can install SOAPUI freebie and write a enterprise access program.

Currently if one was to help you you have livelink on IIS, WSDL's on Tomcat and it makes it difficult.Also most of the WSAPI examples I give to the world and many others are in C#. They are in my website livelink.in.

Once you ascertain that the .dotnet wsdl is correct and you can hit the livelink server and get your personal ws or enterprise ws then you can start baby steps and try to consume the java based webservices.

At this point I am not sure if your Tomcat webserver is making a connection to the livelink server are they both on the same host?

Having said that I have been successfully been able to program in both C# and java and after the initial setup problems you should be OKAY.

If you want to make sure if it is related to livelink then on the livelink servers opentext.ini in the config file make DEBUG=2 WantLogS=True and WantLAPILogs=true and re-start the livelink server.then access livelink form the webgui and you should starts seeing good stuff in thread<nnnnnn>.out files.then run SOAP UI or your java program do you see anything that looks like these lines?


Executing API: #4300257c.InvokeService
inArgs: A<1,?,'Arguments'=A<1,?,'userName'='Admin','userPassword'='XXXXXXXXXX'>,'ServiceMethod'='AuthenticateUser','ServiceName'='Authentication','_ApiName'='InvokeService','_ClientVersion'='9.7.1','_ConnectionName'='','_Cookie'='','_DomainName'='','_ImpersonateUserDomain'='','_LLENVIRON_ASSOC'=A<1,?,'REMOTE_ADDR'='*.*.*.*'>,'_Request'='llweb','_UserName'='Admin','_UserPassword'='XXXXXXXXXX'>


Note the debug=2 and others are commonly used to figure out if the CGI or in your case the WSAPI is making a connection.
All the WSDL's are giving you is proxies to be used in your programming but it actually needs a livelink server to work with.

That is how I would go about this


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Thanks AppNair for your feedback.

I have updated the OpenText.ini file with the settings provided by you and restarted the Content Server. After restart I am able to Authenticate using WebServices. On trying to access the Root Node or the Favorites using the DocumentManagement Service I get the below error.

Below is the codebase as well.

Note that I have not configured dotnet webservices. Also Content Server and Tomcat are on the same host. I have updated the web.xml available in TOMCAT_HOME\webapps\les-services\WEB-INF folder to update the LivelinkServer and LiverlinkServerPort attributes with hostname and 2099 respectively.

javax.xml.ws.WebServiceException: com.sun.istack.XMLStreamException2: javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.
at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:111)
at com.sun.xml.ws.encoding.SOAPBindingCodec.encode(SOAPBindingCodec.java:258)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:142)
at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:86)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
at com.sun.xml.ws.client.Stub.process(Stub.java:248)
at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:109)
at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:89)
at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
at $Proxy36.getRootNode(Unknown Source)
at com.sysarris.register.livelink.TestLiveLink.main(TestLiveLink.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: com.sun.istack.XMLStreamException2: javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.
at com.sun.xml.ws.message.jaxb.JAXBHeader.writeTo(JAXBHeader.java:184)
at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:135)
at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:108)
... 19 more
Caused by: javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:556)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:478)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:171)
at com.sun.xml.ws.message.jaxb.MarshallerBridge.marshal(MarshallerBridge.java:80)
at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:141)
at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:133)
at com.sun.xml.ws.message.jaxb.JAXBHeader.writeTo(JAXBHeader.java:179)
... 21 more

----------------------------------------------------------------------------------------------------------------------------------------

package com.sysarris.register.livelink;

import java.util.*;

import javax.xml.soap.*;
import javax.xml.namespace.QName;

//import com.sun.xml.internal.ws.developer.WSBindingProvider;
import com.sun.xml.internal.ws.api.message.Header;
import com.sun.xml.internal.ws.api.message.Headers;
import com.sun.xml.ws.developer.WSBindingProvider;

import com.opentext.livelink.service.core.*;
import com.opentext.livelink.service.docman.*;
import com.opentext.livelink.service.docman.Node;
import com.opentext.ecm.api.OTAuthentication;

public class TestLiveLink{
public static void main(String[] args){
String admToken;
try{
admToken = getAuthenticationToken("rajaneesh", "Password2");
DocumentManagement dm = getDMService(admToken);
System.out.println("Token: " + admToken);



/*Node nPersonalWS = dm.getRootNode("EnterpriseWS");
System.out.println(nPersonalWS.getName());*/



List<Node> favorites = null;
favorites = dm.getAllFavorites();

if(favorites.size() > 0){
for(Node node : favorites){
System.out.println(node.getName());
}
} else {
System.out.println("No Favorites");
}
}catch(Exception e){
e.printStackTrace();
}
}

private static DocumentManagement getDMService(String authToken) throws Exception{
DocumentManagement_Service service = new DocumentManagement_Service();
DocumentManagement endpoint = service.getBasicHttpBindingDocumentManagement();
OTAuthentication otAuth = new OTAuthentication();
otAuth.setAuthenticationToken(authToken);
setSoapHeader((WSBindingProvider) endpoint, otAuth);
return endpoint;
}

public static void setSoapHeader(WSBindingProvider bindingProvider, OTAuthentication otAuth) throws Exception{
List<Header> headers = new ArrayList<Header>();
SOAPMessage message = MessageFactory.newInstance().createMessage();
SOAPPart part = message.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPHeader header = envelope.getHeader();
headers.add(getOTAuthenticationHeader(header, otAuth));
bindingProvider.setOutboundHeaders(headers);
}

public static Header getOTAuthenticationHeader(SOAPHeader header, OTAuthentication otAuth) throws Exception{
SOAPHeaderElement otAuthElement;
SOAPElement authTokenElement;
otAuthElement = header.addHeaderElement(new QName(" "OTAuthentication"));
otAuthElement.setPrefix("");
authTokenElement = otAuthElement.addChildElement(new QName(" "AuthenticationToken"));
authTokenElement.setPrefix( "" );
authTokenElement.addTextNode(otAuth.getAuthenticationToken());
return Headers.create(otAuthElement);
}

private static String getAuthenticationToken(String userName, String password) throws Exception{
String token;
Authentication endpoint;
Authentication_Service service = new Authentication_Service();
endpoint = service.getBasicHttpBindingAuthentication();
token = endpoint.authenticateUser(userName, password);
return token;
}
}
 
Cannot be more help you should look in the thread.out logs to see if your call to get favorites is happening or not
Also programming in java and tomcat you have to be very versatile in understanding or trying to differentiate
java stack errors versus OT web services errors .I wouldn't know how to advise you at this point....
It could be something silly you are doing some classpath loading that kind....
It is good now that you are communicating to livelink that would really be the first step.

See if you can work or make the TreeApplication that comes bundled with the web services code
Many times that is how java programmers do their work with CWS.


Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
official OT document if that helps

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Thanks AppNair for your feedback.

The link to the official OT Document worked.

I changed the program as per below and also removed all the dependant jars, after which there was no exception.

I have few clarifications. In the getOTAuthenticationHeader, earlier I had specified the HTTP url of my CS instance in the line header.addHeaderElement. Similarly for the line otAuthElement.addChildElement. Now I have reverted it to back to use the namespace "urn:api.ecm.opentext.com". Could you explain why is it wrong to specify the HTTP url of my CS instance?

activation-1.1.jar
FastInfoset.jar
http.jar
jaxb-api.jar
jaxb-impl.jar
jaxb-xjc.jar
jaxws-api.jar
jaxws-rt.jar
jaxws-tools.jar
jsr173_api.jar
jsr181-api.jar
jsr250-api.jar
livelink.jar
otjaxws.jar
resolver.jar
saaj-api.jar
saaj-impl.jar
sjsxp.jar
stax-ex.jar
streambuffer.jar

---------------------------------------------------------------------------------------------------------------

package com.sysarris.register.livelink;

import java.util.List;
import java.util.ArrayList;

import javax.xml.soap.*;
import javax.xml.namespace.QName;

import com.sun.xml.internal.ws.developer.WSBindingProvider;
import com.sun.xml.internal.ws.api.message.Header;
import com.sun.xml.internal.ws.api.message.Headers;

import com.opentext.livelink.service.core.*;
import com.opentext.livelink.service.docman.*;
import com.opentext.livelink.service.docman.Node;
import com.opentext.ecm.api.OTAuthentication;

public class TestLiveLink{
public static void main(String[] args){
String admToken;
try{
admToken = getAuthenticationToken("Admin", "livelink");
DocumentManagement dm = getDMService(admToken);
System.out.println("Token: " + admToken);
System.out.println("dm: "+dm);

Node nPersonalWS = dm.getRootNode("EnterpriseWS");
System.out.println(nPersonalWS.getName());

List<Node> favorites;
favorites = dm.getAllFavorites();

if(favorites.size() > 0){
for(Node node : favorites){
System.out.println(node.getName());
}
System.out.println("Number of Favorites is equal to "+favorites.size());
} else {
System.out.println("No Favorites");
}
}catch(Exception e){
e.printStackTrace();
}
}

private static DocumentManagement getDMService(String authToken) throws Exception{
DocumentManagement_Service service = new DocumentManagement_Service();
DocumentManagement endpoint = service.getBasicHttpBindingDocumentManagement();
System.out.println("Obtain HTTP Binding for Document Management");
OTAuthentication otAuth = new OTAuthentication();
otAuth.setAuthenticationToken(authToken);
System.out.println("Auth Token set for OTAuthentication");
setSoapHeader((WSBindingProvider) endpoint, otAuth);
System.out.println("SOAP Header set for endpoint and OTAuthentication");
return endpoint;
}

public static void setSoapHeader(WSBindingProvider bindingProvider, OTAuthentication otAuth) throws Exception{
List<Header> headers = new ArrayList<Header>();
SOAPMessage message = MessageFactory.newInstance().createMessage();
SOAPPart part = message.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPHeader header = envelope.getHeader();
headers.add(getOTAuthenticationHeader(header, otAuth));
bindingProvider.setOutboundHeaders(headers);
}

public static Header getOTAuthenticationHeader(SOAPHeader header, OTAuthentication otAuth) throws Exception{
final String ECM_API_NAMESPACE = "urn:api.ecm.opentext.com";
SOAPHeaderElement otAuthElement;
SOAPElement authTokenElement;
otAuthElement = header.addHeaderElement(new QName(ECM_API_NAMESPACE, "OTAuthentication"));
otAuthElement.setPrefix("");
authTokenElement = otAuthElement.addChildElement(new QName(ECM_API_NAMESPACE, "AuthenticationToken"));
authTokenElement.setPrefix( "" );
authTokenElement.addTextNode(otAuth.getAuthenticationToken());
return Headers.create(otAuthElement);
}

private static String getAuthenticationToken(String userName, String password) throws Exception{
String token;
Authentication endpoint;
Authentication_Service service = new Authentication_Service();
endpoint = service.getBasicHttpBindingAuthentication();
token = endpoint.authenticateUser(userName, password);
return token;
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top