休息 API 用于在 Windchill 中创建新工作区

Rest API for creating new workspace in Windchill

我想在 Windchill 中创建一个工作区,从我们的 Web 应用程序调用 Rest API。但是在任何 Windchill Rest API 文档中都找不到这样的 API 端点。

是否可以使用 rest 创建工作区 API,如果不能,是否有其他方法可以实现。

您在哪个 Windchill 版本上工作?

当我在 REST 服务中找不到标准端点时,我会自己编写它们。 从 Windchill 11.1 开始,我使用 Spring 来创建它们。 为此,您需要在 codebase/WEB-INF/web.xml 中输入一个条目,例如:

<servlet>
    <servlet-name>ConnectorName</servlet-name>
    <servlet-class>
        org.springframework.web.servlet.DispatcherServlet
    </servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>ConnectorName</servlet-name>
    <url-pattern>/servlet/connector/*</url-pattern>
</servlet-mapping>

在同一文件夹中,您需要一个名为 Servletname-servlet 的文件,例如 ConnectorName-servlet.xml,其内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:p="http://www.springframework.org/schema/p"
   xmlns:aop = "http://www.springframework.org/schema/aop"
   xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context-4.0.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd ">
<context:component-scan base-package="packagename" />
<mvc:annotation-driven />

之后你可以在上面定义的组件扫描包中创建一个Spring RestController Class。