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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

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

MartinKaistra
1-Visitor

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

something like this...

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

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?

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);

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">
<ie:param name="INSTANCE" data="${@FORM[]supporting-adapter[*]}" valueSeparator=";" delim=";"/>
<ie:param name="SERVICE" data="wt.lifecycle.LifeCycleServerHelper"/>
<ie:param name="METHOD" data="setState"/>
<ie:param name="STATIC" data="false"/>
<ie:param name="object_ref" data="${@FORM[]ufid[]}"/>
<ie:param name="ARG" data="wt.lifecycle.LifeCycleManaged='${@FORM[]ufid[]}'"/>
<ie:param name="ARG" data="wt.lifecycle.State='STATE'"/>
<ie:param name="ARG" data="'false'"/>
<ie:param name="group_out" data="${@FORM[]group_out[]}" default="output"/>
</ie:webject>

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.

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(......)

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

Announcements


Top Tags