Menu
Category

Webservice

How to invoke HTTP methods like PUT,PATCH and DELETE using HttpURLConnection

     I am invoking REST web services using HttpURLConnection. Few of the rest services have operations like PUT, PATCH, and DELETE. While passing these methods in setRequestMethod() of HttpURLConnection object, I am getting the below error in response. java.net.ProtocolException: Invalid HTTP method: PATCH To avoid this error and to let the HttpURLConnection execute these methods, there is a workaround…

Sending Parameters to URL or web service in POST Method

Below code snippet explains how to send parameters to a web url in the POST method. URL url = new URL(“http://testulr/searchuser”); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod(“POST”); urlConnection.setDoOutput(true); String params=”userid=”+userid+”&username=”+name; OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream()); BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out)); writer.write(params); writer.flush(); out.close(); InputStream in = new BufferedInputStream(urlConnection.getInputStream()); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuilder st = new StringBuilder();…

Error: oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer

I am developing a REST web service. While deploying the web service to the application server, I got the below error.Remote deployment failed (oracle.jdevimpl.deploy.common.Jsr88RemoteDeployer) The error occurred because my web service has two methods with the same path name. After changing the path names, the issue got resolved and the web service was deployed successfully to the server.

Changing End point address of web service in ADF

  Below code explains how to change the web service end point through program.  ServiceRequestService serviceRequestService = new ServiceRequestService(); ServiceRequestPortType serviceRequestPortType = serviceRequestService.getServiceRequestPortType();  BindingProvider bp = (BindingProvider)serviceRequestPortType;            bp.getRequestContext().put( BindingProvider.ENDPOINT_ADDRESS_PROPERTY, “http://localhost:9950/soa-infra/services/default/sr_v2/ServiceRequest.service”);  Here is the explanation for this code. Get port object of the web service Type cast the port object to BindingProvider object  BindingProvider class provides a member method getRequestContext() which…

Using HTTP Analyzer in JDeveloper

JDeveloper provides a tool called “Http Analyzer “ which is very useful when we are using web service in our application and if we want to see what input request, the application is being sent to server via web service. To start using the “Http Analyzer”, please do the below steps. Go to Tools menu of JDeveloper and select Http…

Hi, Welcome here.
JOIN OUR NEWSLETTER
And get notified everytime we publish a new blog post.