Hi,

Our RESTful webservices provide the GET/POST/PUT/DELETE functionality as per 
document.

I have tested with GET method and got XML response as expected(working fine). 
But when i go for POST method i got below error,

Error message:
--------------
Jan 5, 2010 10:58:37 PM org.restlet.engine.http.connector.HttpClientHelper start
INFO: Starting the default HTTP client
Exception in thread "main" Method Not Allowed (405) - Method Not Allowed
        at org.restlet.resource.ClientResource.post(ClientResource.java:978)
        at ReferenceClient.main(ReferenceClient.java:30)


Client Program:
---------------

import java.io.IOException;

import org.restlet.Client;
import org.restlet.data.ChallengeResponse;
import org.restlet.data.ChallengeScheme;
import org.restlet.data.Protocol;
import org.restlet.resource.ClientResource;
import org.restlet.representation.StringRepresentation;
import org.restlet.data.MediaType;

public class ReferenceClient {
  public static void main(String [] args) throws IOException {
    String uri =  "http://test.xy.com/api/forums.ashx/forumgroups/";;
    ClientResource resource = new ClientResource(uri);
    ChallengeScheme scheme = ChallengeScheme.HTTP_BASIC;
    String forumXML= "<ForumGroup Id=\"307\""+
                                        
"Endpoint=\"http://test.xy.com/api/forums.ashx/forumgroups/307\";>"+
                                                "<Name>Stellaris Forum</Name>"+
                                                "<Description>Stellaris Forum 
Description<Description>"+
                                        "</ForumGroup>";
    StringRepresentation rep = new 
StringRepresentation(forumXML,MediaType.APPLICATION_XML);
    ChallengeResponse authentication = new ChallengeResponse(scheme, 
"ENT\\x0087948", "PF46CYrr");
    resource.setChallengeResponse(authentication);
    resource.post(rep).write(System.out);
  }
}

Our POST method of RESTful webservices accept XML format request.


I hope missed something.

Please help me.

Thanks in advance.

Regards,
Murugesan.

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2435093

Reply via email to