Thursday, 11 October 2018

Calling multiple methods with same name using SoapClient

I have a SOAP webservice and in SOAP UI I see that there are methods with the same name. So, for example, there are 2 CreateNewContact methods, one of which takes 3 parameters and the other 4. Below are the stubs generated by SOAP UI

Method 1 Stub:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rfp="http://test.com/testWebservice/">
   <soapenv:Header/>
   <soapenv:Body>
      <rfp:CreateNewContact_FullName>
         <!--Optional:-->
         <rfp:fullName>?</rfp:fullName>
         <!--Optional:-->
         <rfp:email>?</rfp:email>
         <!--Optional:-->
         <rfp:telNo>?</rfp:telNo>
      </rfp:CreateNewContact_FullName>
   </soapenv:Body>
</soapenv:Envelope>

Method 2 Stub:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rfp="http://test.com/testWebservice/">
   <soapenv:Header/>
   <soapenv:Body>
      <rfp:CreateNewContact_FirstLastName>
         <!--Optional:-->
         <rfp:firstName>?</rfp:firstName>
         <!--Optional:-->
         <rfp:lastName>?</rfp:lastName>
         <!--Optional:-->
         <rfp:email>?</rfp:email>
         <!--Optional:-->
         <rfp:telNo>?</rfp:telNo>
      </rfp:CreateNewContact_FirstLastName>
   </soapenv:Body>
</soapenv:Envelope>

When I call the CreateNewContact method with 4 parameters using PHP SoapClient, it looks like I'm getting the response from the other method.

How can I specify which method to use using SoapClient?

Thanks,



from Calling multiple methods with same name using SoapClient

No comments:

Post a Comment