How to set values for input list parameters for the webservice methods in XML Request for SOAP UI?

  • I want to test my webservice using SOAP UI tool. I've loaded the WSDL in SOAP UI and it generated the request as given below. I know how to set input values for simple type. But i do not know how to set the values in SOAP UI for two List input parameters for the webservice method. Please note i exposed this class as unauthenticated in force.com site.

    Action Url: http://gss-developer-edition.ap1.force.com/services/Soap/class/TestWebService

    Given below is the webservice class,

    global class TestWebService {
    webService static String getFirstSOBrief(List<CustomerDTO> c, List<ProductDTO> p)  
    {  
            System.debug('>>>>>>>>>>>>>>>>>>Customer List'+c);
            System.debug('&&&&&&&&&&&&&&&&&&Product List'+p);
            return c[0].CustomerNumber;  
    } 
    
    global class CustomerDTO {
        public String CustomerNumber {get;set;}
        public String Email {get;set;}
        public String FirstName {get;set;}
        public String LastName {get;set;}
    
        public CustomerDTO(String CustomerNumber,String FirstName, String LastName, String Email) {
            this.CustomerNumber = CustomerNumber;
            this.FirstName = FirstName;
            this.LastName = LastName;
            this.Email = Email;
        }
    }
    
    global class ProductDTO {
        public String MaterialNumber {get;set;}
        public String ProductName {get;set;}
    
        public ProductDTO(String MaterialNumber,String ProductName) {
            this.MaterialNumber = MaterialNumber;
            this.ProductName = ProductName;
        }
    }
    

    }

    SOAP UI request below,

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tes="http://soap.sforce.com/schemas/class/TestWebService">
     <soapenv:Body>
      <tes:getFirstSOBrief>
         <!--Zero or more repetitions:-->
         <tes:c/>
         <!--Zero or more repetitions:-->
         <tes:p/>
      </tes:getFirstSOBrief>
    

    Response:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/schemas/class/TestWebService" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    

    How to set values in the SOAP UI XML request for the List parameters List and LIst?

    Update

    Now i did as per the blog and got this error.

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tes="http://soap.sforce.com/schemas/class/TestWebService">
         <soapenv:Body>
          <tes:getFirstSOBrief>
             <!--Zero or more repetitions:-->
    
             <tes:c>
             <CustomerNumber>abcd</CustomerNumber>
             <Email>[email protected]</Email>
             <FirstName>fname</FirstName>
             <LastName>lname</LastName>
             </tes:c>
    
             <!--Zero or more repetitions:-->
             <tes:p/>
          </tes:getFirstSOBrief>
       </soapenv:Body>
    </soapenv:Envelope>
    

    Response:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    

    soapenv:Client There is no public member called 'CustomerNumber' in the Apex class 'CustomerDTO'

  • anmrk

    anmrk Correct answer

    7 years ago

    i have updated my question. I did as per the link you gave and got some errors.

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM