Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Rest OData service queries

Hi,

  I am implementing a Odata model for rest service (as shown below)  for SMP 3.0 SP07. The Odata model development is done on Kepler and Api tools version is 1.4.1.

   The service code structure looks like below

Base URL to access this service is : https://localhost:8080/javaservice/webresources/notification

--------------------------------------------------------------------------------------------------------------------------------------------------------

......

@Path("/notification")

public class notificationservice {

  ....

  //Notification get METHOD

  @GET

  @Path("/{customerno}/{emailid}")

  @Produces("text/plain")

  public Response notify(@PathParam("customerno") String customerNo,

  @PathParam("emailid") String emailID) throws IOException,

  SQLException, PropertyVetoException, URISyntaxException {

  if (validateUSer(emailID, customerNo))

  return Response.status(200).build();

  else

  return Response.status(401).build();

  }

  @POST

  @Produces("text/plain")

  @Consumes(MediaType.APPLICATION_XML)

  public Response updateuser(String registrationMsg) throws SQLException {

  if (processUpdate())

  return Response.status(201).build();

  else

  return Response.status(500).build();

  }

}

-----------------------------------------------------------------------------------------------------------------------------------------------------------

I have built a OData model with name Notification and Entity Sets as Notifications.

Following are my queries as to how to access this service and send data to this service via Get and POST

The Odata service is connected as backend endpoint for application com.odata.test and the URL for access to the Odata service is a below

http://localhost:8087/com.odata.test/Notifications

Questions :

1. What should be the Request URL in the OData model for Read and POST operation ?

2. What will the url to send data via Get and Post method via SMP application com.odata.test ?

I have read @Carlos Roggan's blogs Integration Gateway: Understanding REST data source [7]: READ - xml and it unfortunately didn't help to resolve the issues mentioned above.

Kindly provide suggestions to resolve the issue.

Regards,

Amit

Tags:
replied

Hi Midhun/JK,

Thanks for the information.

  I was able to resolve the issue Jeff's help.

Following is the solution for everyone's benefit

1. For POST service I have removed the Path params and accepting that as a part of POST data.

2. For the Get service the following changes are done

     1. In the OData model in have used the following as relative path for data selection

               /javaservice/webresources/notification/{customerno}/{emailid}

         Also while creating the OData Entity model I have used customerno and emailid as properties and made them keys.

  

     2. Managed the response using custom code.

     3. While using the service via SMP application I am using the following URL

eg : http://localhost:8087/com.odata.test/Notifications(customerno='12345',emailid ='a@gmail.com' )

Regards,

Amit

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question