?
Solved

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

Posted on 2011-03-03
10
Medium Priority
?
955 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo‚Ķ
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month9 days, 9 hours left to enroll

762 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