views:

62

answers:

1

I have a Zend_Soap_Client object, and I'm trying to call a method on it:

$soapClient = new Zend_SoapClient('my_wsdl');

$params = array(
   'Login'   => 'username',
   'Message' => 'hello'
);

$soapClient->GetSoapRequest($params);

echo $soapClient->getLastRequest();

I would expect to see:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope ...>
 <env:Body>
  <ns1:GetSoapRequest>
   <ns1:Message>hello</ns1:Message>
   <ns1:Login>username</ns1:Login>
  </ns1:GetSoapRequest>
 </env:Body>
</env:Envelope>

But what I actually see is:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope ...>
 <env:Body>
  <ns1:GetSoapRequest>
   <ns1:Message/>
   <ns1:Login/>
  </ns1:GetSoapRequest>
 </env:Body>
</env:Envelope>

So it creates the correct fields but does not populate them with the content.

A: 

Have sorted this now. I needed to pass further structure in. I'm guessing that the code I provided was valid, if the WSDL had specified it in that way. For this though I needed something along the lines of:

$params = array(
   'Login'   => array('username' => 'username', 'password' => 'password'),
   'Message' => array('body' => 'hello')
);

Thanks for the help Pekka - sorry for the waste of time.

Colin