Soap WSDL request

Hi!

I have been searching for a soloution fo rtihis a long time now…

I cant figure out (or google out) how to do a soap request to an wsdl file witch want the xml file in nested regions.
If i manually test the soap with SoapUI, it works as it should.
In this example beneath is an request to an PBX system to change an extension Cll Handling Mode.

The XML should look like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.ShoreTel.com/ProServices/SDK/Web">
   <soapenv:Header/>
   <soapenv:Body>
      <web:RegisterClient>
         <!--Optional:-->
         <web:clientName>?</web:clientName>
         <!--Optional:-->
         <web:userAuthenticationInfo>
            <web:UserDN>?</web:UserDN>
            <web:UserID>?</web:UserID>
            <web:UserPassword>?</web:UserPassword>
         </web:userAuthenticationInfo>
      </web:RegisterClient>
   </soapenv:Body>
</soapenv:Envelope>

My problem is the region called userAuthenticationInfo with is inside the region RegisterClient.

I have a code for the RegisterClient (without the optional part userAuthenticationInfo).
It looks like this:

$soap = new SoapClient("http://172.21.1.50:8070/ShoreTelWebSDK?wsdl");
$req = new stdClass;
$req->clientName = "HQ";
$response = $soap->RegisterClient($req);
$handle = $response->RegisterClientResult;

$req = new stdClass;
$req->clientHandle = $handle;
$req->lineAddress = $data["busy"];
$response = $soap->OpenLine($req);
$lineId = $response->OpenLineResult->lineID;

$req = new stdClass;
$req->clientHandle = $handle;
$req->lineID = $lineId;
$req->getCallParties = true;
$req->getCallProperties = true;
$onPhone = false;
$response = $soap->GetActiveCalls($req);

$onPhone = isset($response->GetActiveCallsResult->ShoreTelCallStateInfo);

$value= $onPhone ? "Yes" : "No";

$req = new stdClass;
$req->clientHandle = $handle;
$response = $soap->UnegisterClient($req);

Now i would like to add the part userAuthenticationInfo also to this code.
The part userAuthenticationInfo should have the fields UserDN, UserID and UserPassword as seen above in the xml.

Can anyone help me how to accomplish this?

Whew! That’s a whole lotta over-writing going on.

Would it be possible to clean that up a bit somehow?

So, you can see here that your request is packing on the clientName right there.

Presumably, if you’re trying to pack on the other stuff, you’d follow the same procedure… before the client is sent the information package… to follow your original code’s example…

$req->userAuthenticationInfo = new stdClass;
$req->userAuthenticationInfo->UserDN = “ImaDomainName”;
$req->userAuthenticationInfo->UserID = “ImaIdentifier”;
$req->userAuthenticationInfo->UserPassword = “ImaTeapot”;

(Also, good luck with the XMLNS’s. That’s where I gave up trying to figure out the SoapClient class.)

Thanks!
That did help :smile:
I’m really an beginner in this, but step by step i get some functions to work!
I really appreciate your help!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.