Fetching Groups in the INFOENGINE_COLLECTION from the SOAP Request
The example below illustrates how the Groups can be fetched from INFOENGINE_COLLECTION
<%@page language="java" access="http|internal|soap" %>
<%@page import="java.util.Enumeration,com.infoengine.object.IeGroup,com.infoengine.object.IeCollection"%>
<%@taglib uri="http://www.ptc.com/infoengine/taglib/core" prefix="ie"%>


<%
String part_name = getParam("part_name").toString();
String product_name = getParam("product_name").toString();

System.out.println("***Basic PArams:: part_name="+part_name+", product_name="+product_name);

//All groups within the input collection are placed in the VDB so that they can be used by the task
//TECHNIQUE01: get all the groups in the VDB and print their names.
for ( Enumeration groups = getVdb().getGroups(); groups.hasMoreElements(); )
{
String grp_name=((IeGroup)groups.nextElement()).getName();
System.out.println("*******TECHNIQUE01 - grp_name=="+grp_name);
}

//TECHNIQUE02: The task author is expected to know the names of the groups.
//So here, query for the input group directly.

Group sourceGroup = getVdb ("Test_Group");
if(sourceGroup!=null){
System.out.println("***TECHNIQUE02 - Test_Group from INFOENGINE_COLLECTION found in VDB");
}else{
System.out.println("***TECHNIQUE02- VDB doesnt have a group called as Test_Group");
}
%>
<%
Group returnGroup = new Group("output");
Element row = new Element();
row.addAtt(new Att("result", new Boolean(true)));
returnGroup.addElement(row);
addGroup(returnGroup);
%>

<ie:webject name="Return-Groups" type="GRP">
<ie:param name="CLASS" data="class">
<ie:param name="group-in" type="output">
</ie:webject>
SOAP envelop request to fetch groups from INFOENGINE_COLLECTION:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="http://www.ptc.com/infoengine/soap/document/message/com.ptc.windchill.ws" xmlns:ins="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
<soapenv:Body>
<com:CreatePartWS>
<part_name>Test_Partpart_name>Test_Part>
<product_name>Golf_cartproduct_name>Golf_cart>
<colln ins:type="wc:INFOENGINE_COLLECTION">
<Name ins:type="string">Test_Coll</Name>
<Groups enc:arrayType="wc:ArrayOfINFOENGINE_GROUP">
<!--Zero or more repetitions:-->
<Group ins:type="wc:INFOENGINE_GROUP">
<Name ins:type="string">Test_Group</Name>
<Elements enc:arrayType="wc:ArrayOfINFOENGINE_ELEMENT">
<!--Zero or more repetitions:-->
<Element ins:type="wc:INFOENGINE_ELEMENT">
<!--Optional:-->
<Name ins:type="string">Ele_01</Name>
<Attributes enc:arrayType="wc:ArrayOfINFOENGINE_ATTRIBUTE">
<!--Zero or more repetitions:-->
<Attribute ins:type="wc:INFOENGINE_ATTRIBUTE">
<Name ins:type="string">MyAttr_01</Name>
<!--Optional:-->
<ContentType ins:type="string">text/html</ContentType>
<!--You have a CHOICE of the next 2 items at this level-->
<Value ins:type="string">Attr_val01</Value>
<Values ins:type="wc:ArrayOfINFOENGINE_VALUE">
<!--Zero or more repetitions:-->
<Value ins:type="string">Attr_val02</Value>
</Values>
<!--Optional:-->
<Meta/>
</Attribute>
</Attributes>
<!--Optional:-->
<Meta ins:type="wc:ArrayOfINFOENGINE_ATT">
<!--Zero or more repetitions:-->
<Attribute ins:type="wc:INFOENGINE_ATTRIBUTE">
<Name ins:type="string">MyElementMetaAttr_01</Name>
<!--Optional:-->
<ContentType ins:type="string">text/html</ContentType>
<!--You have a CHOICE of the next 2 items at this level-->
<Value ins:type="string">ElementMetaAttr_val01</Value>
<Values ins:type="wc:ArrayOfINFOENGINE_VALUE">
<!--Zero or more repetitions:-->
<Value ins:type="string">ElementMetaAttr_val02</Value>
</Values>
<!--Optional:-->
<Meta/>
</Attribute>
</Meta>
</Element>
</Elements>
<!--Optional:-->
<Meta ins:type="wc:ArrayOfINFOENGINE_ATT">
<!--Zero or more repetitions:-->
<Attribute ins:type="wc:INFOENGINE_ATTRIBUTE">
<Name ins:type="string">MyGrpMetaAttr_01</Name>
<!--Optional:-->
<ContentType ins:type="string">text/html</ContentType>
<!--You have a CHOICE of the next 2 items at this level-->
<Value ins:type="string">GrpMetaAttr_val01</Value>
<Values ins:type="wc:ArrayOfINFOENGINE_VALUE">
<!--Zero or more repetitions:-->
<Value ins:type="string">GrpMetaAttr_val02</Value>
</Values>
<!--Optional:-->
<Meta/>
</Attribute>
</Meta>
</Group>
</Groups>
<!--Optional:-->
<Meta ins:type="wc:ArrayOfINFOENGINE_ATT">
<!--Zero or more repetitions:-->
<Attribute ins:type="wc:INFOENGINE_ATTRIBUTE">
<Name ins:type="string">MyCollnMetaAttr_01</Name>
<!--Optional:-->
<ContentType ins:type="string">text/html</ContentType>
<!--You have a CHOICE of the next 2 items at this level-->
<Value ins:type="string">CollnMetaAttr_val01</Value>
<Values ins:type="wc:ArrayOfINFOENGINE_VALUE"</Values>
<!--Zero or more repetitions:-->
<Value ins:type="string">CollnMetaAttr_val02</Value>
</Values>
<!--Optional:-->
<Meta/>
</Attribute>
</Meta>
</colln>
</com:CreatePartWS>
</soapenv:Body>
</soapenv:Envelope>
¿Fue esto útil?