docs.intersystems.com
Home / XML Tutorial / Web Services / Testing the Web Service Methods from Terminal


XML Tutorial
Testing the Web Service Methods from Terminal
Previous section          
InterSystems: The power behind what matters   
Search:  


We can test the Web service methods from terminal. To do this we will use its WSDL to generate a client. Here are the steps:
  1. Use the InterSystems launcher to open Terminal. You can use whichever namespace that you prefer.
  2. Create and instance of %SOAP.WSDL.Reader and use its Process method together with the WSDL url of the service to generate the client.
    USER>Set url="http://localhost:52773/csp/user/CInfo.WebService.CLS?WSDL=1"
     
    USER>Set reader = ##class(%SOAP.WSDL.Reader).%New()
     
    USER>Write reader.Process(url)
     
    Compilation started on 01/24/2018 16:27:02 with qualifiers 'dk'
    Compiling 2 classes, using 2 worker jobs
    Compiling class CompanyInfo.Address
    Compiling class CompanyInfo.Company
    Compiling routine CompanyInfo.Address.1
    Compiling routine CompanyInfo.Company.1
    Compilation finished successfully in 0.059s.
     
    Compilation started on 01/24/2018 16:27:02 with qualifiers 'dk'
    Compiling class CompanyInfo.CompanyInfoSoap
    Compiling routine CompanyInfo.CompanyInfoSoap.1
    Compiling class CompanyInfo.CompanyInfoSoap.CreateCompanies
    Compiling class CompanyInfo.CompanyInfoSoap.GetCompanyInfo
    Compiling routine CompanyInfo.CompanyInfoSoap.CreateCompanies.1
    Compiling routine CompanyInfo.CompanyInfoSoap.GetCompanyInfo.1
    Compilation finished successfully in 0.150s.
    1
    
  3. Create an instance of the client.
    USER>Set client = ##class(CompanyInfo.CompanyInfoSoap).%New()
    
  4. Execute the CreateCompanies method to populate InterSystems IRIS with Company instances.
    USER>Write client.CreateCompanies(1000)
    1000
    
  5. Next, test GetCompanyInfo. You must pass a valid ID of a company to the method. It is likely that “1” is valid.
    USER>Set company = client.GetCompanyInfo(1)
    USER>Write company.Name
    OptiTech LLC.
    USER>Write company.Mission
    Spearheading the next generation of nano-instrumentation technologies for the Fortune 50
    USER>Write company.PrimaryAddress.City
    Pueblo
    
Note:
This concludes this part of the tutorial. Click here to continue on to the next section.


Previous section          
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-03-25 09:52:17