开发者

Consuming a .net Web Service with php and complex types

I am trying to call 开发者_StackOverflowa 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.


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"));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜