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 the Community Ranking System, a fun gamification element of the PTC Community. X

Getting the WTDocument URL link

TiboMagnier
1-Newbie

Getting the WTDocument URL link

Hi,

I currently am implementing a method listener to retrieve some info from a WDocument soft-type and send it to another system.

But there is ann information I can't get : the object url. Indeed, I'd like to provide a direct link from the other system to the information page of the windchill object (like the one when you click on the object on a folder view) :

http://xxxxx.xxxxx.com/Windchill/servlet/TypeBasedIncludeServlet?oid=OR%3Awt.doc.WTDocument%3A41117&u8=1

I looked "URLFactory" doc but it's light and I'm not even sure if this is the correct way.

A must would be that it redirect to the "attributes page" of the object, butlet's start soft.

Any help will be fully appreciated.

Sincerely,

Thibault Magné

5 REPLIES 5

you can do like this:

wt.epm.EPMDocument doc = xxx.getEPMDoc();
String docUrl = "http://pdm.xxx.com/Windchill/servlet/TypeBasedIncludeServlet?oid=OR:wt.epm.EPMDocument:$id$&u8=1";
String id = "" + wt.fc.PersistenceHelper.getObjectIdentifier(doc).getId();
String weburl = docUrl.replace("$id$",id);

good luck

Hi Thibault,

Try this:

object_ref = (new wt.fc.ReferenceFactory()).getReferenceString(part);

it gives object referense like "VR:wt.part.WTPart%3A92324". And than join "http://xxxxx.xxxxx.com/Windchill/servlet/TypeBasedIncludeServlet?oid=" from left, and "&u8=1" from right.


Also you can use this method for download content:

WVSContentHelper.getDownloadURL(ContentHolder, ApplicationData)

First, thank you for your answers. They are very useful and alowed me to test some mechanism.

I found a "better" solution that do not need too harcode dome server information :

HashMap hashmap = new HashMap();
hashmap.put("action", "ObjProps");
ObjectReference objectreference = ObjectReference.newObjectReference(aWTDocument);
ReferenceFactory referencefactory = new ReferenceFactory();
hashmap.put("oid", referencefactory.getReferenceString(objectreference));
wt.httpgw.URLFactory urlfactory = new wt.httpgw.URLFactory();

url=GatewayServletHelper.buildAuthenticatedHREF(urlfactory,"wt.enterprise.URLProcessor", "URLTemplateAction", null, hashmap);

nice!

You can use appropriate property to avoid hardcore server defenition:

WTProperties wtprops = WTProperties.getLocalProperties();

String wtInstance = wtprops.getProperty("java.rmi.server.hostname");


So, whatever one may say there are always a lot of possible solutions.

Hello, sorry for my english. I currentrly implementing a method that will be retrieve URL-file from Windchill that contains link to latest iteration of current revision.

This URL-files will be placed to other PLM system or can be shared to our customers.

For example URL file

[{000214A0-0000-0000-C000-000000000046}]

Prop3=19,2

[InternetShortcut]

URL=http://wnc-server.com/Windchill/app/#ptc1/tcomp/infoPage?oid=VR%3Awt.epm.EPMDocument%3A2849745&u8=1

IDList=

Permanent part of link

a) http://wnc-server.com/Windchill/app/#ptc1/tcomp/infoPage?oid=VR%3Awt.epm.EPMDocument%3A

b) &u8=1

And in the middle we have ID of WNC object in form XXXXXXX that will be ID of EPMdocument in Windchill


I need to create action from menu on the EPMDocument page, that should run some java code and create url file.

I think i should create servlet that will be:

a) Get EPMDocument ID

b) Create URL-file with link

c) Download URL-file to user

Top Tags