Posted by pathscale on February 28, 2012 at 10:31am
I've installed services and created a service with these details
name register, server xmlrpc, endpoint user.register, resources user create and user register
I'm posting using curl
url -X POST -d @xmlpost.txt --header "Content-Type:text/xml" http://foo.com/user.register
--------
<?xml version="1.0"?>
<methodCall>
<methodName>user.register</methodName>
<params>
<param>
<struct>
<member>
<name>name</name>
<value><string>username</string></value>
</member>
<member>
<name>mail</name>
<value><string>fooexample@example.com</string></value>
</member>
<member>
<name>profile_new_legal_agreement</name>
<value><string>true</string></value>
</member>
</struct>
</param>
</params>
</methodCall>Here's the response I get - no matter what xml I send I always get this reply
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value><string></string></value>
</param>
</params>
</methodResponse>-------------
Here's the debug information
Calling server: xmlrpc_server_server
-------------
Server info main object:
stdClass Object
(
[module] => xmlrpc_server
[endpoint] => register
[endpoint_path] => user.register
[debug] => 1
[settings] =>
)
<code>
-------------
<code>
Controller:
Array
(
[help] => Registers a user. (anonymous only)
[callback] => _user_resource_create
[file] => Array
(
[type] => inc
[module] => services
[name] => resources/user_resource
)
[access callback] => _user_resource_access
[access arguments] => Array
(
[0] => register
)
[access arguments append] => 1
[args] => Array
(
[0] => Array
(
[name] => account
[type] => array
[description] => The user data
[source] => data
[optional] =>
)
)
[endpoint] => Array
(
[enabled] => 1
)
)-------------
Passed arguments: Array
(
[0] => Array
(
[name] => username
[mail] => fooexample@example.com
[profile_new_legal_agreement] => true
)
)-------------
What am I doing wrong or how do I debug this further?
Comments
I'm willing to pay for
I'm willing to pay for someone to give support on this issue
ymmv
I tried using services 3 to do the same thing with the REST server, but found that the actual parameters (name, mail, conf_mail, password) all had to be passed as top level parameters, not as members of an array
I'm not sure if you mean to
I'm not sure if you mean to remove both the struct and member tags - If you have time could you paste a complete example - Thanks
Great!
I was stucked there trying to create a new user and this solved my problems...
Now I'm sending a JSON array to the server like this (depending on the user mandatory fields):
{"mail":"usermail@myemail.com",
"pass":"",
"status":"1",
"notify":"1",
"field_fecha_nacimiento":{"und":[{"value":{"date":"12 Mayo 1980"}}]},
"field_nombre":{"und":[{"value":"Nuevo nombre"}]},
"field_apellidos":{"und":[{"value":"Nuevo apellido"}]},
"field_geolocation":{"und":[{"lat":"41.4504937","lng":"2"}]}
}
Now the problem is how to send timestamp dates...
curl verbose
if you add a '-v' to your curl command what do you get as the output?
Now I'm seeing the 406
Now I'm seeing the 406 returned, but I'm not sure how to fix it
(I thought first name field is named "name" and even when I pass password I still get this)
> POST /user.register HTTP/1.1
> User-Agent: curl/7.21.2 (i386-pc-solaris2.11) libcurl/7.21.2 OpenSSL/1.0.0e zlib/1.2.3
> Host: www.foobar.com
> Accept: /
> Content-Type:text/xml
> Content-Length: 628
>
< HTTP/1.0 406 Not Acceptable: First Name field is required. You must enter a password.
< Date: Wed, 29 Feb 2012 11:36:37 GMT
< Server: Apache/2.2.15 (CentOS)
< X-Powered-By: PHP/5.3.2
< Set-Cookie: gibberish; expires=Fri, 23-Mar-2012 15:09:57 GMT; path=/; domain=.foobar.com
< Expires: Sun, 19 Nov 1978 05:00:00 GMT
< Last-Modified: Wed, 29 Feb 2012 11:36:37 GMT
< Cache-Control: store, no-cache, must-revalidate
< Cache-Control: post-check=0, pre-check=0
< Connection: Keep-Alive
< Content-Length: 140
< Content-Type: text/xml
<
<?xml version="1.0"?>
* Closing connection #0
ping - Any help on this is
ping - Any help on this is greatly appreciated. I feel I'm getting close to it working. TIA
its works
got it working using your original structure on Services 3, xmlrpc server, but using the following field names
name
mail
conf_mail
pass