How to frame a webservice request to add a parent record, child record and establish a relationship between them using a single webservice call.

How to frame a webservice request to add a parent record, child record and establish a relationship between them using a single webservice call.

book

Article ID: KB0085685

calendar_today

Updated On:

Products Versions
TIBCO Collaborative Information Manager -
Not Applicable -

Description

Resolution:
Description:
============
How to frame a webservice request to add a parent record, child record and establish a relationship between them using a single webservice call.

Environment:
==========
TIBCO Product name and version: TIBCO Collaborative Information Manager 7.21.
Operating System(s): All Operating Systems

Symptoms:
========
N/A

Cause:
=====

N/A


Resolution:
========

Use the following transaction in the webservice request. The key is to have both the parent record and child record in separate MasterCatalogRecord nodes and specify forward and reverse relationships in the respective MasterCatalogRecord node.

&ltTransaction>
    &ltCommand type="Add">
        &ltMasterCatalogRecord etype="Entity" commandqualifier="Validate/Process">
                &ltExternalKeys>
                    &ltKey name="MASTERCATALOGNAME" type="string"&gtPARENT</Key>
                    &ltKey name="PRODUCTID" type="string"&gtp23</Key>
                    &ltKey name="PRODUCTIDEXT" type="string"&gtp23</Key>
                </ExternalKeys>
                &ltRelationshipData>
                    &ltRelationship>
                        &ltRelationType&gtCONTAINS</RelationType>
                            &ltRelatedEntities>
                                &ltMasterCatalogRecord etype = "Entity">
                                    &ltExternalKeys>
                                    &ltKey name = "MASTERCATALOGNAME"&gtCHILD</Key>
                                    &ltKey name = "PRODUCTID"&gtc23</Key>
                                    &ltKey name = "PRODUCTIDEXT"&gtc23</Key>
                                    </ExternalKeys>
                                    &ltEntityData>
                                    &ltAttribute name ="QUANTITY"&gt1</Attribute>
                                    </EntityData>
                                </MasterCatalogRecord>
                            </RelatedEntities>
                    </Relationship>
                </RelationshipData>
        </MasterCatalogRecord>
        &ltMasterCatalogRecord etype="Entity" commandqualifier="Validate/Process">
                &ltExternalKeys>
                    &ltKey name="MASTERCATALOGNAME" type="string"&gtCHILD</Key>
                    &ltKey name="PRODUCTID" type="string"&gtc23</Key>
                    &ltKey name="PRODUCTIDEXT" type="string"&gtc23</Key>
                 </ExternalKeys>
                &ltRelationshipData>
                    &ltRelationship>
                        &ltRelationType&gtCONTAINEDBY</RelationType>
                        &ltRelatedEntities>
                            &ltMasterCatalogRecord etype="Entity">
                                &ltExternalKeys>
                                    &ltKey name="MASTERCATALOGNAME" type="string"&gtPARENT</Key>
                                    &ltKey name="PRODUCTID" type="string"&gtp23</Key>
                                    &ltKey name="PRODUCTIDEXT" type="string"&gtp23</Key>
                                </ExternalKeys>
                                &ltEntityData>
                                    &ltAttribute name="QUANTITY" type="integer"&gt1</Attribute>
                                </EntityData>
                            </MasterCatalogRecord>
                        </RelatedEntities>
                    </Relationship>
                </RelationshipData>
        </MasterCatalogRecord>
    </Command>
</Transaction>

Attachments:
==========
N/A

References:
=========
N/A
  
Keywords/Tags:
=============
parent record child relationship single call

Issue/Introduction

How to frame a webservice request to add a parent record, child record and establish a relationship between them using a single webservice call.