Skip to main content
Mitratech Success Center

Client Support Center

Need help? Click a product group below to select your application and get access to knowledge articles, webinars, training content, and release notes or to contact our support team.

Authorized users - log in to create a ticket, view tickets status and check your success plan details.

 

Client Proxy Sample Code

The following code sample illustrates concepts described in Client Proxy of the Getting Started section.

The following code sample illustrates concepts described in Client Proxy of the Getting Started section.

It is important to note that the JaxWsProxyFactoryBean or equivalent class should be provided by your SOAP toolkit to create a client proxy. In addition, note that you can use the entityName (object type name, such as Contact) to construct both the classpath to the corresponding Web Service client interface, and to construct the corresponding Web Service URL.

Note: In this sample, the TeamConnect version is presumed to be 3.2.

package com.mitratech.teamconnect;
import org.apache.commons.lang.StringUtils;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
/**
* The purpose of this class is to create a Web Service client side proxy
*
* @author
* @since 3.0
*/
public class WSClientFactory
{
private final static String SERVER = "localhost"; private final static String PORT = "8080";
private final static String APP_NAME = "teamconnect-3.4SP1.0.0021";
/**
*
* @param entityName
* @return a service proxy for the specified entity
*/
public Object createWSProxy(String entityName) { JaxWsProxyFactoryBean clientFactory = new JaxWsProxyFactoryBean(); try {
clientFactory.setServiceClass(getClassForEntity(entityName));
} catch (ClassNotFoundException cnfe) {
throw new IllegalArgumentException("No Web Services available for entity named: " + entityName);
}
clientFactory.setAddress(getWSAddress(entityName)); return clientFactory.create();
}
private Class getClassForEntity(String entityName) throws ClassNotFoundException {
return Class.forName("com.mitratech.teamconnect.webservice." + entityName.toLowerCase() + "repository." + entityName + "Repository");
}
private String getWSAddress(String entityName) {
return "http://" + SERVER + ":" + PORT + "/" + APP_NAME + "/webservice/" + StringUtils.uncapitalize(entityName) + "Repository";
}
}
  • Was this article helpful?