1

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>a@b.com</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'

3

Take a look at this, i think this is what you want. http://leonotepad.blogspot.com.br/2014/01/how-to-send-array-of-objects-using-soap.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.