Solved

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

Posted on 2011-03-03
10
947 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Suggested Solutions

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
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…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.

822 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