Page 1 of 1

Custom Fields on SOAP registerMember

Posted: Mon Nov 26, 2012 7:33 am
by mraxai
Hi all,

I could really use some help on an issue I'm having with SOAP WebServices and PHP.
I wrote down a script that's capable of registering a member via the "registerMember" function, and according to the wiki, I'm trying to include some member custom fields in the process.

There's absolutely no trouble on registering a member: the whole thing go well, but it seems there's no way for me to get custom fields on registration working.
I'm sending the parameters of the function like this:

$params = new stdclass();
$params->groupId = "33";
$params->name = "Name";
$params->email = "email@email.ema";
$params->loginPassword = "secret";
$params->fields = $myfieldsarray;

The problem seems to be on the definition of $fieldsarray, wich I tried to declare this way:
$myfieldsarray = array('internalName' => 'vbfirstnamec', 'fieldId' => '91', 'displayName' => 'NomeC', 'value' => 'Andrea', 'possibleValueId' => NULL, 'hidden' => false);

I don't get any error, the registration seems to work just fine, but when I go to the member profile, the custom field just doesn't have any value.
After searching this forum I even tried this form for the array $myfieldsarray:
$myfieldsarray = array('field' => 'vbfirstnamec', 'value' => 'Andrea', 'hidden' => false);

cause in a thread I found someone sayin that was the way to pass parameters to the function, but in this case i get this error:
SoapFault exception: [ns1:invalid-parameter] Couldn't find custom field for this field: FieldValueVO [internalName=null, fieldId=null, displayName=null, value=Andrea, possibleValueId=null]
wich is why I suppose the right method to declare the custom field is the first one, according to the Wiki, also, it says you must pass a list (list? Is that intended like an actual list or an array parsed through the "list()" function?) of "registrationFieldValues", wich the model data explains to be like:

internalName (string): The custom field internal name
fieldId (number): The custom field id
displayName (string): The custom field display name
value (any): The custom field value
possibleValueId (number): The custom field possible value id
hidden (boolean): Indicates whether the given field is hidden from others

and that is what I'm sending on the first case, but it just seems to ignore my custom fields, register the user, send me back what supposed to, and when I go to the profile, the member is registered, the group and the parameters are right, but in any case, there isn't any custom field actually filled.

Any help? Any example I could use to see how a working registration with Custom Fields used is to be written?
I'm using Cyclos 3.7.1

Thanks in advance

Re: Custom Fields on SOAP registerMember

Posted: Mon Nov 26, 2012 9:06 am
by stephendwolff

One thing i've found with collections of items in the cyclos web services WSDL is that they can follow a bit of an unexpected (possibly invalid) XML format:

In pseudocode you might expect something like this:


However - cyclos often doesnt' wrap the collected elements in an outer one, so you'd find that the <fields> tag isn't used in the WSDL - there is a list of <field> elements, without the <fields> wrapper.

It might be worth trying to use something to send the SOAP call manually - ie 'Wireshark' on the PC? That way you can edit the XML to get it working, then make sure the PHP matches it.

Hope that helps,


Re: Custom Fields on SOAP registerMember

Posted: Mon Dec 17, 2012 9:36 am
by stephendwolff
@mraxai - did you solve your issue in the end, and if so, how did you?



Re: Custom Fields on SOAP registerMember

Posted: Wed Dec 19, 2012 6:42 am
by mraxai
Hi Stephen,

yes we've solved it using your precious help together with tons of trial and error.

We also used to help understanding wsdl.

In the process, we've found out that some functionalities that work well in the mainweb channel seem not to work via Webservice.

We'll test more when we can and update as we proceed.


Re: Custom Fields on SOAP registerMember

Posted: Wed Dec 19, 2012 7:01 am
by stephendwolff
Thanks Giuseppe,

I eventually found that the naming of the custom field had changed between 3.6 and 3.7 - by comparing the WSDL - as seen by visiting:

http://<cyclos instance url>/services/members?wsdl

I'll have a look at the webservices client you mention too - i think i used 'wireshark' or something like that to do similar - ie fire a SOAP packet at a system, and view the raw response.