docs.intersystems.com
Home  /  Application Development: Additional Options  /  Web Services Quick Start Tutorial  /  Publishing Web Services Using InterSystems IRIS  /  Testing the Service from Terminal


Web Services Quick Start Tutorial
Testing the Service from Terminal
[Back]  [Next] 
InterSystems: The power behind what matters   
Search:  


Using Terminal we can generate a client for the Web Service based on its WSDL. Open Terminal in any namespace and set a variable to the value of the url of the WSDL for the Web Service. Note that the port number for the for the url and the name of the namespace you use might differ from what is shown here:
USER>Set url="http://localhost:52773/csp/user/SOAPTutorial.SOAPService.cls?WSDL=1"
Create an instance of %SOAP.WSDL.Reader and use its Process method to generate a client for the service.
USER>Set reader=##class(%SOAP.WSDL.Reader).%New()
USER>Write reader.Process(url)
Compilation started on 01/12/2018 09:48:38 with qualifiers 'dk', compiling 2 classes, using 8 worker jobs
Compiling class SOAPService.PhoneNumber
Compiling class SOAPService.Contact
Compiling routine SOAPService.PhoneNumber.1
Compiling routine SOAPService.Contact.1
Compilation finished successfully in 0.296s.

Compilation started on 01/12/2018  09:48:38 with qualifiers 'dk'
Compiling class SOAPService.SOAPServiceSoap
Compiling routine SOAPService.SOAPServiceSoap.1
Compiling class SOAPService.SOAPServiceSoap.GetContact
Compiling class SOAPService.SOAPServiceSoap.Test
Compiling routine SOAPService.SOAPServiceSoap.GetContact.1
Compiling routine SOAPService.SOAPServiceSoap.Test.1
Compilation finished successfully in 0.641s.
1
Next, create an instance of the generated client and invoke its Test method. It should return “Test”.
USER>Set client=##class(SOAPService.SOAPServiceSoap).%New()
USER>Write client.Test()
Test
Finally, use the client to test the GetContact method, passing it “1”. This will return a Contact instance. You can access its Name and PhoneNumbers properties.
USER>Set contact=client.GetContact(1)
USER>Write contact.Name
Campos,Debby A.
USER>Write contact.PhoneNumbers.GetAt(1).Number
886-391-4821
Note:
In order for the GetContact method to return a contact, the sample application must be populated. See Creating and Populating the Application Model for instructions.