Hi all,
I am trying to send a PIX message to OpenHIE from OpenMRS. While sending the message I am getting a 404 error.
Below is the code which I am using:
String url = “http://iol.sandbox.ohie.org/ws/rest/v1/patients/”;
HttpClient client = HttpClientBuilder.create().build(); HttpPost post = new HttpPost(url); System.out.println("HttpPost object created"); try{ List<NameValuePair> urlParameters = new ArrayList<NameValuePair>(); urlParameters.add(new BasicNameValuePair("username", "admin")); urlParameters.add(new BasicNameValuePair("password", "admin")); urlParameters.add(new BasicNameValuePair("body", pixXmlMessage)); urlParameters.add(new BasicNameValuePair("port", "5001")); //urlParameters.add(new BasicNameValuePair("num", "12345")); post.setEntity(new UrlEncodedFormEntity(urlParameters)); System.out.println("post.setEntity Called"); HttpResponse response = client.execute(post); System.out.println("\nSending 'POST' request to URL : " + url); System.out.println("Post parameters : " + post.getEntity()); System.out.println("Response Code : " + response.getStatusLine().getStatusCode()); BufferedReader rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent())); StringBuffer result = new StringBuffer(); String line = ""; while ((line = rd.readLine()) != null) { result.append(line); } System.out.println(result.toString()); } catch (IOException e) { e.printStackTrace(); }
Here is the response which I am getting:
Response Code : 404
404 Not Found
Not Found
The requested URL /ws/rest/v1/patien
ts/ was not found on this server.
Apache/2.2.22 (Ubuntu) Server
at iol.sandbox.ohie.org Port 80
I would be glad if someone could help me resolve this issue.
Thanks & Regards
Sara Fatima