简体   繁体   中英

create php SOAP request

i wanna create soap request as below

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/10.0">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:updateUser sequence="?">
         <!--You have a CHOICE of the next 2 items at this level-->
         <uuid>{74932749237942794729473927493829}</uuid>
         <userid>?</userid>
         <associatedGroups>
            <!--Zero or more repetitions:-->
            <userGroup>
               <name>Standard CTI Enabled</name>
               <!--Optional:-->
               <userRoles>
                  <!--Zero or more repetitions:-->
                  <userRole>Standard CTI Enabled</userRole>
               </userRoles>
            </userGroup>
            <userGroup>
               <name>Standard CCM End Users</name>
               <!--Optional:-->
               <userRoles>
                  <!--Zero or more repetitions:-->
                  <userRole>Standard CCM End Users</userRole>
               </userRoles>
            </userGroup>
         </associatedGroups>
      </ns:updateUser>
   </soapenv:Body>
</soapenv:Envelope>

I have this as my code so far:

$userId = "example@mydomain.com";
$retAccessWebex["UserUuid"] = "{74932749237942794729473927493829}";            //sample userUuid
    $userGroup = array();
    $userRoleCTI = array("Standard CTI Enabled");
    $userGroup[] = array(
        "name" => "Standard CTI Enabled",
        "userRoles" => array(
            "userRole" => $userRoleCTI,
        )
    );
    $userRoleCCM = array("Standard CCM End Users");
    $userGroup[] = array(
        "name" => "Standard CCM End Users",
        "userRoles" => array(
            "userRole" => $userRoleCCM,
        )
    );

    $param = array(
        "uuid" => $retAccessWebex["UserUuid"],
        "userid" => $userId,
        "associatedGroups" => array(
            array(
                "userGroup" => $userGroup,
            )
        )
    );
    $mywsdl = "pathToSchemaWsdl/AXLAPI.wsdl";
    $wsdl = "https://127.0.0.1:8443/axl/";
    $client = new SoapClient($mywsdl,
        array('trace' => true,
            'exceptions' => true,
            'location' => $wsdl,
            'login' => 'administrator',
            'password' => 'mtp455w0rd',
        ));
    $response = $client->updateUser($param);

however, when executing, I get this error message:

Fatal error: Uncaught SoapFault exception: [Sender] SOAP-ERROR: Encoding: object has no 'name' property

try to see what is in request

echo $client->__getLastRequestHeaders(); echo $client->__getLastRequest();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM