Call Web Service and Process Response

Use your preferred development tool to call the web service, then process the response.

Call Web Service

  1. Use a URL in a browser, Soap UI, or some other development tool to call the web service.

    http://hostname:port/ctoUtilitiesPublicService/ConfiguredItemService
  2. Choose findCtoItemStructure, findCtoSalesStructure, refreshConfigStructure or deleteConfigStructure from the list of operations.

  3. Enter your payload.

  4. Click Invoke.

Process the Response

Use different techniques to process the response.

Use SQL

  1. Use a proxy to call the web service.

  2. Store the response for each row of the response in a relational database table.

    You create two tables.

    • Table CTO_ITEM_STRUCTURE includes a column for each attribute in the response.

    • Table CTO_TRANSACTION_ATTR stores values for transaction attributes. It also includes foreign keys to CTO_ITEM_STRUCTURE according to the LINE_ID attribute.

    For example:

    You create two tables.
  3. Use SQL to query the table to get details about the response.

    SELECT * FROM CTO_ITEM_STRUCTURE WHERE <CONDITION>

Use Java and SQL

  1. Use a proxy to call the service.

  2. Convert each row of the response to XML.

    Here's an example of the Java code you use to convert.

    JAXBContext contextObj = JAXBContext.newInstance(new Class[] {
      CtoItemStructure.class
    });
    Marshaller marshallerObj = contextObj.createMarshaller();
    marshallerObj.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    JAXBElement < CtoItemStructure > rootElement = new JAXBElement < CtoItemStructure > (new QName("CtoItemStructureRow"), CtoItemStructure.class, opTempList.get(Index));
    marshallerObj.marshal(rootElement, baos);
    String xmlContent = new String(baos.toByteArray());
    ClobDomain objClobDomain = new ClobDomain(xmlContent);
    
  3. Store data in the CTO_ITEM_STRUCTURE table. Use this structure.

    Attribute Name

    Type

    Description

    CONFIG_ITEM_ID

    Long

    Value that identifies the configured item.

    ITEM_STRUCTURE

    Clob

    XML data of the row. This is the output of your Java code.

  4. Use SQL to query the table.

    For example:

    select CONFIG_ITEM_ID,
    extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /ConfigItemId ')CONFIG_ITEM_ID,
    extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /ConfigItemNumber ')CONFIG_ITEM_NUMBER, extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /BaseModelId ')BASE_MODEL_ID, extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /BaseModelItemNumber ')BASE_MODEL_ITEM_NUMBER, extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /InventoryItemId ') INVENTORY_ITEM_ID, extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /InventoryItemNumber ')INVENTORY_ITEM_NUMBER, extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /LineId ')LINE_ID,
    extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /ParentLineId ')PARENT_LINE_ID, extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /SubItemType ') SUB_ITEM_TYPE, extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /OptionalComponent') OPTIONAL_COMPONENT, extractvalue(ITEM_STRUCTURE,'/ CtoItemStructureRow /ComponentHierarchy ')COMPONENT_HEIRARCHY from CTO_ITEM_STRUCTURE where CONFIG_ITEM_ID =<CONFIGURED ITEM ID>

Format the Response

The XML output of the web service isn't indented or organized hierarchically according to parent-child relationships. Use an XSLT (Extensible Stylesheet Language Transformations) style sheet to format the web service response so you can visualize the hierarchy.

Here's some XSLT code you can use to format the response. Use this code with your favorite XML tool.

< xsl: stylesheet version = "1.0"
 xmlns: xsl = "http://www.w3.org/1999/XSL/Transform"
 xmlns: ns0 = "http://xmlns.oracle.com/apps/scm/cto/matchRepository/utilities/configItemStructureSer
 vice / types / "
 xmlns: ns2 = "http://xmlns.oracle.com/apps/scm/cto/matchRepository/utilities/configItemStructureSer vice/types/"
 xmlns: ns1 = "http://xmlns.oracle.com/apps/scm/cto/matchRepository/utilities/configItemStructureSer
 vice / "
 xmlns: env = "http://schemas.xmlsoap.org/soap/envelope/"
 xmlns: wsa = "http://www.w3.org/2005/08/addressing"
 xmlns: typ = "http://xmlns.oracle.com/apps/scm/cto/matchRepository/utilities/configItemStructureService/types/ " >
   <
   xsl: output method = "xml"
 indent = "yes"
 version = "1.0"
 encoding = "UTF-8" / >
   <
   xsl: template match = "*" >
   <
   xsl: element name = "{local-name()}" >
   <
   xsl: if test = "not(not(text()) and not(node()))" >
   <
   xsl: apply - templates select = " node()" / >
   <
   / xsl : if > <
   / xsl : element > <
   / xsl : template > <
   xsl: template match = "env:Envelope" >
   <
   xsl: apply - templates select = "env:Body" / >
   <
   / xsl : template > <
   xsl: template match = "env:Body" >
   <
   xsl: apply - templates select = " ns0:findCtoItemStructureResponse | ns0:findCtoItemStructureAsyncResponse " / >
   <
   / xsl : template > <
   xsl: template match = "ns0 ns0:findCtoItemStructureResponse | ns0:findCtoItemStructureAsyncResponse" >
   <
   xsl: copy >
   <
   xsl: apply - templates select = ".//ns2:result[not(ns1:ParentLineId/node())]" / >
   <
   / xsl : copy > <
   / xsl : template > <
   xsl: template match = "ns2:result" >
   <
   xsl: variable name = "LineId"
 select = "./ns1:LineId" / >
   <
   xsl: variable name = "OrganizationId"
 select = "./ns1:OrganizationId" / >
   <
   xsl: variable name = "InventoryItemId"
 select = "./ns1:InventoryItemId" / >
   <
   xsl: variable name = "ComponentItemHierarchy"
 select = "./ns1:ComponentItemHierarchy" /
   >
   <
   xsl: element name = "ns2:result" >

   <
   xsl: apply - templates select = "node()" / >
   <
   xsl: if test = "../ns2:result[(./ns1:ParentLineId = $LineId and ./ns1:OrganizationId =
 $OrganizationId and concat($ComponentItemHierarchy, '-', . / ns1: InventoryItemId) =
   . / ns1: ComponentItemHierarchy)]
 ">

 <
 xsl: apply - templates select = "../ns2:result[(./ns1:ParentLineId = $LineId and
   . / ns1: OrganizationId = $OrganizationId)]
 " /> <
 / xsl : if > <
 / xsl : element > <
 xsl: variable name = "nl"
 select = "'
'" / >
   <
   xsl: value - of select = "$nl"
 disable - output - escaping = "no" / >
   <
   / xsl : template > <
   / xsl : stylesheet >

Use this XSLT code only to format the output of the findCtoItemStructure operation.

As an alternative, here's some example code you can use to programmatically format the response.

String xml = "input.xml ; // input XML file location 
String xslt = "transformations.xsl"; // XSLT file location
String output = "formatted.xml"; //output XML file location 
  TransformerFactory tf = TransformerFactory.newInstance(); 
  Transformer tr = tf.newTransformer(new StreamSource(new File(xslt))); 
  tr.transform(new StreamSource(new File(xml)),