Skip to main content
1-Visitor
March 26, 2015
Solved

How to call Windchill API from outside the Windchill

  • March 26, 2015
  • 13 replies
  • 11245 views

Hello I am working on the Requirement where I would required to call the Windchill API out side the Windchill system does anybody know this how we can achieve this.

e.g.: I have developed a code which create a WTDocument in Windchill now I want to call this code from out side the Windchill server.with in the company network

Best answer by ybagul

Create an Info Engine task with Apply-Service webject inside. That IE task can be called with http(s) request.

http://support.ptc.com/cs/help/windchill_hc/wc102_hc/WC_WebjectLib_ApplyService.html#styler-id1.1.1.4.10.7.5.5.1

13 replies

ybagul1-VisitorAnswer
1-Visitor
March 26, 2015

Create an Info Engine task with Apply-Service webject inside. That IE task can be called with http(s) request.

http://support.ptc.com/cs/help/windchill_hc/wc102_hc/WC_WebjectLib_ApplyService.html#styler-id1.1.1.4.10.7.5.5.1

Neo1-VisitorAuthor
1-Visitor
March 27, 2015

Thanks Yogesh,

I will try this at my end

12-Amethyst
March 26, 2015

You could also expose your function as a web service. Using an Info Engine task is much easier (in my opinion) if you've never worked with the Windchill Web Service framework.

Neo1-VisitorAuthor
1-Visitor
March 27, 2015

Thanks Jamie,

Would you have any example for that, I am bit new in that so it will help me to do that

12-Amethyst
March 30, 2015

This PTC case links to the Web Service Framework documentation:

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS47545

Neo1-VisitorAuthor
1-Visitor
April 5, 2015

Thank you Yogesh I am able to call the Windchill API using Apply-Service but each time when I call the API through the browser I can not get the group value which contains the object information is it any way I can call it to ?

I am calling the webject from the my java application by calling the URL

http://host.domain/Windchill/servlet/IE/tasks/ext/company/object/createDocument.xml

when It execute it pop up the browser window with the output but I can not get the Windchill object

1-Visitor
April 6, 2015

Apply-Service webject will returns object(s) returned by (Java) method it calls in turn (if its not void). You can use those objects by casting from "Object" to appropriate class. If you provide a few screenshots, I can be more specific.

Neo1-VisitorAuthor
1-Visitor
April 7, 2015

Hello Yogesh,

Basically I am new in Info*engines so I am pretty not sure how this can be achieved so I have call it in that way

first I call the webject xml using this method

String url_open ="http://hostname/Windchill/servlet/IE/tasks/ext/swc/object/createDocument.xml";

java.awt.Desktop.getDesktop().browse(java.net.URI.create(url_open));


once the code is execute it open the file in the browser but since I have open it in through the url I am not able to get the group object

Capture.JPG

this is my webject task:

<%@page language="java"%>

<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>

<ie:webject name="Get-Properties" type="MGT">

<ie:param name="ATTRIBUTE" data="wt.federation.ie.VMName"/>

<ie:param name="GROUP_OUT" data="properties"/>

</ie:webject>

<ie:webject name="Query-Objects" type="OBJ">

<ie:param name="INSTANCE" data="$(properties[0]wt.federation.ie.VMName[0])"/>

<ie:param name="TYPE" data="wt.inf.container.WTContainer"/>

<ie:param name="WHERE" data="name=Swc_Product"/>

<ie:param name="GROUP_OUT" data="container"/>

</ie:webject>

<ie:webject name="Create-Objects" type="ACT">

<ie:param name="INSTANCE" data="$(properties[0]wt.federation.ie.VMName[0])"/>

<ie:param name="CONTAINER_REF" data="$(container[0]obid[0])"/>

<ie:param name="TYPE" data="wt.doc.WTDocument|com.swc.CustomDocument"/>

<ie:param name="FIELD" data="name=new_Document003"/>

</ie:webject>