Hi Chris,
the servlet contains no rocket science, so I am comfortable posting it
completely ;) Error arrises on part marked with <<<ERROR>>>. The code reading
the stream is generated by XMLBeans.
Is there something that I should not do with the stream? For example
closing it or something like that?
Best regards and thanks for looking into the problem
Stefan
/**
* Servlet implementation class XMLServiceServlet
*/
public class XMLServiceServlet extends HttpServlet {
private XmlOptions xmlOptions = new XmlOptions();
private static final long serialVersionUID = 1L;
private RequestTransformer reqT = new RequestTransformer();
private ResponseTransformer respT = new ResponseTransformer();
/**
* @see HttpServlet#HttpServlet()
*/
public XMLServiceServlet() {
HashMap<String, String> namespaceMap = new HashMap<String,
String>();
// namespaceMap.put("", "http://cirquent.de/XcelsiusTable");
// namespaceMap.put("http://cirquent.de/XcelsiusTable","");
xmlOptions.setLoadSubstituteNamespaces(namespaceMap);
}
/**
* @see HttpServlet#doGet(HttpServletRequest request,
HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
handleRequest(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request,
HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
handleRequest(request, response);
}
private void handleRequest(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
InputStream is = request.getInputStream();
DataDocument dDoc = getDocument(is);
DataDocument resultDoc = this.callService(dDoc);
response.getOutputStream().write(resultDoc.toString().getBytes());
response.setHeader("Connection", "close");
}
private DataDocument getDocument(InputStream is) {
DataDocument inDoc = null;
try {
<<<ERROR>>>
inDoc = DataDocument.Factory.parse(is, xmlOptions);
<<<END_OF_ERROR>>>
} catch (Exception ex) {
ex.printStackTrace();
}
return inDoc;
}
private DataDocument callService(DataDocument dDoc) {
boolean test = false;
if(test){
TestTransformer tt = new TestTransformer();
tt.getRequestFromDataDocument(dDoc);
return tt.getDataDocumentFromResponse(null);
}
try {
GetQueryViewData request =
reqT.getRequestFromDataDocument(dDoc);
mc_style.functions.soap.sap.document.sap_com.Query_view_dataServiceStub stub =
new
mc_style.functions.soap.sap.document.sap_com.Query_view_dataServiceStub();// the
GetQueryViewDataResponse response =
stub.GetQueryViewData(request);
return respT.getDataDocumentFromResponse(response);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
}
-----Ursprüngliche Nachricht-----
Von: Christopher Schultz [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 4. Dezember 2008 23:22
An: Tomcat Users List
Betreff: Re: AW: java.io.IOException: Stream closed
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Stafan,
Schuster Stefan wrote:
> I still have the problem mentioned below. I just don't have any idea
> where to start with problem solving? Can it be a problem in Tomcat? I guess
> not as this is a very simple use-case (read the stream in the servlet) and
> it would have probably come up ealier...
In case you didn't see my other post, please post as much of your
de.cirquent.nwfi.xcelsius.XMLServiceServlet as you can.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkk4WAwACgkQ9CaO5/Lv0PDtMQCeKRYlIZ+IztOUenCtEvMO3jKI
XuwAn39eTXUhNbb7Krz2FQDNMW9rc3Oh
=jQeB
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]