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

how to use ApplyService in com.ptc.windchill.ws

how to use ApplyService in com.ptc.windchill.ws

I use the SOAP api with Windchill 10.0 to create a custom interface and do some automated stuff.

I can do queries now and a navigation through the folders. But now I want to do changes to the lifecycle state of an object. My understanding is that I need to use ApplyService for that. But if I try that, it only gives me an Internal Server Error which is a NullPointer exception in the shell on the Windchill server.

If someone could give me a working example of ApplyService or, even better, something to set a new lifecycle state, that would be really helpfull for me.

Thanks in advance,

martin

7 REPLIES 7

Re: how to use ApplyService in com.ptc.windchill.ws

something like this...

<ie:webject name="Apply-Service" type="OBJ">
<ieSmiley Tonguearam name="instance" data="${@FORM[]supporting-adapter[*]}" valueSeparator=";" delim=";" default="windchill" />
<ieSmiley Tonguearam name="SERVICE" data="wt.lifecycle.LifeCycleHelper"/>
<ieSmiley Tonguearam name="METHOD" data="setLifeCycleState"/>
<ieSmiley Tonguearam name="STATIC" data="false"/>
<ieSmiley Tonguearam name="GROUP_IN" data="args"/>
<ieSmiley Tonguearam name="ARG" data="wt.lifecycle.LifeCycleManaged='${@FORM[]dca_object_ref[]}'"/>
<ieSmiley Tonguearam name="ARG" data="wt.lifecycle.State=STATE"/>
<ieSmiley Tonguearam name="ARG" data="boolean='false'"/>
<ieSmiley Tonguearam name="group_out" data="${@FORM[]group_out[]}" default="output"/>
</ie:webject>

Re: how to use ApplyService in com.ptc.windchill.ws

After a few tries and modifications I get now only an error message:

java.lang.NoSuchMethodException: wt.lifecycle.State.(java.lang.String)

How can I get a state value in there?

Re: how to use ApplyService in com.ptc.windchill.ws

Can you send me the modifed webject. Looks like some type cast issue. I would look at api and try to match the argument appropriately.

Look at Windchill/wt/clients/library/api/index.html - wt.lifecycle

State, LifeCycleHelper

WTList setLIfeCycleState (WTList, State, boolean /*terminateAssocProcesses*/)

  • This API allows you to set the state on all objects in the list to the specified state. If the boolean is set to true, all associated workflow processes will be terminated. It is the responsibility of the calling API to ensure all objects in the list have the specified state in their life cycle template.


Code Example: You want to reassign a group of objects to a particular template to a particular state. In this example, you have a query result of the life cycle managed objects you want to reassign.

WTList list = new WTArrayList(results.size()/.75+1);

while (results.hasMoreElements()) {

list.add((LifeCycleManaged)results.nextElement())

}

LifeCycleTemplateReference lctr=LifeCycleHelper.service. getLifeCycleTemplateReference( name, container );

State released=State.toState(“RELEASED”);

LifeCycleHelper.service.reassign(list, lctr, container, released);

Re: how to use ApplyService in com.ptc.windchill.ws

it looks like this now:

<?xml version="1.0" standalone="yes"?>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>
<!--com.infoengine.soap.rpc.def
Sets a new lifecycle state.
@param com.ptc.windchill.ws.GenericBusinessObject ufid
@param wt.lifecycle.State STATE The new lifecycle state
@return com.ptc.windchill.ws.GenericBusinessObject ${output[]} The updated object
-->
<ie:webject name="Apply-Service" type="ACT">
<ieSmiley Tonguearam name="INSTANCE" data="${@FORM[]supporting-adapter[*]}" valueSeparator=";" delim=";"/>
<ieSmiley Tonguearam name="SERVICE" data="wt.lifecycle.LifeCycleServerHelper"/>
<ieSmiley Tonguearam name="METHOD" data="setState"/>
<ieSmiley Tonguearam name="STATIC" data="false"/>
<ieSmiley Tonguearam name="object_ref" data="${@FORM[]ufid[]}"/>
<ieSmiley Tonguearam name="ARG" data="wt.lifecycle.LifeCycleManaged='${@FORM[]ufid[]}'"/>
<ieSmiley Tonguearam name="ARG" data="wt.lifecycle.State='STATE'"/>
<ieSmiley Tonguearam name="ARG" data="'false'"/>
<ieSmiley Tonguearam name="group_out" data="${@FORM[]group_out[]}" default="output"/>
</ie:webject>

Re: how to use ApplyService in com.ptc.windchill.ws

I found another method to do this. I am using a Info*Engine JSP Page now (Info*Engine User's Guide) (attached to this post). There is no error handling or computer readable output yet, but it works

The ApplyService thing doesn't work yet, so I leave this as unanswered.

Re: how to use ApplyService in com.ptc.windchill.ws

I wouldn't use the webject library for this. It's overkill for your needs. The APIs you have work fine. BTW you don't need to instantiate the LifeCycleHelper. Just call LifeCycleHelper.service.setLifeCycleState(......)

Re: how to use ApplyService in com.ptc.windchill.ws

Hi,

I want to integrate thingworx with windchill for that I want to write a info*engine task to create meeting in windchill. canu you help me out..?

regards,

madhu