[Spce-user] help with XML-RPC an php

Alejandro Rodriguez alejandro at beeztel.com
Mon Jun 11 19:27:09 EDT 2012


Hi,

Not, this don't work. I try with the code attached.
I use the xml soap instead of the arrays.
I think all is correct, but I have this error, and I don't have idea why.

Array
(
    [faultcode] => soap:Server
    [faultstring] => Can't use string ("666666666") as a HASH ref
while "strict refs" in use at
/usr/share/perl5/Sipwise/Provisioning/Billing.pm line 1009.

)

This is the code using nusoap

<?php

require_once('lib/nusoap.php');

$useCURL =  '0';

$client = new nusoap_client("https://xx.yy.zz.aa:nnnn/SOAP/Provisioning.wsdl",
true, "", "", "USER", "PASSWORD");
$client ->setCredentials("USER","PASSWORD");

$err = $client->getError();
if ($err) {
    echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
    echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(),
ENT_QUOTES) . '</pre>';
    exit();
}

$client->setUseCurl($useCURL);
$client->useHTTPPersistentConnection();


// CREATE ACCOUNT
$params = '
         <authentication>
            <type xsi:type="xsd:string">admin</type>
            <username xsi:type="xsd:string">user</username>
            <password xsi:type="xsd:string">password</password>
         </authentication>
         <parameters>
             <data>
                <billing_profile
xsi:type="xsd:string">default</billing_profile>
                <status xsi:type="xsd:string">active</status>
                <external_id xsi:type="xsd:string">44444444</external_id>
                    <subscribers
SOAP-ENC:arrayType="xsd:SubscriberWriteArray[]">
                                <username
xsi:type="xsd:string">666666666</username>
                                <domain
xsi:type="xsd:string">xx.yy.zz.aa</domain>
                               <password
xsi:type="xsd:string">2222222</password>
                        </subscribers>
                </data>
         </parameters>
';

$result = $client->call('create_voip_account', $params,
'https://xx.yy.zz.aa:nnnn/SOAP', 'https://xx.yy.zz.aa:nnnn/SOAP');
echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';

if ($client->fault) {
echo '<h2>Fault</h2><pre>'; print_r($result); echo '</pre>';
} else {
$err = $client->getError();
if ($err) {
echo '<h2>Error</h2><pre>' . $err . '</pre>';
} else {
echo '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
}
}

echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request,
ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response,
ENT_QUOTES) . '</pre>';
echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->getDebug(),
ENT_QUOTES) . '</pre>';





2012/6/12 Skyler <skchopperguy at gmail.com>

> Hi,
>
>  Did this work for you?
>
> Skyler
>
>
> On Thu, Jun 7, 2012 at 1:52 PM, Alejandro Rodriguez <alejandro at beeztel.com
> > wrote:
>
>> Perfect.
>>
>> I will try.
>>
>> Regards
>> El 07/06/2012 21:50, "Skyler" <skchopperguy at gmail.com> escribió:
>>
>> Hi,
>>>
>>>   Don't forget to reply-all so everyone can help or know solutions ;)
>>>
>>> On Thu, Jun 7, 2012 at 1:22 PM, Alejandro Rodriguez <
>>> alejandro at beeztel.com> wrote:
>>>
>>>> Hi Skyler,
>>>>
>>>> With nusoap, all is correct and easy. (I don't think on use this
>>>> instead of php soap)
>>>>
>>>> I'm not sure if you can help me with a new question. Create the
>>>> structure for create_voip_account. I can't create the correct structure.
>>>> I receive this message "need a billing profile for the new account"
>>>>
>>>>
>>>  I have this same trouble but not had time to further investigate. I
>>> suspect that the 'billing_profile' may require the ID number assigned in
>>> the database to be passed where if 'Default Billing Profile' has ID of '3'
>>> then pass the '3'.
>>>
>>> ...just guessing, maybe you can help to confirm this for everyone? :)
>>>
>>> Skyler
>>>
>>>
>>>>  Thanks.
>>>>
>>>> $params = array(
>>>>         'authentication' => array('type' => 'admin', 'username' =>
>>>> 'username', 'password' => 'password'),
>>>>         'parameters' => array( 'data' => array (
>>>>                     'billing_profile' => 'Default Billing Profile',
>>>>                     'status'  => 'active',
>>>>                     'external_id' => '44444444',
>>>>                     'subscribers' => array(
>>>>                             'username' => '44444444',
>>>>                             'domain' => '94.23.232.121',
>>>>                             'password' => '2222222'
>>>>                             )
>>>>                     )
>>>>             )
>>>>     );
>>>>
>>>>
>>>>
>>>>
>>>> 2012/6/7 Alejandro Rodriguez <alejandro at beeztel.com>
>>>>
>>>>> Thanks a lot nusoap :)
>>>>> El 07/06/2012 19:45, "Skyler" <skchopperguy at gmail.com> escribió:
>>>>>
>>>>> Hi,
>>>>>>
>>>>>>  See attached php/soap connection example. This is from a very
>>>>>> helpful person on the list some months ago. Maybe it will assist your
>>>>>> problem ;)
>>>>>>
>>>>>> Skyler
>>>>>>
>>>>>> On Thu, Jun 7, 2012 at 6:47 AM, Alejandro Rodriguez <
>>>>>> alejandro at beeztel.com> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm trying to use XML-RPC and SOAP with sipwise. But I cant connect
>>>>>>> with the server with XML-RPC and with SOAP versión everytime I get the
>>>>>>> message "SOAP-ERROR: Parsing Schema: unexpected  in complexType"
>>>>>>>
>>>>>>> Please have you some example in php to usu XML-RPC or with SOAP.
>>>>>>>
>>>>>>>
>>>>>>> This is my php for load the wsdl in SOAP.
>>>>>>>
>>>>>>> try
>>>>>>> {
>>>>>>> $client = new SoapClient("
>>>>>>> https://ipserver:2443/SOAP/Provisioning.wsdl",array('login' =>
>>>>>>> "login", 'password' => "password"));
>>>>>>>
>>>>>>> } catch ( SoapFault $fault ) {
>>>>>>> echo '<pre>';
>>>>>>> echo var_dump($fault) ;
>>>>>>> echo '</pre>';
>>>>>>> exit ;
>>>>>>> }
>>>>>>>
>>>>>>>
>>>>>>> Regards
>>>>>>> Alejandro
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Spce-user mailing list
>>>>>>> Spce-user at lists.sipwise.com
>>>>>>> http://lists.sipwise.com/listinfo/spce-user
>>>>>>>
>>>>>>>
>>>>>>
>>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sipwise.com/mailman/private/spce-user_lists.sipwise.com/attachments/20120612/9953488e/attachment.html>


More information about the Spce-user mailing list