Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to resolve Issues while writing work Environment data's in RTC using REST service POST/PUT?

 Hi Team,

I am trying to update/create the work environment data of the user in RTC using REST service.

I had tried the below steps,

//Created the raw rest service client.
ITeamRawRestServiceClient rawRestServiceClient = teamRepository.getRawRestServiceClient();
   
String uriString = teamRepository.getRepositoryURI() +  "service/com.ibm.team.apt.internal.service.rest.IResourcePlanningRestService/workEnvironment?contributorId=XXXXXXXXXXXXXXXXXX";  //Just changed the contributor UUID. 
    
   URI uri = new URI(uriString);
   IRawRestClientConnection connection = rawRestServiceClient.getConnection(uri);
   connection.addRequestHeader("Content-Type", "application/x-www-form-urlencoded");
   InputStream is = getInputStream(document);

//Trying to POST or PUT
      Response doPutResponse = connection.doPost(is, is.available(), "text/xml"); // connection.doPut(is, is.available(), "text/xml"); 

Once i execute the above line(POST/PUT) I am getting the below exception, 

com.ibm.team.repository.common.transport.TeamServiceException: CRJAZ2942E A request from this server to another server could not be completed. The other server returned a 400 HTTP error with this error text: Bad Request.
CRJAZ2942E A request from this server to another server could not be completed. The other server returned a 400 HTTP error with this error text: Bad Request.
at com.ibm.team.repository.transport.client.RemoteTeamServer.throwHttpClientError(RemoteTeamServer.java:2105)
at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1296)
at com.ibm.team.repository.transport.client.RemoteTeamServer.executeMethod(RemoteTeamServer.java:1121)
at com.ibm.team.repository.transport.client.RestClientConnectionBase.executeMethod(RestClientConnectionBase.java:375)
at com.ibm.team.repository.transport.client.RestClientConnectionBase.doMethod(RestClientConnectionBase.java:211)
at com.ibm.team.repository.transport.client.RestClientConnectionBase.doPost(RestClientConnectionBase.java:165)
at com.ibm.team.repository.transport.client.TeamRawRestServiceClient$RawRestClientConnection.doPost(TeamRawRestServiceClient.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invokeServiceCall(ServiceInterfaceProxy.java:254)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:110)
at com.ibm.team.repository.client.internal.RawRestServiceClientProxy$RestClientConnectionProxy.invoke(RawRestServiceClientProxy.java:121)
at com.sun.proxy.$Proxy19.doPost(Unknown Source)
...........................................................

Is it correct way to create the URI string as i mentioned in the above code? 

Please let me know what i am doing wrong or how to resolve this issue?

Thanks in advance.

1

0 votes

Comments

Just note that you're using an internal API, so not much documentation or published information is available. Your best bet would be capture the network trace in a browser while doing the some operation and analyze what is being sent to the server.

 Hi Donald, 


Thanks for your comment. 

The trace which i showed is top level.

The internal api's are called from RTC api's (Means I didn't directly call those doPost(..). 

In my code I am calling the "TeamRawRestServiceClient" 's doPost (InputStream content, long contentLength, String contentType) method. (Sorry I don't have the traces for these calls)

As I am new to the REST services please let me know how I can debug it.

The service that you tried with, "service/com.ibm.team.apt.internal.service.rest.IResourcePlanningRestService/workEnvironment", is an internal one.



One answer

Permanent link

 was there any success in same?


0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 479
× 457
× 137

Question asked: Sep 15 '16, 12:40 a.m.

Question was seen: 4,712 times

Last updated: Jul 12 '21, 12:38 p.m.

Confirmation Cancel Confirm