Solved

faultCode "Server.Error.Request and faultString "HTTP request error"

Posted on 2011-03-03
10
950 Views
Last Modified: 2013-12-15
Hi,
i am getting the following error when i run my code in debugging mode.
Here in my code i am trying to send data to server side and getting the same data back to the client using HTTPService.
Also i am attaching that code and java file for your reference.

faultCode "Server.Error.Request
faultString "HTTP request error"


Reagrds,
Naveen.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
	<![CDATA[
		
		import mx.collections.ArrayCollection;
		import mx.rpc.events.ResultEvent;
		import mx.rpc.events.FaultEvent;
		import mx.controls.Alert;
		
		[Bindable] private var msgList:ArrayCollection;
		
		private function init():void{
			rooms.send();
		}
		
		private function httpResultHandler(event:ResultEvent):void{
			msgList=event.result.msgs.msg;
		}
		
		private function httpFaultHandler(event:FaultEvent):void{
			Alert.show("There was a problem","error");
		}
	]]>
</mx:Script>
<mx:HTTPService id="rooms" url="http://localhost:8080/HttpServletDemo/httpaccess" resultFormat="xml" result="httpResultHandler(event)" fault="httpFaultHandler(event)" method="GET">

	<mx:request>
		<myName1>{nameId1.text}</myName1>
		<myName2>{nameId2.text}</myName2>
		<myName3>{nameId3.text}</myName3>
		<myName4>{nameId4.text}</myName4>
	</mx:request>

</mx:HTTPService>
<mx:List id="httprequestList" dataProvider="{msgList}"/>

<mx:VBox>
	
	<mx:TextInput id="nameId1"/>
	<mx:TextInput id="nameId2"/>
	<mx:TextInput id="nameId3"/>
	<mx:TextInput id="nameId4"/>
	<mx:Button label="Button" click="init()"/>
	
</mx:VBox>	
</mx:Application>

Open in new window

HttpServletDemo.java
0
Comment
Question by:naveenm_006
  • 3
  • 2
  • 2
10 Comments
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35033941
It seems that the url http://localhost:8080/HttpServletDemo/httpaccess is not accessible. Try placing this url in browser directly and see what is coming.

Warm Regards
Deepanjan Das
0
 

Author Comment

by:naveenm_006
ID: 35033985
I have tried like that also.I am getting the following error when i do like that
HTTP Status 404-/HttpServletDemo/httpaccess in browser.
plz find the web.xml for your reference.

Regards,
Naveen.
web.xml
-------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>TestProject</display-name>
  
  <servlet>
    <description></description>
    <display-name>HttpServletDemo</display-name>
    <servlet-name>HttpServletDemo</servlet-name>
    <servlet-class>com.flex.HttpServletDemo</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>HttpServletDemo</servlet-name>
    <url-pattern>/httpaccess</url-pattern>
  </servlet-mapping>
</web-app>

Open in new window

0
 
LVL 17

Expert Comment

by:deepanjandas
ID: 35034055
Sorry Naveen , you need to do a Request Attention. I just provided you a pointed that the error means the page is not accessible. Someone there might be able to help you out with the configuration.

Warm Regards
Deepanjan Das
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 27

Expert Comment

by:mrcoffee365
ID: 35043965
This:
<url-pattern>/httpaccess</url-pattern>

needs to be this:
<url-pattern>/HttpServletDemo/httpaccess</url-pattern>
0
 

Author Comment

by:naveenm_006
ID: 35046931
Hi,
After changing the code to <url-pattern>/HttpServletDemo/httpaccess</url-pattern> i am getting the same problem.ie.,
HTTP Status 404-/HttpServletDemo/httpacces

Here i am attaching code for your reference.


package com.flex;

import java.io.PrintWriter;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class HttpServletDemo
 */
public class HttpServletDemo extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public HttpServletDemo() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter out=response.getWriter();
		String name1=request.getParameter("myName1");
		String name2=request.getParameter("myName2");
		String name3=request.getParameter("myName3");
		String name4=request.getParameter("myName4");
		
		out.println("<msgs>");
		
		out.println("<msg>"+name1+"</msg>");
		out.println("<msg>"+name2+"</msg>");
		out.println("<msg>"+name3+"</msg>");
		out.println("<msg>"+name4+"</msg>");
	}
}

Open in new window

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>TestProject</display-name>
  
  <servlet>
    <description></description>
    <display-name>HttpServletDemo</display-name>
    <servlet-name>HttpServletDemo</servlet-name>
    <servlet-class>com.flex.HttpServletDemo</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>HttpServletDemo</servlet-name>
    <url-pattern>/HttpServletDemo/httpaccess</url-pattern>
  </servlet-mapping>
</web-app>

Open in new window

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
	<![CDATA[
		
		import mx.collections.ArrayCollection;
		import mx.rpc.events.ResultEvent;
		import mx.rpc.events.FaultEvent;
		import mx.controls.Alert;
		
		[Bindable] private var msgList:ArrayCollection;
		
		private function init():void{
			rooms.send();
		}
		
		private function httpResultHandler(event:ResultEvent):void{
			msgList=event.result.msgs.msg;
		}
		
		private function httpFaultHandler(event:FaultEvent):void{
			Alert.show("There was a problem","error");
		}
	]]>
</mx:Script>
<mx:HTTPService id="rooms" url="http://localhost:8080/HttpServletDemo/httpaccess" resultFormat="xml" result="httpResultHandler(event)" fault="httpFaultHandler(event)" method="GET">

	<mx:request>
		<myName1>{nameId1.text}</myName1>
		<myName2>{nameId2.text}</myName2>
		<myName3>{nameId3.text}</myName3>
		<myName4>{nameId4.text}</myName4>
	</mx:request>

</mx:HTTPService>
<mx:List id="httprequestList" dataProvider="{msgList}"/>

<mx:VBox>
	
	<mx:TextInput id="nameId1"/>
	<mx:TextInput id="nameId2"/>
	<mx:TextInput id="nameId3"/>
	<mx:TextInput id="nameId4"/>
	<mx:Button label="Button" click="init()"/>
	
</mx:VBox>	
</mx:Application>

Open in new window

0
 
LVL 27

Accepted Solution

by:
mrcoffee365 earned 500 total points
ID: 35047007
Did you mis-type or mis-cut and paste?  The 404 is:
HTTP Status 404-/HttpServletDemo/httpacces

and you'll see that httpaccess is misspelled.  Fix it and try again.

0
 
LVL 27

Expert Comment

by:mrcoffee365
ID: 35415751
Post what solved the problem, and award points to the experts who helped.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet doXXX methods 3 61
servlet requestdispatcher include and forward differences 1 39
how to install java on RHEL image on EC2 4 39
Problem to Alipay 10 42
Foreword This article was written many years ago, in the days when PHP supported the MySQL extension (http://php.net/manual/en/function.mysql-connect.php).  Today (http://php.net/manual/en/migration70.removed-exts-sapis.php) you would not use MySQL…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question