ptc-windchill - 用于在 Windchill 中创建新工作区的 Rest API
问题描述
我想在 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 类。
推荐阅读
- javascript - 在我的网站中,我添加了 barba.js,问题是当我转到下一页 barba 动画工作但其他 javascript 函数不起作用时
- javascript - 如何使用javascript比较两个日期时间与时区偏移量(比较大于或小于)
- css - `input[text]` 选择器的含义是什么?
- vba - 我如何使用“环境”变量将_另存为 Excel 发票在另一台计算机上
- oracle - Oracle Apex PDF 查看器
- python - 将元素放入 for lob Python 3 的新数组中
- bash - 从标准输出创建别名
- c++ - Vulkan 中的动态顶点缓冲区格式设置
- php - 为什么在使用模式编辑数据时,更改所有 ID?
- android - 无法从物理设备上的 sqlite 读取数据