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

How to pass an object for an Info Engine task in the Info Engine Task Editor?

SOLVED
Visitor

How to pass an object for an Info Engine task in the Info Engine Task Editor?

I want to create a WTPart object using the Info Engine Task Editor.

It is asking me to pass an object as a parameter.

Please tell me how to pass an object in the objects field shown in the below snapshot.

submit.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

I have invoked it from Info*Engine task. Check the following.

----------------------------------------------------------------------------------

<?xml version="1.0" standalone="yes"?>
<%@page access="http"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>
<%@page import="com.infoengine.object.factory.Att"%>
<%@page import="com.infoengine.object.factory.Element"%>
<%@page import="com.infoengine.object.factory.Group"%>

<%
try{

Task task = new Task();

task.setTaskURI("com/ptc/windchill/ws/create.xml");
task.addParam("INSTANCE", "com.ptc.Windchill");
task.addParam("supporting-adapter", "com.ptc.Windchill");

Element element = new Element();
element.setFti("wt.part.WTPart");
Att att1 = new Att("name");
att1.setValue("Part_created_from_InfoEngine12333");

Att att2 = new Att("number");
att2.setValue("IS100012333");
element.addAtt(att1);
element.addAtt(att2);

Group grp = new Group("objects");
grp.addElement(element);

task.addGroup(grp);

task.invoke();
}catch (IEException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

System.out.println("End");

%>

View solution in original post

15 REPLIES 15

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

Can you show IE task? Also detailed error message?

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

IE Task

<?xml version="1.0" standalone="yes"?>

<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>

<!--com.infoengine.soap.rpc.def

Create one or more new business objects and store them in the database.

@param com.ptc.windchill.ws.GenericBusinessObject[] objects The objects to create

@return com.ptc.windchill.ws.GenericBusinessObject[] ${output[*]} The created objects

<ie:webject name="Create-Objects" type="ACT">

<ie:param name="instance" data="${@FORM[]supporting-adapter[*]}"

valueSeparator=";" delim=";"/>

<ie:param name="group_in" data="objects"/>

<ie:param name="group_out" data="output"/>

</ie:webject>

Error Log

2015-05-14 18:29:05,282 INFO [RMI TCP Connection(3780)-127.0.0.1] wt.system.out - getProjectbySalescode

2015-05-14 18:29:05,282 INFO [RMI TCP Connection(3780)-127.0.0.1] wt.system.out - Start

2015-05-14 18:29:05,283 INFO [RMI TCP Connection(3780)-127.0.0.1] wt.system.out - 1

2015-05-14 18:29:05,283 INFO [RMI TCP Connection(3780)-127.0.0.1] wt.system.out - 2

2015-05-14 18:29:05,283 INFO [RMI TCP Connection(3780)-127.0.0.1] wt.system.out - End

2015-05-14 18:29:05,291 ERROR [RMI TCP Connection(3780)-127.0.0.1] wt.adapter.exception - WTAdapterImpl

(wt.adapter.adapterResource/8) wt.util.WTException: The required webject parameter "FIELD" was not provided.

at com.ptc.core.adapter.server.impl.CreateObjectsWebjectDelegate.invoke(CreateObjectsWebjectDelegate.java:133)

at com.ptc.core.adapter.server.impl.WebjectDelegateFactory.invokeDelegate(WebjectDelegateFactory.java:434)

at sun.reflect.GeneratedMethodAccessor233.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at wt.method.WTAdapterImpl.processWebject(WTAdapterImpl.java:772)

at wt.method.WTAdapterImpl.processRequest(WTAdapterImpl.java:479)

at com.infoengine.procunit.adapter.Adapter.send(Adapter.java:198)

at com.infoengine.SAK.ObjectWebject.invoke(ObjectWebject.java:262)

at com.infoengine.compiledTasks.file.D$3a$5cptc$5cWindchill_10$2e2$5cWindchill$5ctasks.com.ptc.windchill.ws.create$2exml.invoke(create$2exml.java:83)

at com.infoengine.SAK.Task.invoke(Task.java:1806)

at com.infoengine.SAK.Task.invoke(Task.java:1714)

at com.philips.qcm.test.r.RMITest.setAttributes(RMITest.java:71)

at com.philips.qcm.test.r.RMITest.setAdminAccess(RMITest.java:137)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at wt.method.MethodResultWriter.writeExternal(MethodResultWriter.java:152)

at wt.method.MethodResult.writeExternal(MethodResult.java:226)

at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1455)

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)

at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:293)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:332)

at sun.rmi.transport.Transport$1.run(Transport.java:177)

at sun.rmi.transport.Transport$1.run(Transport.java:174)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:173)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)

2015-05-14 18:29:05,293 ERROR [RMI TCP Connection(3780)-127.0.0.1] com.philips.qcm.test.r.RMITest - com.infoengine.util.IEException: The required webject parameter "FIELD" was not provided. Nested exception is:

(wt.adapter.adapterResource/8) wt.util.WTException: The required webject parameter "FIELD" was not provided.

2015-05-14 18:29:07,296 ERROR [RMI TCP Connection(3780)-127.0.0.1] wt.method.MethodContextMonitor.contexts.rmi - 2015-05-14 18:29:05.280 +0530, 31d7rw;i9o6n7x0;4216;favso8;1, -, -, -, -, 127.0.0.1, com.philips.qcm.test.r.RMITest, setAdminAccess, , 0, 0, 3.1666E-4, 0, 0.0, 0.0156001, 2.016494624

wt.util.WTException: Failed to invoke task: com/ptc/windchill/ws/create.xml

at com.philips.qcm.test.r.RMITest.setAttributes(RMITest.java:99)

at com.philips.qcm.test.r.RMITest.setAdminAccess(RMITest.java:137)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:606)

at wt.method.MethodResultWriter.writeExternal(MethodResultWriter.java:152)

at wt.method.MethodResult.writeExternal(MethodResult.java:226)

at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1455)

at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1429)

at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1177)

at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:347)

at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:293)

at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:332)

at sun.rmi.transport.Transport$1.run(Transport.java:177)

at sun.rmi.transport.Transport$1.run(Transport.java:174)

at java.security.AccessController.doPrivileged(Native Method)

at sun.rmi.transport.Transport.serviceCall(Transport.java:173)

at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)

at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

at java.lang.Thread.run(Thread.java:745)

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

Your IE task seems incomplete to create an object. Check following webject example and modify for your requirement. "file" is a parameter needed for document name.

<ie:webject name="Query-Objects" type="OBJ">

<ie:param name="INSTANCE" data="$(@FORM[]supporting-adapter[*])" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>

<ie:param name="GROUP_OUT" data="container"/>

<ie:param name="TYPE" data="wt.inf.container.WTContainer"/>

<ie:param name="WHERE" data="name=GOLF_CART"/>

<ie:param name="SESSION_ID" data="$(session[]session_id[])"/>

<ie:param name="BLOB_COUNT" data="0"/>

<ie:param name="ATTRIBUTE" data="*"/>

</ie:webject>

<ie:webject name="Create-Objects" type="ACT">

<ie:param name="INSTANCE" data="$(@FORM[]supporting-adapter[*])" delim="!" valueSeparator="!" default="<%=com.infoengine.au.NamingService.getVMName()%>"/>

<ie:param name="ATTRIBUTE" data="name"/>

<ie:param name="ATTRIBUTE" data=""/>

<ie:param name="TYPE" data="wt.doc.WTDocument"/>

<ie:param name="SESSION_ID" data="$(session[]session_id[])"/>

<ie:param name="BLOB_COUNT" data="0"/>

<ie:param name="CONTAINER_REF" data="$(container[]obid[])"/>

<ie:param name="FIELD" data="name=$(@FORM[]file[])"/>

<ie:param name="GROUP_OUT" data="document"/>

</ie:webject>

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

Basically, when creating a single object using IE task, this webject is typically called with the TYPE and FIELD parameters. The error in the logs also talks about these parameters.

You can set required attributes using FIELD parameter and the object type using the Type parameter. Following additions can help in executing your task. But the object will get created under SITE as there is no context information provided, you can refer to the example as mentioned by Yogesh to set the container.

<ie:param name="FIELD" data="number='PartNumber'"/>

<ie:param name="FIELD" data="name='PartName'"/>

<ie:param name="TYPE" data="wt.part.WTPart"/>

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

Ajay,

The IE task that you are using is meant to be invoked as a web service. Either invoke it as a web service or from another IE task. It may not be possible to pass object as input while using IE Task editor.

-Ismail

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?


I want to invoke the IEtask through java code.

Below is the code snippet for which I am getting the error mentioned in log.

Task task = new Task();

System.out.println("Start");

task.setTaskURI("com/ptc/windchill/ws/create.xml");

task.addParam("INSTANCE", "com.cts.wccoe.Windchill");

task.addParam("supporting-adapter", "com.cts.wccoe.Windchill");

task.addParam("FIELD","name='C-3102'");

task.addParam("FIELD","number='3102'");

task.addParam("FIELD","containerReference='OR:wt.pdmlink.PDMLinkProduct:116778'");

task.addParam("FIELD","typeIdentifier='wt.part.WTPart'");

task.addParam("TYPE","wt.part.WTPart");

System.out.println("End");

task.invoke();

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

Hi Ismail,

I want to invoke the IE task through java code.

So, I want to pass that object via Java code.

The code snippet is as followed:

Task task = new Task();

System.out.println("Start");

task.setTaskURI("com/ptc/windchill/ws/create.xml");

task.addParam("INSTANCE", "com.cts.wccoe.Windchill");

task.addParam("supporting-adapter", "com.cts.wccoe.Windchill");

task.addParam("FIELD","name='C-3102'");

task.addParam("FIELD","number='3102'");

task.addParam("FIELD","containerReference='OR:wt.pdmlink.PDMLinkProduct:116778'");

task.addParam("FIELD","typeIdentifier='wt.part.WTPart'");

task.addParam("TYPE","wt.part.WTPart");

System.out.println("End");

task.invoke();

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

Hi Yogesh,

The IE Task is complete as it is provided by PTC.

Re: How to pass an object for an Info Engine task in the Info Engine Task Editor?

Ajay,

Try the following code.

------------------------------

try{

Task task = new Task();

task.setTaskURI("com/ptc/windchill/ws/create.xml");
task.addParam("INSTANCE", "com.cts.wccoe.Windchill");
task.addParam("supporting-adapter", "com.cts.wccoe.Windchill");

Element element = new Element();
element.setFti("wt.part.WTPart");
Att att1 = new Att("name");
att1.setValue("Part_created_from_InfoEngine");

Att att2 = new Att("number");
att2.setValue("IS100012333");
element.addAtt(att1);
element.addAtt(att2);

Group grp = new Group("objects");
grp.addElement(element);

task.addGroup(grp);

task.invoke();
}catch (IEException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}

Announcements
LiveWorx Call For Papers Happening Now!