Hi!

I have websitepanel installed on a Windows 2008 Server and i want to use the websitepanel API. What im trying to do is to add a user to websitepanel with php/nusoap. Im not so steady when it comes to soap. So i was wondering if someone in this beautiful forum could send me in the right direction.

This is the lines in WDSL im trying to send the data to:

<s:element name="AddUser">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="user" type="tns:UserInfo"/>
<s:element minOccurs="1" maxOccurs="1" name="sendLetter" type="s:boolean"/>
</s:sequence>
</s:complexType>
</s:element>

And this is my PHP code:

<?php
require_once ("nusoap/lib/nusoap.php"); 

$dnp = new soapclientNusoap('http://server:port/esUsers.asmx?WSDL', true);
$dnp->soap_defencoding = 'utf-8';

$dnp->setCredentials("username", "password");

class adduser{
    public $ownerid;
    public $roleid;
    public $statusid;
    public $isdemo;
    public $ispeer;
    public $username;
    public $password;
    public $firstname;
    public $lastname;
    public $email;
}

$param = new adduser();
$param->ownerid = 1;
$param->roleid = 3;
$param->statusid = 1;
$param->isdemo = 'false';
$param->ispeer = 'false';
$param->username = 'test';
$param->password = '123123';
$param->firstname = 'test';
$param->lastname = 'testing';
$param->email = 'test@test.com';

$result = $dnp->call('AddUser', array('parameters' => $param),
      'http://smbsaas/websitepanel/enterpriseserver',
      'http://smbsaas/websitepanel/enterpriseserver/AddUser');

When i try to run it i get the soap error:

Array
(
[faultcode] => soap:Server
[faultstring] => Server was unable to process request. ---> Object reference not set to an instance of an object.
[detail] =>
)


Am i doing it all wrong?

Best regards!

Anyone?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.