## Features & Development

### Adding a field to SOAP classes

by Björn Bergstrand -
Number of replies: 5
My goal here is to create a set over SOAP with restrict_ip set, and with a corresponding entry in set_locations.
I've been trying to add the field 'restrict_ip' to the 'GlobalSet' in
lib/WebworkSOAP/Classes.

I'm talking to webwork with php's SoapClient, but the object returned to me when calling 'get_global_set' does not have a 'restrict_ip' attribute. Everything else seems to be sent over fine.
However, when looking at the network traffic restrict_ip is definitely sent over the xml (It gets a string-value having the same name as the enum it had been set to).
The wsdl-file also contains a reference to 'restrict_ip'.

Now I don't really know what I'm doing here, but if someone could point me in the right direction I would very much appreciate it!

### Re: Adding a field to SOAP classes

by Michael Gage -
I'm not in a position to test this right at the moment but I my first suspicion
would be that the data is not being transmitted from the SOAP data type
to the calling object ($self). $self->{problems_per_page} = SOAP::Data->type( 'string', $data->problems_per_page ); Adding and entry of this type to WebworkSOAP/Classes/GlobalSet.pm using the 'restrict_ip' key might help with your problem. Let us know how it goes. I suspect this is a bug -- just one that no-one has tripped over before. Take care, Mike In reply to Michael Gage ### Re: Adding a field to SOAP classes by Björn Bergstrand - This is what i've done, added _ATTR restrict_ip$string restrict_ip
and
$self->{restrict_ip} = SOAP::Data->type( 'string',$data->restrict_ip );

to WebworkSOAP/Classes/GlobalSet.pm to get the behaviour I described.

Noticied that none of the other entries in 'set' with enum-values are present in the soap datatype. It's getting late however I think I'll resume this tomorrow.
Thanks!
Björn

### Re: Adding a field to SOAP classes

by Michael Gage -
I think everything is being converted to strings.

Have you looked at the code in the calling packages (these are modules for moodle)?  https://github.com/openwebwork/wwmoodle

I think the files you want are in wwassignment5 (the most recent version)
locallib.php is probably the most relevant.

Good luck.

Take care,

Mike

### Re: Adding a field to SOAP classes

by Björn Bergstrand -
I'll put this up here in case anyone else runs into the same problem:
The issue lied with the server caching the wsdl-files.
If you're using moodle checking Site administration > server > php-info for soap.wsdl_cache_dir will tell you where the files are cached, remove these to get your server to accept the new wsdl-file.