Testing Complex Object Code from the Terminal
Here are the steps for testing SOAPService's SaveContact method using the Terminal:
-
Open the Terminal in the namespace in which you are working.
-
Use the WSDL to regenerate a client for the service and then instantiate the client. See Testing the Service from the Terminal for the steps.
-
Enter the following commands to create a new instance of Contact and assign values to its Name and ContactType properties.
USER>Set contact = ##class(SOAPTutorial.Contact).%New() USER>Set contact.Name = "Doe,John" USER>Set contact.ContactType = "Business"
-
Enter the following command to invoke the SaveContact method, passing it the newly instantiated Contact object, and write the method's return value — the ID value of the new Contact instance. Note that the client variable represents the Web service client generated in the earlier step.
USER>Set client = ##class(SOAPService.SOAPServiceSoap).%New() USER>write client.SaveContact(contact) 6
-
Use the GetContact method added earlier to retrieve the contact using the ID returned by SaveContact.
USER>set contact = client.GetContact(6) USER>write contact.Name Doe,John