CreateAttachment method in SOAPUI demo
search cancel

CreateAttachment method in SOAPUI demo

book

Article ID: 35373

calendar_today

Updated On:

Products

CA Service Desk Manager CA Service Management - Service Desk Manager

Issue/Introduction

This document explains how you can access CA Service Desk Manager WebService and how to test WebService Method CreateAttachment Using SOAPUI.

Environment

CA Service desk Manager 17.4 and above
SOAP CXF Web Services

Resolution

Step 1 : Download and Install SOAP UI 

Step 2 : Launch SOAP UI

  1. Go to File-> New SOAP Project
  2. # Project Name: Provide an appropriate project Name    EX: CA SDM
  3. # Initial  WSDL: Provide correct CA SDM Webservice Path
    Example :  http://SDM-SERVER:8080/cxf/services/USD_WebService?wsdl
  4. You should be able to find all the available web Service Methods.

The "fileData" attribute will be pre-populated and is part of the MTOM specifications for createAttachments via CXF based web services.  
Please see CXF Web Service "createAttachment" method show a new attribute "fileData"

Step 3: Select “Login”  Method, this is used to create Session ID

  1. Expand “login”->Request 1->
  2. Right Click and select “Show Request Editor”
  3. Provide Appropriate Service Desk Credentials which have access to webservice Methods, Prefer Servicedesk  account.
            <username>ServiceDesk</username>
             <password>SDM-Password</password>
  4. Submit the request to Generate the Session Code.  Ex: 1839507538

Step 4: Select “CreateAttachment” method to add an attachment to Any Given Ticket.

  1. Expand “CreateAttachment”->Request 1->
  2. Right Click and select “Show Request Editor”
  3. Provide the below details:

    <sid></sid>
       -> Provide correct Session Ex: 1843959984

    <repositoryHandle> </repositoryHandle>  -> This is Repository Handle persid value.  A common value found across most SDM implementations is "doc_rep:1002"  for ServiceDesk Attachment folder.  An easy way to obtain the persid value for the repository is to run the following from an Admin Command prompt on the SDM Server: 
    pdm_extract -f "Select persid, description from Document_Repository"

    You will get an output such as this.  Persid value highlighted.
    TABLE Document_Repository
          persid description
          { "doc_rep:1000" ,"Default Images Repository" }
          { "doc_rep:1001" ,"Default Knowledge Repository" }
          { "doc_rep:1002" ,"Default Service Desk Repository" }


    <objectHandle> </objectHandle>- > This is Persid of a Ticket, cr:400103 in this scenario
    An easy way to obtain this value, based on the ticket number or ref_num is to run the following from an Admin Command prompt on the SDM Server: 
    pdm_extract -f "Select persid, ref_num, active_flag, type from Call_Req where ref_num = 'XX'"

    Example output for ticket 28.  Persid value highlighted
    C:\>pdm_extract -f "Select persid, ref_num, active_flag, type from Call_Req where ref_num = '28'"
    TABLE Call_Req
          persid ref_num active_flag type
          { "cr:400103" ,"28" ,"1" ,"I" }

    <description></description> -> Enter an appropriate  description.

     <fileName> </fileName> -> Provide the correct path of file attachment Ex: C:\test\sample.txt

Step 5:  Click on the "Attachments" tab, then the  + icon and select the file which need to be attached.

IMPORTANT:  The field under the "Part" column is accessible as a dropdown.  Select the numeral value designated under the "fileData" attribute that was pre-populated when generating the initial sample request

Step 6: Click on Submit Request Button to Execute “CreateAttachment “ Method.

attmnt:400001 , Implies an attachment with id 400001  been created and attached to request.

Additional Information

More details on the createAttachment web service method are found at: Web Services Attachment-Related Methods

See also SOAP Web Services Demo using SOAPUI

While Axis based web services lacks the "fileData" attribute for the createAttachment method, Axis Web Services is also deprecated for SDM 17.4 and is unsupported as of 17.4 RU5.