1

I have a soap function called get_file_list that I would like to write for PHP however I can not get it to work. It has three parameters, 1) start time, 2) end time, and 3) boolean. This is what the sample code looks like in soap;

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:get_file_list soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://schemas.cisco.com/ast/soap/">
<in0 xsi:type="xsd:string">200511161000</in0>
<in1 xsi:type="xsd:string">200511161059</in1>
<in2 href="#id0"/>
</ns1:get_file_list>
<multiRef id="id0" soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:boolean"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">true</multiRef>
</soapenv:Body>
</soapenv:Envelope>

I've written the PHP like this;

$response = $soapClient->__get_file_list(array('$in0'=>'201401161000','$in1'=>'201401161059','$in2'=>'id0'));
print_r($response);

I know that I am definitely authenticating and that get_file_list is a true soap function because I am able to generate this output;

Array
(
    [0] => ArrayOfFileName get_file_list(string $in0, string $in1, boolean $in2)
    [1] => void get_file(string $in0, string $in1, string $in2, string $in3, string $in4, boolean $in5)
)

When I execute the page, it returns a blank. Any help is appreciated.

Here is the wsdl

<wsdl:definitions targetNamespace="http://schemas.cisco.com/ast/soap/"><!--WSDL created by Apache Axis version: 1.4 With AXIS-2250
Built on Apr 22, 2006 (06:55:48 PDT)--><wsdl:types><schema targetNamespace="http://schemas.cisco.com/ast/soap/"><import namespace="http://schemas.xmlsoap.org/soap/encoding/"/><complexType name="ArrayOfFileName"><sequence><element maxOccurs="unbounded" minOccurs="0" name="FileName" nillable="true" type="xsd:string"/></sequence></complexType></schema></wsdl:types><wsdl:message name="get_file_listRequest"><wsdl:part name="in0" type="xsd:string"/><wsdl:part name="in1" type="xsd:string"/><wsdl:part name="in2" type="xsd:boolean"/></wsdl:message><wsdl:message name="get_fileResponse">

   </wsdl:message><wsdl:message name="get_fileRequest"><wsdl:part name="in0" type="xsd:string"/><wsdl:part name="in1" type="xsd:string"/><wsdl:part name="in2" type="xsd:string"/><wsdl:part name="in3" type="xsd:string"/><wsdl:part name="in4" type="xsd:string"/><wsdl:part name="in5" type="xsd:boolean"/></wsdl:message><wsdl:message name="get_file_listResponse"><wsdl:part name="get_file_listReturn" type="impl:ArrayOfFileName"/></wsdl:message><wsdl:portType name="CDRonDemand"><wsdl:operation name="get_file_list" parameterOrder="in0 in1 in2"><wsdl:input message="impl:get_file_listRequest" name="get_file_listRequest"/><wsdl:output message="impl:get_file_listResponse" name="get_file_listResponse"/></wsdl:operation><wsdl:operation name="get_file" parameterOrder="in0 in1 in2 in3 in4 in5"><wsdl:input message="impl:get_fileRequest" name="get_fileRequest"/><wsdl:output message="impl:get_fileResponse" name="get_fileResponse"/></wsdl:operation></wsdl:portType><wsdl:binding name="CDRonDemandSoapBinding" type="impl:CDRonDemand"><wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><wsdl:operation name="get_file_list"><wsdlsoap:operation soapAction="http://schemas.cisco.com/ast/soap/action/#CDRonDemand#get_file_list"/><wsdl:input name="get_file_listRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://schemas.cisco.com/ast/soap/" use="encoded"/></wsdl:input><wsdl:output name="get_file_listResponse"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://schemas.cisco.com/ast/soap/" use="encoded"/></wsdl:output></wsdl:operation><wsdl:operation name="get_file"><wsdlsoap:operation soapAction="http://schemas.cisco.com/ast/soap/action/#CDRonDemand#get_file"/><wsdl:input name="get_fileRequest"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:CDRonDemand" use="encoded"/></wsdl:input><wsdl:output name="get_fileResponse"><wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://schemas.cisco.com/ast/soap/" use="encoded"/></wsdl:output></wsdl:operation></wsdl:binding><wsdl:service name="CDRonDemandService"><wsdl:port binding="impl:CDRonDemandSoapBinding" name="CDRonDemand"><wsdlsoap:address location="https://<server_ip>:8443/CDRonDemandService/services/CDRonDemand"/></wsdl:port></wsdl:service></wsdl:definitions>
Kimomaru
  • 993
  • 4
  • 14
  • 30
  • Why are you calling `__get_file_list` instead of `get_file_list`? Why are you calling parameters `'$in0'` instead of the correct `'in0'`? – Wrikken Jan 24 '14 at 17:31
  • Hi Wrikken - I was working from some examples that I had found. How would you write it? – Kimomaru Jan 24 '14 at 17:34
  • I'd start with `$soapClient->get_file_list(array('in0'=>'201401161000','in1'=>'201401161059','in2'=>'id0'));`, and see if that works, and if not, use `__getLastRequest()` to examine what it actually sends. – Wrikken Jan 24 '14 at 21:16
  • Hi Wrikken - thank you for replying. I copied your syntax into my php but when I try to run it, it bombs out. The line itself does not produce anything and nothing shows up in __getLastRequest or any of the "echo 'Test'" lines underneath that (used for testing). If I comment the line out, all lines are run. I also disabled cacheing of wsdl to isolate the issue further. Any ideas? – Kimomaru Jan 25 '14 at 01:19
  • `catch` the `SoapFault`, and see what it says (and there you can also examine the `__getLastRequest()` if you set `trace` to `true` when you create your `SoapClient`). If you have a wsdl to share, that would help too. – Wrikken Jan 25 '14 at 01:36
  • Hi Wrikken - I have added the wsdl to the original post. I will catch the SoapFault and post my findings. And, yes, trace has been set to true. Thank you, Wrikken. – Kimomaru Jan 25 '14 at 05:17
  • Hi Wrikken - I added the SoapFault like you recommended and I am getting a "Server.userException" error. – Kimomaru Jan 27 '14 at 18:41
  • Hi Wrikken - I figured this out. The format is actually $soapClient->get_file_list('201401271000','201401271059','id0'). Thank you for your help, much appreciated. – Kimomaru Jan 27 '14 at 19:57
  • Ah, D'oh! It is now obvious indeed. Calling without `array` with an overloaded `__call`, with array in `__soapCall`... Totally overlooked this myself, nice to know you found out what was wrong ;) (You can answer you own question BTW: we don't like to have unanswered questions hanging about, so give the answer to yourself & accept it ;) ) – Wrikken Jan 27 '14 at 21:29

1 Answers1

2

The format is actually $soapClient->get_file_list('201401271000','201401271059','id0').

Kimomaru
  • 993
  • 4
  • 14
  • 30