This topic explains how to establish the connection to the SOAP interface via the WSDL, and test several of the available requests. Ideally these tests should be performed on a 'clean' knowledgebase, prior to setting up complicating factors such as WS-Security. The instructions in this topic use SOAPUI as a reference point, but you can use another tool and adapt the instructions if you prefer.
|
DemoSoapBinding
, and select Show Interface Viewer. At this point, you can test the calls from SOAP to the knowledgebase. To test a call from the list:
<ParameterName>?</ParameterName>
- with the relevant values from the knowledgebaseFollow the example test cases below to test some of the available requests. Many of the examples below use the Support Cases table (WSCase
) to test the requests.
Add the following values to the EWLogin request:
<dem:EWLogin> <String_1>KBNAME</String_1> <String_2>admin</String_2> <String_3>admin_password</String_3> <String_4>en</String_4> </dem:EWLogin> |
Click Run. This returns something similar to the following response, which includes a session string between the <result>
tags:
<env:Envelope xmlns:env="https://schemas.xmlsoap.org/soap/envelope/"> <env:Header/> <env:Body> <demo:EWLoginResponse xmlns:demo="https://Demo.api.ws.enterprisewizard.com"> <result>78658161687694</result> </demo:EWLoginResponse> </env:Body> </env:Envelope> |
<message>[http-0.0.0.0-80-1][1618616486d] login/password combination admin/****** for knowledgebase KB1</message>
An error message similar to the following appears:
<ns1:EWPermissionException xmlns:ns1="https://api.ws.enterprisewizard.com" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"> <message>not allowed, please check logs</message> </ns1:EWPermissionException> |
Add the following values to the EWRead_WSCase
request and click Run:
<dem:EWRead_WSCase> <sessionId>SESSIONID_FROM_LOGIN_RESPONSE</sessionId> <recordID>0</recordID> </dem:EWRead_WSCase> |
<message>[http-0.0.0.0-80-6][1503916816216] no data found for 0</message>
In the Support Cases table, create a new record and assign it to the system user 'Ralph Knowles'; or if the user does not exist, assign them to another user and replace String_3 below with their name.
Add the following values to the EWSelectFromTable
request and click Run:
<dem:EWSelectFromTable> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> <String_2>case</String_2> <String_3>assigned_person='Ralph Knowles'</String_3> </dem:EWSelectFromTable> |
[DB_TABLE_NAME]
can be found in the Table Name field of the General tab of the Table wizard. Click Run.Add the following values to the EWSelectAndRead_WSCase
request and click Run:
<dem:EWSelectAndRead_WSCase> <sessionId>SESSIONID_FROM_LOGIN_RESPONSE</sessionId> <where>assigned_person='Ralph Knowles'</where> </dem:EWSelectAndRead_WSCase> |
<where>assigned_person='Ralph Knowles' and wfstate=1</where>
, and click Run.Open the EWCreate_WScase
request.
Remove all of the field tags apart from problem_Description
and summary
, and add the parameter values in this way, then click Run:
<dem:EWCreate_WSCase> <sessionId>SESSIONID_FROM_LOGIN_RESPONSE</sessionId> <WSCase> <problem_Description>Test ticket for SOAP</problem_Description> <summary>SOAP test create</summary> </WSCase> </dem:EWCreate_WSCase> |
<result>361</result>
.EWCreateAndRead_WSCase
request. Remove all of the field tags inside <WSCase>
apart from problem_Description
and summary
, and add the parameter values in this way, then click Run:
<dem:EWCreateAndRead_WSCase> <sessionId>SESSIONID_FROM_LOGIN_RESPONSE</sessionId> <WSCase> <problem_Description>Test ticket 2 for SOAP</problem_Description> <summary>SOAP test create and read</summary> </WSCase> </dem:EWCreateAndRead_WSCase> |
EWUpdate_WSCase
request.Remove all of the field tags apart from ID
and Priority
and add the parameter values in this way, then click Run:
<dem:EWUpdate_WSCase> <sessionId>SESSIONID_FROM_LOGIN_RESPONSE</sessionId> <WSCase> <id>RECORD_ID_FOR_UPDATE</id> <priority>OPTION_CRITICAL</priority> </WSCase> </dem:EWUpdate_WSCase> |
Add the following values to the EWDelete
request and click Run:
<dem:EWDelete> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> <String_2>case</String_2> <arrayOflong_3> <value>RECORD_ID_FOR_DELETE</value> </arrayOflong_3> <DeleteRule_4>APPLY_DELETE_WHERE_POSSIBLE</DeleteRule_4> <arrayOflong_5> </arrayOflong_5> </dem:EWDelete> |
<message>[http-0.0.0.0-80-5][1504006477104] Operation cannot be done. Not all records can be removed.</message>
Add the following values to the EWGetChoiceLineID
request and click Run:
<dem:EWGetChoiceLineId> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> <String_2>case</String_2> <String_3>priority</String_3> <String_4>Critical</String_4> </dem:EWGetChoiceLineId> |
Priority
choice list for the value Critical
. The response is a value like <result>6</result>
.<String_4>
value to a non-existent priority and click Run.<message>[http-0.0.0.0-80-4][1504007797277] No choice line found for value Defcon 6</message>
<String_3>
value to some non-choice field like 'summary' and click Run.<message>[http-0.0.0.0-80-4][1504007877613] unexpected exception: null</message>.
Create a txt file with the file name testfile
, and save it to a location on your system.
Add the following values to the EWAttachFromSOAPAttachment
request, replacing the <key>
value with an existing Support Case record number:
<dem:EWAttachFromSOAPAttachment> <sessionId>SESSIONID_FROM_LOGIN_RESPONSE</sessionId> <tableName>case</tableName> <key>419</key> <fieldName>downloadable_files</fieldName> <fileName>testfile.txt</fileName> </dem:EWAttachFromSOAPAttachment> |
filename.txt
file from your system. <result>1</result>
.<result>2</result>
.Add the following values to the EWRetrieveAttachedAsSOAPAttachment
request, replacing the <key>
value with the Support Case record number from the example above, then click Run:
<dem:EWRetrieveAttachedAsSOAPAttachment> <sessionId>SESSIONID_FROM_LOGIN_RESPONSE</sessionId> <tableName>case</tableName> <key>419</key> <fieldName>downloadable_files</fieldName> <filePosition>1</filePosition> </dem:EWRetrieveAttachedAsSOAPAttachment> |
<filePosition>
vaue to an incorrect attachment number like 80, then click Run.<message>[http-0.0.0.0-80-7][1504013330298] Blob field id in table case does not contain 81 files, but less (2) for key 419</message>
Add the following values to the EWRemoveAttached
request, replacing the <long>
value with the Support Case record number from the example above, then click Run:
<dem:EWRemoveAttached> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> <String_2>case</String_2> <long_3>419</long_3> <String_4>downloadable_files</String_4> <int_5>1</int_5> </dem:EWRemoveAttached> |
<result>1</result>
, with the number in the <result>
tag being the number of remaining attached files. Add the following values to the EWSearchTable
request, then click Run:
<dem:EWSearchTable> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> <String_2>case</String_2> <arrayOfString_3> <value>id</value> <value>summary</value> </arrayOfString_3> <String_4>Open Cases</String_4> </dem:EWSearchTable> |
<message>No search=Open Cas for table=WSCase</message>
.Add the following values to the EWSearchTablePaginated
request, then click Run:
<dem:EWSearchTablePaginated> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> <String_2>case</String_2> <arrayOfString_3> <value>id</value> <value>summary</value> </arrayOfString_3> <String_4>Open Cases</String_4> <int_5>0</int_5> <int_6>1</int_6> </dem:EWSearchTablePaginated> |
<int_6>
value to 2 (record count), then click Run.<int_5>
value to 1 (page number), then click Run.<int_value>
to 777, then click Run.<int_5>
to 0, and <int_6>
to 1000, then click Run.Add the following values to the EWSearchTableWithQuery
request, then click Run:
<dem:EWSearchTableWithQuery> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> <String_2>case</String_2> <arrayOfString_3> <value>id</value> <value>summary</value> <value>priority</value> </arrayOfString_3> <String_4>Open Cases</String_4> <String_5>priority='Low'</String_5> </dem:EWSearchTableWithQuery> |
<String_5>
to something like <String_5>priority='Low'&& summary~='How'</String_5>
, then click Run.<String_4>
to a non-existent value, then click Run.<message>No search=Cases for table=WSCase</message>
Add the following values to the EWSearchTableWIthQueryPaginated
request, then click Run:
<dem:EWSearchTableWithQueryPaginated> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> <String_2>case</String_2> <arrayOfString_3> <value>id</value> <value>summary</value> </arrayOfString_3> <String_4>Open Cases</String_4> <String_5>priority='Low'</String_5> <int_6>0</int_6> <int_7>1</int_7> </dem:EWSearchTableWithQueryPaginated> |
<int_7>
value to 2, to find the first two records, then click Run.<int_6>
value to 777 to find the first two records on the 777'th page of the table, then click Run.<int_6>
value to 0, and <int_7>
to 1000, then click Run.Add the following values to the EWLogout
request, then click Run:
<dem:EWLogout> <String_1>SESSIONID_FROM_LOGIN_RESPONSE</String_1> </dem:EWLogout> |
<message>[http-0.0.0.0-80-7][1504083695004] not logged in or this session has timed out</message>
HTTP Status 404 - /ewws/Demo/EWServiceAPIv2
.The following examples enables you to test the security of your SOAP application. Leave your instance of SOAPUI configured as above.
<faultstring>This service requires <wsse:Security>, which is missing.</faultstring>
.The response returns new timestamp data similar to the following:
<wsse:Security ...> <wsu:Timestamp wsu:Id="timestamp"> <wsu:Created>2016-10-12T13:54:35.482Z</wsu:Created> <wsu:Expires>2016-10-12T13:54:45.482Z</wsu:Expires> </wsu:Timestamp> </wsse:Security> |
<faultstring>This service requires <wsse:Security>, which is missing.</faultstring>.
Related articles |