kxc
kxc

Reputation: 1457

SOAP WSDL php request

I'm trying to send request via SOAP, and call service function. I have WSDL file, which returns available function's. There's my code example:

ini_set('display_errors', '1');
ini_set('error_reporting', E_ALL &~ (E_NOTICE | E_STRICT));
ini_set("soap.wsdl_cache_enabled", 0);

$wsdl = 'source/HPSMInteractionsFromMosRu.wsdl';
$client = new SoapClient($wsdl,
    array(
        'trace' => 1,
        'exception' => 0
    ));

$res = $client->RetrieveHPSMInteractionsFromMosRuKeysList(array(
    'Portal' => 'Portal_example',
    'CK' => 'CK_example'
));

print_r($res);

And that's return me an error:

Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: object has no 'model' property in *my_path* Stack trace: #0 *my_path* (24): SoapClient->__soapCall('RetrieveHPSMInt...', Array) #1 {main} thrown in *my_path* on line 24

While, if i try to do that request by SoapUI programm, with the same WSDL file, i make that XML request:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"     xmlns:ns="http://schemas.hp.com/SM/7"     xmlns:com="http://schemas.hp.com/SM/7/Common" xmlns:xm="http://www.w3.org/2005/05/xmlmime">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:RetrieveHPSMInteractionsFromMosRuKeysListRequest>
         <ns:model>
             <ns:keys>
               <ns:ID></ns:ID>
            </ns:keys>
             <ns:instance>
                <ns:Portal>Portal_example</ns:Portal>
                <ns:CK>CK_example</ns:CK>
          </ns:instance>
          </ns:model>
      </ns:RetrieveHPSMInteractionsFromMosRuKeysListRequest>
   </soapenv:Body>
</soapenv:Envelope>

I'm new in SOAP. But how i understood, i must call function with parametrs from XML, with associated array.

Upvotes: 1

Views: 562

Answers (1)

Jason
Jason

Reputation: 1220

I have only worked with SOAP small amounts, but because it mentions missing the "model" I'm thinking your request should look something like this:

$res = $client->RetrieveHPSMInteractionsFromMosRuKeysList(array(
    'model' => array(
        'keys' => array(
            'ID' => ''
        ),
        'instance' => array(
          'Portal' => 'Portal_example',
          'CK' => 'CK_example'
        ),
    ),
));

Upvotes: 1

Related Questions