Solved

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

Posted on 2011-03-03
10
937 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 26

Expert Comment

by:mrcoffee365
Comment Utility
This:
<url-pattern>/httpaccess</url-pattern>

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

Author Comment

by:naveenm_006
Comment Utility
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 26

Accepted Solution

by:
mrcoffee365 earned 500 total points
Comment Utility
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 26

Expert Comment

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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Foreword In the years since this article was written, numerous hacking attacks have targeted password-protected web sites.  The storage of client passwords has become a subject of much discussion, some of it useful and some of it misguided.  Of cou…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now