SC: A guide to creating a Request via SOAP Web Services

book

Article ID: 144672

calendar_today

Updated On:

Products

CA Service Management - Asset Portfolio Management CA Service Management - Service Desk Manager CA Service Catalog

Issue/Introduction

Using Web Services functionality, it is possible to create a Catalog Request via Web Services.  This tech doc discusses the basics behind creating such a request.

The running example will create a Request that has a status of "Not Submitted", and will be to apply for new Business Cards, using the out-of-box Business Card offering. 

We will be using SoapUI to demonstrate the given method.  

Environment

Release : 14.1 and higher

Component : CA SERVICE CATALOG

Resolution

1.  Create a new Web Services Project in SoapUI 

2.  Import the following WSDL into the SoapUI Project:

http://CATALOG-SERVER:8080/usm/services/RequestService?wsdl

3.  The WSDL and its methods will populate:



4.  Scroll down to access the method "login" and open a new Request for that method



5.  On the right hand side, enter the userid, password, and business unit to access Catalog.  The spadmin login may be used.
Once the credentials are entered, click the green icon to execute.



6.  A response will return with a "logInReturn" string.  Copy this string.  This is your session ID which you will need. 



7.  Scroll up to access the method "addRequestWithForm" and open a new Request for that method.



8.  In the given method, enter the code block that is contained in the attached txt file.  Make sure the session ID entry is modified with the value obtained in step 5 and 6.  Once the code has been entered, click the green icon to execute.:



9.  A response will return.  It will contain the details for the given Request created.  The request ID listed will be provided at the bottom



10.  Going into the Web UI and accessing the Request list, we find the given Request has been created.

Additional Information

Breaking down the method "addRequestWithForm", this method consists of following activities- 1) Creates a new request. 2) Subscribes a list of request items for this request. 3) Update request form with new item values.

The Java Web Services method call is:  

addRequestWithForm(String sessionID, String requestData, String requestValuesData, String requestValuesDataType, String addedOfferings, String addedItems, String formValuesData) 

All parameters are required, but certain parameters may be left blank:

sessionID:  Security handle for calling webservices.  This value is derived from running the "login" method and is the return value one sees under "logInReturn".


requestData:  List of system name:value pairs from this list:
request_id
name
req_by_user_id
req_for_account_id
req_for_user_id
priority
desired_date
comments

For adding a new request request_id must not be specified alongside the following mandatory fields:
name
req_by_user_id
req_for_account_id OR req_for_user_id

Example from the attached xml code sample:
name:Web Service Test Request!req_by_user_id:spadmin!req_for_user_id:spadmin!priority:3

This will create a request whose name will read as "Web Service Test Request", was requested by user id "spadmin", was requested for user id "spadmin" and is a Priority 3 (Medium)


requestValuesData:  List of extended name:value pairs from this list:
ship_to_address1
ship_to_address2
ship_to_city
ship_to_state
ship_to_country
ship_to_postal
gl_code
cost_center
authorization_number
project

All extended fields should be passed as name:value pairs using this parameter. This is not a mandatory parameter and can be left empty. 

Example from the attached xml code sample:
project:TestWebServicesCall

This is a value that is provided under "Additional Information" for the given offering.  One can view all of the request value data assigned to a given request by examining table "usm_request_value" in SQL Server

Select * from usm_request_value where request_id = <Service Catalog Request>


requestValuesDataType:  Data type mapping to the list of name:value pairs for parameter requestValuesData. If left empty, all associated data is stored in the database as string values. This is not a mandatory parameter and can be left empty.

Example from the attached xml code sample:  
Entry was intentionally left blank.


addedOfferings:  List of offerings to subscribe. All default selections for an offering will be automatically selected to be subscribed. This is not a mandatory parameter and can be left empty. 

Example from the attached xml code sample:  
Entry was intentionally left blank.


addedItems:  List of rate items to subscribe. Rate Items information in the form of offering_id, rate_plan_id and rate item_id must be passed. For rate items that include a user-specified amount as text_5 and/or quantity could be passed to override the default user-specified amount and quantity. This is not a mandatory parameter and can be left empty.

Example from the attached xml code sample:  
offering_id:10017

This offering_id can be obtained by one of two methods:

Method 1:  From tech article:  https://ca-broadcom.wolkenservicedesk.com/external/article?articleId=10278

Run this SQL Command on an existing Catalog ticket that was created previously on the Web UI which has the offering of interest

SELECT offering_id FROM usm_subscription_detail WHERE id IN
(SELECT subscription_detail_id FROM usm_request_status WHERE request_id = <request_id>)

Method 2:  If you know the name of your offering, you can obtain the offering id using this SQL Command:

SELECT offering_id, offering_name FROM usm_offering where offering_name = <Name of the offering>

The above offering_id of "10017" corresponds to the OOB offering to request new Business Cards.  It was selected in this case to provide a simplified demonstration to create a basic Catalog request.


formValuesData:  List of request form item values to be updated. 

Example from the attached xml code sample:  
offering_id:10017

Best Practice when trying to develop your web services code is to look at an existing Catalog request that has all of the elements you are interested in and examining at the DB level what values are needed to re-create the same Catalog Request in Web Services.

Attachments

1581091070841__attach-xml-code.txt get_app