0

I am connecting via soap to a remote system to pull information and would like some help on how to pass an array of data durring connection. Right now, this code works correctly;

$soapClient = new SoapClient("https://host:8443/realtimeservice/services/RisPort?wsdl", array('stream_context' => $context, trace'=>true, 'login' => "login",'password'=> "password"));
$array['SelectBy'] = "Name";
$array['Status'] = "Any";
$array['SelectItems']['SelectItem[0]']['Item'] = "deviceName";
$devices = $soapClient->SelectCmDevice("", $array);

I would like to condense it into the $device variable so that I don't have separate array statements. It feels like it should kind of look like this;

$devices = $soapClient->SelectCmDevice("", array('SelectBy'=>'Name','Status'=>'Any',?));

However, I don't know how to write the third object. Can someone help?

1 Answer 1

1

I think this might work. I appreciate the minimalist approach, but this looks worse imho and is really difficult for another coder to read. 4 understandable lines is better than 1 cryptic line.

$devices = $soapClient->SelectCmDevice("", array('SelectBy'=>'Name','Status'=>'Any','SelectItems'=>array('SelectItem[0]'=>array('Item'=>"deviceName"))));
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, RightClick. I'm still weighing issues of clarity with this code. I'm thinking of extending it and wanted to keep it tidy from the start.

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.