XML-PRC: trouble using webservice core_completion_get_activities_completion_status

XML-PRC: trouble using webservice core_completion_get_activities_completion_status

by Jannik Olsen -
Number of replies: 1

Hi,

I have been using some of the webservices for a while now so I'm surprised that this one doesn't immediately work out for me. I must be overlooking something obvious - I hope.

I get the error "invalid parameter" so I think that there must be something wrong with my request. Can someone please help figure out what is wrong?


EDIT:

this is the php code that produces the xml below:

$webservice = 'core_completion_get_activities_completion_status';	
$params = array(
	'courseid' => $courseid, 
	'userid' => $userid
);
		
$post = xmlrpc_encode_request($webservice, $params);

$post XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>core_completion_get_activities_completion_status</methodName>
<params>
 <param>
  <value>
   <struct>
    <member>
     <name>courseid</name>
     <value>
      <int>2257</int>
     </value>
    </member>
    <member>
     <name>userid</name>
     <value>
      <int>7619</int>
     </value>
    </member>
   </struct>
  </value>
 </param>
</params>
</methodCall>


response:

Array
(
    [faultCode] => 29039061
    [faultString] => Ugyldig parameterværdi fundet | ERRORCODE: invalidparameter
)

thank you smile

/Jannik

Average of ratings: -
In reply to Jannik Olsen

Re: XML-PRC: trouble using webservice core_completion_get_activities_completion_status

by Jannik Olsen -

Just wanted to share my solution, in case anyone else has this problem.

Turns out it was indeed the xml structure. Enabling verbose error messages enabled me to customize the xml so it was finally accepted (see below). However, I cannot for the life of me figure out how to make the PHP functions create this XML, so for now I'll have to accept making it manually. Not that it's a big issue but it's still annoying, and I would love if someone could enlighten me on this.

Working XML:

<?xml version="1.0" encoding="iso-8859-1"?>
<methodCall>
<methodName>core_completion_get_activities_completion_status</methodName>
<params>
 <param>
  <value>
    <courseid><int>2257</int></courseid>
  </value>
 </param>
 <param>
  <value>
     <userid><int>7619</int></userid>
  </value>
 </param>
</params>
</methodCall>