Solved

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

Posted on 2011-03-03
10
942 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
json example 39 130
JAVA part two 5 56
backtracking recursion  code 19 53
oracle 11g 23 46
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

932 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

10 Experts available now in Live!

Get 1:1 Help Now