创建 Windchill 服务器端自定义
Windchill 服务器提供了用于验证自定义 Windchill Workgroup Manager 请求并调用自定义服务的基础结构。通常,您需要执行以下步骤:
1. 实现 UwgmC11nService 接口。
2. <Windchill>\codebase\com\ptc\windchill\uwgm\common\delegate\application.service.xconf 中注册自定义服务。
不同类型的自定义请求会调用不同的方法:
基于非工作区的自定义请求 (C11nRequest) 会调用 UwgmC11nService.execute() 方法。
基于工作区的自定义请求 (WorkspaceC11nRequest) 会调用 UwgmC11nService.executeInWS() 方法。
但是,这两种方法都使用自定义的请求上下文 (C11nRequestContext),该上下文为以下属性提供了 getter:
WTPrincipal
区域设置
客户端名称
Version
SessionID
这两种方法 ((execute()executeInWS()) 都返回中间 UwgmC11nResponse,然后将其作为 C11nMessage 序列化回客户端。
UwgmC11nService
public interface UwgmC11nService
{
/**
* The Cutsom service delegate is expected to implement execute
* @param c11nCtx
: com.ptc.windchill.uwgm.proesrv.c11n.C11nRequestContext
* @param c11nInstructions
: Map<String, String>
* @param c11nIterationInstructions
: Map<Persistable, Map <String, String>>
* @return UwgmC11nResponse
: com.ptc.windchill.uwgm.proesrv.c11n.UwgmC11nResponse
* @throws WTException
: Exception
* @throws ConflictException
: Conflict
*/
public UwgmC11nResponse execute(C11nRequestContext c11nCtx,
Map<String, String> c11nInstructions,
Map<Persistable, Map<String, String>>
c11nIterationInstructions)
throws WTException, ConflictException;

/**
* The Cutsom service delegate is expected to implement execute
* @param c11nCtx
: com.ptc.windchill.uwgm.proesrv.c11n.C11nRequestContext
* @param c11nInstructions
: Map<String, String>
* @param c11nIterationInstructions
: Map<Persistable, Map <String, String>>
* @param ws
: EPMWorksapce
* @return UwgmC11nResponse
: com.ptc.windchill.uwgm.proesrv.c11n.UwgmC11nResponse
* @throws WTException
: Exception
* @throws ConflictException
: Conflict
*/
public UwgmC11nResponse executeInWS(C11nRequestContext c11nCtx,
EPMWorkspace ws,
Map<String, String> c11nInstructions,
Map<Persistable, Map<String, String>>
c11nIterationInstructions) throws WTException,
ConflictException;
}
C11nRequestContext
public interface C11nRequestContext
{
/**
* returns current user (principal)
* @return WTPrincipal
*/
public WTPrincipal getPrincipal();

/**
* returns current client's locale
* @return Locale
*/
public Locale getLocale();

/**
* returns client canonic name
* @return String
*/
public String getClientName();

/**
* returns client canonic version
* @return int
*/
public String getClientVersion();

/**
* returns the session information of the Client
* @return String
*/
public String getClientSessionID();

/**
* retruns the name of the PDM request
* @return String
*/
public String getRequestName ();
}
UwgmC11nResponse
public UwgmC11nResponse(Map<String, String> stringData,
Map<Persistable, Map<String, String>> iterationData)
{
responseData = stringData;
iterationResponseData = iterationData;
}

/**
* It is expected that the client recieving the response
* understands the semantics
* of the keys; and accordingly interprets the
* value of the response.
* @return Map <String, String>
*/
public Map<String, String> getResponseData()
{
return responseData;
}

/**
* Response elements associated to the Persistable.
* It is expected that the client recieving the response s
* understand the semantics of the key; and accordingly
* interprets the value of the entries in the String Map
* associated with each Persistable in the Map.
*
* @return Map<Persistable, Map<String, String>>
*/
public Map<Persistable, Map<String, String>> getIterationResponseData()
{
return iterationResponseData;
}

/**
* logging
*/
private static Log log = LogFactory.getLog(UwgmC11nResponse.class);
}
<Windchill>\codebase\com\ptc\windchill\uwgm\proesrv\c11n\UwgmC11nServiceTest.java 的 Windchill 安装中提供了 UwgmC11nService 的示例实现,仅供参考。您不应重用此类。您需要根据需要实现您自己的服务器端自定义。
这对您有帮助吗?