Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

CPQ UI Web Services

Two CPQ UI web services are delivered in the standard package:

The Configurator Web Service provides the following operations:

  • runUI with a runUIRequest as input parameter
  • runUIResponse as output parameter: this operation initializes the ConfiguratorUI component from input settings and returns the URL of the component runtime.

The Catalog Web Service provides the following operations:

  • catalogUI with a catalogUIRequest as input parameter
  • catalogUIResponse as output parameter: this operation initializes the catalogUI component from input settings and returns the URL of the component runtime.

Overview – Example for the Configurator WS

The stub (client side) program calls the skeleton (server) using SOAP protocol over HTTP. The request contains all the settings that are required to initialize the configuratorUI component. The skeleton stores these settings into its context. The response contains the URL of the component home page (an URL parameter references the identifier of the settings). When client application will visit this URL, the configuratorUI will get the settings from the context and use them to initialize itself.



Client Side – Procedure

Here is a step by step procedure to develop your own client program calling the ConfiguratorUI:

  1. Generate stub from WSDL file.

Here is a sample ANT task calling the AXIS method producing stub java classes.

Example:

<java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">

<classpath refid="axis2.classpath" />

<arg value="-d" />

<arg value="adb" />

<arg value="-wv" />

<arg value="1.1" />

<arg value="-uri" />

<arg file="${ws.wsdl.uri}" />

<arg value="-s" />

<arg value="-g" />

<arg value="-u" />

<arg value="-sd" />

<arg value="--output" />

<arg file="${project.generate}" />

<arg value="-p" />

<arg value="${ws.target.package}" />

<arg value="--namespace2package" />

<arg value="${ws.namespace2package}" />

<arg value="-or" />

</java>

Where

  • ws.wsdl.uri is the path to the wsdl file of the web service :

    /jboss-4.2.0.GA/server/cameleon/deploy/ cameleon.ear/configuratorUI.war/WEB-

    INF/services/configuratorUI/ META-INF/configuratorUI.wsdl

  • ws.target.package is the name of the java package used for generated classes: com.cameleon.configuratorui.connector
  • project.generate is the name of the directory where classes will be created: generate
  • ws.namespace2package is the namespace of the web service:

http://www.access-commerce.com/cameleonWS/configuratorUI/=com.cameleon.configuratorui.conn ector.type

The following files are generated:

  • generate/src/com/cameleon/configuratorui/connector/ ConfiguratorUI.java
  • generate/src/com/cameleon/configuratorui/connector/ ConfiguratorUIStub.java
  • generate/src/com/cameleon/configuratorui/connector/type/ ExtensionMapper.java
  • generate/src/com/cameleon/configuratorui/connector/type/ RunUIRequest.java
  • generate/src/com/cameleon/configuratorui/connector/type/ RunUIResponse.java
    1. Integrate these classes into your own project.
    2. Add a class that uses the stub classes to call the configuratorUI Web service.

      Example:

      package com.cameleon.configuratorui.connector;

      import java.io.BufferedReader;

      import java.io.File;

      import java.io.FileReader;

      import java.io.IOException;

      import java.rmi.RemoteException;

      import com.cameleon.configuratorui.connector.type.RunUIRequest;

      import com.cameleon.configuratorui.connector.type.RunUIResponse;

      /**

      * Sample code used to call the configuratorUI component

      * @author reg

      *

      */

      public class ConfiguratorUIClient {

      /**

      * Main method

      * @return url of the initialized configuratorUI runtime application

      */

      public static String run()

      {

      try

      {

      ConfiguratorUIStub stub= new ConfiguratorUIStub("http://127.0.0.1:8080/configuratorUI/services/

      configuratorUI?wsdl");

      RunUIRequest req=new RunUIRequest();

      req.setXmlConfiguration(getFileContent("C:\\configuration.xml"));

      req.setXmlLayout(getFileContent("C:\\configuratorUI.xml"));

      req.setSavedConfigurationURI("C:\\configuration-saved.xml");

      req.setRedirectErrorPage("http://127.0.0.1:8080/

      configuratorUI/customErrorPage.jsp");

      req.setExitURL("http://www.access-commerce.com");

      RunUIResponse resp=stub.runUI(req);

      return resp.getUrl();

      } catch (RemoteException e) {

      e.printStackTrace();

      return null;

      }

      }

      /**

      * Get the content of a file returned as a string

      * @param filePath path of the file

      * @return content of the file

      */

      private static String getFileContent(String filePath):

      {

      BufferedReader fileReader = null;

      File sessionFile = new File(filePath);

      StringBuffer content=new StringBuffer();

      try{

      fileReader = new BufferedReader(newFileReader(sessionFile));

      String line = fileReader.readLine();

      while (line != null) {

      content.append(line);

      line = fileReader.readLine();

      }

      }

      catch (IOException e) {

      e.printStackTrace();

      }

      finally {

      try {

      if (fileReader!=null)

      fileReader.close();

      }

      catch (IOException e) {

      e.printStackTrace();

      }

      }

      return content.toString();

      }

      }

    3. Create the client JSP Here is a very simple client JSP calling the Web service and redirecting towards the configuratorUI component.

      Example:

      <%@ page language="java"

      import="java.util.*,java.io.*,java.net.*,com.cameleon.configuratorui.connector.*" session="false" contentType="text/xml" %>:

      <jsp:useBean id="confWSClient" scope="application" class="com.cameleon.configuratorui.connector.ConfiguratorUIClient" />

      <%

      String url=confWSClient.run();

      response.sendRedirect(url);

      %>