cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to call Windchill API from outside the Windchill

Neo
1-Newbie
1-Newbie

How to call Windchill API from outside the Windchill

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

1 ACCEPTED SOLUTION

Accepted Solutions
ybagul
1-Newbie
(To:Neo)

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

View solution in original post

13 REPLIES 13
ybagul
1-Newbie
(To:Neo)

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

Neo
1-Newbie
1-Newbie
(To:ybagul)

Thanks Yogesh,

I will try this at my end

jmomber
9-Granite
(To:Neo)

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.

Neo
1-Newbie
1-Newbie
(To:jmomber)

Thanks Jamie,

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

jmomber
9-Granite
(To:Neo)

This PTC case links to the Web Service Framework documentation:

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

Neo
1-Newbie
1-Newbie
(To:Neo)

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

ybagul
1-Newbie
(To:Neo)

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.

Neo
1-Newbie
1-Newbie
(To:ybagul)

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>

ybagul
1-Newbie
(To:Neo)

From your post above, it sounds like you have a Java code that calls an IE task (different from my understanding that you are calling Java code via Apply-Service webject). Can you explain what you are trying to achieve?

Neo
1-Newbie
1-Newbie
(To:ybagul)

So basically I have my application which is developed in java and which collect the Documents from the file server and load it to Windchill using Info*engine webject task

ybagul
1-Newbie
(To:Neo)

if your Java code is on same server as Windchill, following will help you.

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

ybagul
1-Newbie
(To:Neo)

And if you want to go IE task approach, use attached IE task

1. In IE task FileUpload.xml, replace "GOLF_CART" container name with product name where this file needs to be uploaded. Or you can parametrize it.

2. Place IE task FileUpload.xml in <Windchill>\tasks\ext\company\object\

3. Restart Windchill

4. Call this IE Task (tested on Windchill 9.1) from Java (supplying Document Name as parameter) and stream required content file. You will need to handle authentication.

http://host.domain/Windchill/servlet/IE/tasks/ext/company/object/FileUpload.xml?file=<Document Name>

Neo
1-Newbie
1-Newbie
(To:ybagul)

Thank you Yogesh,

This will help me.

Top Tags