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

We are happy to announce the new Windchill Customization board! Learn more.

RESTFul get representation URL

nbojcetic
10-Marble

RESTFul get representation URL

Hello,

well I have a problem that I cannot solve and I need help or guidance how to solve it. I am trying to get EPMDocument's (Creo part) visual representation (a .pvs file) using RESTFul query. Here is my query (for testing purposes we are using Swagger):

GET --header 'Accept: application/json' 'http://<wct-server>:<port>/Windchill/servlet/rest/visualization/objects/OR:wt.epm.EPMDocument:147522537'

on our windchill installations (I am using WcT 11.0 M030 CPS13) the result looks like:

{
  "id": "...",
  "attributes": {
    "representations": [
      {
        "id": "OR:wt.viewmarkup.DerivedImage:....",
        "attributes": {
          "default": true,
          "launchCreoView": "http://<Wct-server>:<port>/Windchill/wtcore/jsp/wvs/edrview.jsp?objref=OR%3Awt.viewmarkup.DerivedImage%3A422931&url=http%3A%2F%2Fhades.fsb.hr%3A90%2FWindchill%2Fservlet%2FWindchillAuthGW%2Fcom.ptc.wvs.server.util.WVSContentHelper%2FredirectDownload%2Fcad-0000001809_prt.pvs%3FContentHolder%3Dwt.viewmarkup.DerivedImage%253A422931%26HttpOperationItem%3Dwt.content.ApplicationData%253A422958%26u8%3D1&u8=1&forceuseplugin=true",
"threedthumbnail": ...
}

but on the client's installation (they are using WcT 11.0 M020) the "launchCreoView" string looks like:

"launchCreoView": "creoview://?wcparams=eyJhdHRyaWJ1dGVzIjp7InVybGJhc2UiOiJodHRwOi8vaHJ6YWdqMTMyYS53Yy5sb2NhbDo4MDgwL1dpbmRjaGlsbCIsInNlc3Npb25pZCI6InVKRVBqbzc0TS1xNlNzMGhxdEdIanZIbXpZUS4xdGgiLCJ1c2VyaWQiOiJocjJ1MDA0OSJ9LCJpZCI6ImN2In0="

 

It is noticeable that clients URL starts with creoview:// and ours starts with httpd:// 

And this is a problem, we were unable to figure out why URLs are different. We raise a call at the PTC support, but they don't know the answer (3 months past since).

So I am asking this community does anybody has any idea what to do and how to change this behavior.

Thank you!

Nenad

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,

 

to get a list of related representations use the query:

 

http://wnc_host/Windchill/servlet/odata/v1/CADDocumentMgmt/CADDocuments('VR%3Awt.epm.EPMDocument%3A87859')/Representations

 

Responce will have url to pvt

 

"ThreeDThumbnailURL": {
"URL": "http://wnc_host/Windchill/servlet/WindchillAuthGW/com.ptc.wvs.server.util.WVSContentHelper/redirectDownload/01-72530_prt.pvt?ContentHolder=wt.viewmarkup.DerivedImage%3A106120&HttpOperationItem=wt.content.ApplicationData%3A106132&u8=1",
"Label": "01-72530_prt.pvt",
"FileSize": "8074",
"MimeType": "x-unknown/x-unknown",
"Format": "Unknown",
"ID": "OR:wt.content.ApplicationData:106132",
"FileName": "01-72530_prt.pvt",
"LastModified": "2019-05-10 07:10:28.0",
"CreatedOn": "2019-05-10 07:10:28.0",
"Description": null,
"Comments": null
}

 

You have to parse this JSON and use URL property value to download pvt.

If you want to have service in Windchill which will return e.g latest related pvt, you have to programing custom rest service or servlet or JSP (which will parse JSON and redirect to the endpoint URL).

View solution in original post

10 REPLIES 10

Hello,

 

to get a list of related representations use the query:

 

http://wnc_host/Windchill/servlet/odata/v1/CADDocumentMgmt/CADDocuments('VR%3Awt.epm.EPMDocument%3A87859')/Representations

 

Responce will have url to pvt

 

"ThreeDThumbnailURL": {
"URL": "http://wnc_host/Windchill/servlet/WindchillAuthGW/com.ptc.wvs.server.util.WVSContentHelper/redirectDownload/01-72530_prt.pvt?ContentHolder=wt.viewmarkup.DerivedImage%3A106120&HttpOperationItem=wt.content.ApplicationData%3A106132&u8=1",
"Label": "01-72530_prt.pvt",
"FileSize": "8074",
"MimeType": "x-unknown/x-unknown",
"Format": "Unknown",
"ID": "OR:wt.content.ApplicationData:106132",
"FileName": "01-72530_prt.pvt",
"LastModified": "2019-05-10 07:10:28.0",
"CreatedOn": "2019-05-10 07:10:28.0",
"Description": null,
"Comments": null
}

 

You have to parse this JSON and use URL property value to download pvt.

If you want to have service in Windchill which will return e.g latest related pvt, you have to programing custom rest service or servlet or JSP (which will parse JSON and redirect to the endpoint URL).

Hi fivigg,

thank your for your answer. I did some testing and here is what I found. Using the suggested query on the EPMDocument has two possible outcome. First is when you query representation of the EPMDocument (presumably that additional files are not created, like dxf, step, etc.) then the result is empty string:

QUERY: http://wnc_host//Windchill/servlet/odata/v1/CADDocumentMgmt/CADDocuments%28'OR:wt.epm.EPMDocument:426946'%29/Representations

RESULT: { "@odata.context": "http://wnc_host/Windchill/servlet/odata/v1/Visualization/$metadata#CADDocuments('OR:wt.epm.EPMDocument:426946')/Representations", "value": [] }

 

but when the EPMDocument has additional files created then result is different:

{ "@odata.context": "http://wnc_host/Windchill/servlet/odata/v1/Visualization/$metadata#CADDocuments('VR:wt.epm.EPMDocument:433400')/Representations",

"value": [ { "AdditionalFiles": [

{ "URL": "http://wnc_host/Windchill/servlet/WindchillAuthGW/com.ptc.windchill.enterprise.wvs.saveWVSObject.utils.SaveWVSObjectHelper/saveWVSObject/cad-0000001866_drw.plt?annotations=true&oid=OR%3Awt.content.ApplicationData%3A434427&fileType=plt&u8=1", "Label": "cad-0000001866_drw.plt", "FileSize": "19729", "MimeType": "x-unknown/x-unknown", "Format": "Unknown", "ID": "OR:wt.content.ApplicationData:434427", "FileName": "cad-0000001866_drw.plt", "LastModified": "2019-07-07 16:18:39.0", "CreatedOn": "2019-07-07 16:18:39.0", "Description": null, "Comments": null },

{ "URL": "http://wnc_host/Windchill/servlet/WindchillAuthGW/com.ptc.windchill.enterprise.wvs.saveWVSObject.utils.SaveWVSObjectHelper/saveWVSObject/dxf_cad-0000001866_drw.dxf?annotations=true&oid=OR%3Awt.content.ApplicationData%3A434442&fileType=dxf&u8=1", "Label": "dxf_cad-0000001866_drw.dxf", "FileSize": "25712", "MimeType": "image/vnd.dxf", "Format": "DXF", "ID": "OR:wt.content.ApplicationData:434442", "FileName": "dxf_cad-0000001866_drw.dxf", "LastModified": "2019-07-07 16:18:39.0", "CreatedOn": "2019-07-07 16:18:39.0", "Description": null, "Comments": null }, ...

 

for some reasons the pvs visualization type is not included in the list it is added as a separate object: "CreoViewURL": { "URL": "creoview://?wcparams=eyJhdHRyaWJ1dGVzIjp7InVybGJhc2UiOiJodHRwOi8vaGFkZXMuZnNiLmhyOjkwL1dpbmRjaGlsbCIsInNlc3Npb25pZCI6IkxVMkJuWjk1aG5jY3B1c1FzSWNITDd0SmdxWS41aWo1IiwidXNlcmlkIjoibmVzbyJ9LCJpZCI6ImN2In0=", "Label": "default" },

 

But I was able to get visualization only for EPMDocument - Drawing, for part or assembly result was an empty string. My problem is to retrieve a URL to part or assembly visualization (the .pvs file) but on different WcT installations i got different results:

on our server: "launchCreoView": "http://:/Windchill ..."

on the client server: "launchCreoView": "creoview://?wcparams=..."

and nobody knows why the URL is different and how to change it. Your suggestion to create my own servlet is the path that I am considering very seriously.

 

Best regards!

Nenad

hkotha
6-Contributor
(To:nbojcetic)

Hello,

 

You need to frame URL in below format.. Launching this URL will launch the default visualization in creo view.

https://<host>/Windchill/wtcore/jsp/wvs/edrview.jsp?url=https://<plm>/Windchill/servlet/WindchillAuthGW/com.ptc.wvs.server.ui.UIHelper/getPartStructureED&partid=OR:wt.part.WTPart:<oid>&levels=-1&partstructure=1

 

Thanks,

Shyam

Hi Shyam,

thank you for your suggestion. It works, I was able to get visualization for EPMDocument that was my intention. No, I need to accomplish that using iframe. The idea is to have list of EPMDocuments on the left and visualization of selected epm on the right. If you have any suggestions, your welcome.

 

Best regards!
Nenad

hkotha
6-Contributor
(To:nbojcetic)

Ok. Basically you want to display thumbnail in JSP where user can launch Representation in Creo View. Right?
If yes, the JSP you are developing is in Windchill or in other applicantion?

Thanks
Shyam

Hi Shyam,

we were hoping to use RESTFul query, but it seams that this is not viable option. So, we are considering creating service on the WcT server (JSP on the server that will find and download visualization to folder on the server for given number) and the client application that will call the service and display the file. The intention is to support factory floor workers to be able to preview 3D model visualization (browser in kiosk mode) without using WcT GUI.

 

Best regards!

Nenad

hkotha
6-Contributor
(To:nbojcetic)

I have ready code for JSP which will show thumbnail and will open in Creo view upon clicking on it. But this will work only if it is deployed in Windchill codebase. It won't work in other applications. Let me know if you need Windchill JSP to show representations to shop floor

Thanks
Shyam

Hi Shyam,

thank you for your suggestion, we are interested. How we can get the code?

 

Best reagards!

Nenad

hkotha
6-Contributor
(To:nbojcetic)

Add this in your Custom Windchill JSP Page. and update service code accordingly.

<%@include file="/netmarkets/jsp/components/beginWizard.jspf"%>
<%@include file="/netmarkets/jsp/components/includeWizBean.jspf"%>

<jca:describePropertyPanel var="panelVisDescriptor">
<jca:describeProperty id="visualization" label="visualization" />
</jca:describePropertyPanel>
<jca:getModel var="propertyPanelModel"
descriptor="${panelVisDescriptor}"
serviceName="<Class name where below method is defined>"
methodName="<define your method in above mentioned service class to pull Representation object of EPM or Part>">
<jca:addServiceArgument value="${param.number}" type="java.lang.String" />
</jca:getModel>

<jca:renderPropertyValue
model="${propertyPanelModel}" id="visualization" />

<%@ include file="/netmarkets/jsp/util/end.jspf"%>

 

Hope this will help..

 

Thanks,

Shyam.

Hi Shyam,

thank you very much. I will try your solution.

Best regards!

Nenad

Top Tags