Skip to Content
0
Former Member
Jun 16, 2006 at 04:44 AM

[Fatal Error] :-1:-1: Premature end of file.

217 Views

Hi

I am referring this blog:

/people/siva.maranani/blog/2005/09/15/push-data-to-mvc-architectured-application-using-xi

I am doing a HTTP Receiver adapter.

I developed an Enterprise module and deployed onto Weblogic server, in weblogic server's console am getting this error:[Fatal Error] :-1:-1: Premature end of file.

I am using a HTTP Client prog to test. These are the params that iam giving in Client:

Server Host:server Port:8000

Sender Service: FTH_BS Interface:Name_MI

InterfaceNamespace:htpp://httpdemo.com

XML Payload:

<?xml version="1.0" encoding="UTF-8"?>

http://httpdemo.com">

<Name>aaa</Name>

</ns0:Name_MT>

===========

My servlet which should receive the name in XML payload and displays.

public class Response extends HttpServlet {

protected void doGet(

HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException {

doPost(request,response);

}

protected void doPost(

HttpServletRequest req,

HttpServletResponse res)

throws ServletException, IOException {

res.setContentType("text/xml;charset=UTF-8");

PrintWriter out = res.getWriter();

String Name = parseXML(req);

String SalName = Saluation(Name);

out.println(contructXML(SalName));

}

public String parseXML(HttpServletRequest req){

StringBuffer inputXML = new StringBuffer();

String Name="";

try{

BufferedReader in = req.getReader();

String line = null;

while( (line = in.readLine()) != null){

inputXML.append(line);

}

}catch(Exception ex){

}

StringReader strReader = new StringReader(inputXML.toString());

InputSource inputsource = new InputSource(strReader);

try{

DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();

Document document = builder.parse(inputsource );

NodeList Name_nlist = document.getElementsByTagName("Name");

Node Name_node = Name_nlist.item(0);

Element Name_Ele = (Element)Name_node;

Name = Name_Ele.getFirstChild().getNodeValue();

}catch(Exception ex){

}

return Name;

}

public String contructXML(String SalName){

StringBuffer output = new StringBuffer();

output.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

output.append(" http://filetohttp.com\">");

output.append("<SalName>");

output.append(SalName);

output.append("</SalName>");

output.append("</ns0:name_MT>");

return output.toString();

}

public String Saluation(String Name){

return "Hai "+Name ;

}

}

Help me, Thanks

Regards,

ganesh