0

I am trying to call a web service which is expecting a complex type.. I did some research and found this is a big issue in php... maybe somebody has some tips?

Doing basic Soap requests work fine, such as

$client->GetClientById(array('ClientID'=>123');

However, for updating, it is expecting a Client object... I already tried different things such as

$clientobj = $client->GetClientById(array('ClientID'=>123');
$client->UpdateClient($clientobj, $params); 

Can anyone suggest me how to acomplish this?

Thanks.

1 Answer 1

1

I'd suggest trying SoapVar class. It allows you to specify the type name, etc. Example usage from the manual:

 class SOAPStruct {
     function SOAPStruct($s, $i, $f) 
     {
         $this->varString = $s;
          $this->varInt = $i;
          $this->varFloat = $f;
      }
  }
  $client = new SoapClient(null, array('location' => "http://localhost/soap.php",
                                 'uri' => "http://test-uri/"));
  $struct = new SOAPStruct('arg', 34, 325.325);
  $soapstruct = new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPStruct", "http://soapinterop.org/xsd");
  $client->echoStruct(new SoapParam($soapstruct, "inputStruct"));
Sign up to request clarification or add additional context in comments.

1 Comment

I believe this is the solution, however I am getting additional errors. At least using the example I was able to get the service to respond with other errors, however I can't get it to work.. still this is the right answer..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.