Hi Bill
I changed all that you have said,i changed these lines in java file
_url = (_sequenceFile == null) ?
_destinationURL:
_destinationURL + “?” + SEQUENCER_PROPERTY + “=” + _sequenceFile;
and sequence fie
transformsequence.xml as u said
< !–{Name: step};{Notes: }–>
i am getting error 500
java.io.IOException: Server returned HTTP response code: 500 for URL: http://loc
alhost:8080/orchestrator/OrchestratorGateway?xbd.sequence.uri=http://localhost:8
080/orchestrator/samples/data/transformsequence.xml
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
nection.java:691)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLCon
nection.java:1116)
at java.net.URLConnection.getContentType(URLConnection.java:381)
at MediatorUtility.httpReceive(MediatorUtility.java:190)
at MediatorUtility.getResultsFromMediator(MediatorUtility.java:119)
at MediatorUtility.main(MediatorUtility.java:231)
httpReceive: java.io.IOException: Server returned HTTP response code: 500 for UR
L: http://localhost:8080/orchestrator/OrchestratorGateway?xbd.sequence.uri=http:
//localhost:8080/orchestrator/samples/data/transformsequence.xml
Error! http://localhost:8080/orchestrator/OrchestratorGateway?xbd.sequence.uri=h
ttp://localhost:8080/orchestrator/samples/data/transformsequence.xml: java.io.IO
Exception: Server returned HTTP response code: 500 for URL: http://localhost:808
0/orchestrator/OrchestratorGateway?xbd.sequence.uri=http://localhost:8080/orches
trator/samples/data/transformsequence.xml
********** done **********
First can you please continue a thread rather than starting a new one (just hit Post Reply at the bottom of the page)… but don’t worry about that for now.
Second you seem to have changed your sequence xml file so that the stylesheet location is the same physical file as the sequence file. Please change it to the value I showed you in my original post:
and then make sure that the files item1.xsl and transformsequence.xml are both in the same filesystem location (folder).
If you work carefully through my previous reply I’m sure it will work, but if it still fails, please tell us what output do you have in your Component Factory window when you attempt to run your utility (please cut and paste it in reply to this message).
Thanks.
[This message was edited by Bill Leeney on 30 Dec 2002 at 12:14.]
Hi Bill
The error in tomcat is
******** Servlet name <>
2002-12-30 17:49:12 - Ctx( /orchestrator ): 404 R( /orchestrator + /samples/data
/transformsequece.xml + null) null
2002-12-30 17:49:12 - Ctx( /orchestrator ): 500 R( /orchestrator + /Orchestrator
Gateway + null) No on_error sequence found, simulating “reply”
2002-12-30 17:49:12 - Ctx( /orchestrator ): 404 R( /orchestrator + /samples/data
/transformsequence.xml + null) null
2002-12-30 17:49:12 - Ctx( /orchestrator ): 500 R( /orchestrator + /Orchestrator
Gateway + null) No on_error sequence found, simulating “reply”
The Error in component Factory
2002-12-30 17:49:12,785 ERROR - Error getting sequence=http://localhost:8080/orc
hestrator/samples/data/transformsequece.xml
com.softwareag.xbridge.exceptions.DocumentParseException: com.softwareag.xbridge
.exceptions.DocumentParseException com.softwareag.xbridge.exceptions.DocumentPar
seException Document parse exception detected ERROR error at line number 0: File
“http://localhost:8080/orchestrator/samples/data/transformsequece.xml” not foun
d.
at com.softwareag.xbridge.util.DocumentParser.parse(DocumentParser.java:
165)
at com.softwareag.xbridge.sequencer.SequencerResource.resolve(SequencerR
esource.java:103)
at com.softwareag.xbridge.sequencer.SequencerResource.(SequencerRe
source.java:93)
at com.softwareag.xbridge.sequencer.SequencerResource.getInstance(Sequen
cerResource.java:156)
at com.softwareag.xbridge.sequencer.SequencerResource.getResource(Sequen
cerResource.java:198)
at com.softwareag.xbridge.sequencer.SequencerResource.getResource(Sequen
cerResource.java:172)
at com.softwareag.xbridge.sequencer.SequencerImpl.getElementToExecute(Se
quencerImpl.java:218)
at com.softwareag.xbridge.sequencer.SequencerImpl.dispatch(SequencerImpl
.java:121)
at com.softwareag.xbridge.infrastructure.DispatcherImpl$MessageDispatche
r.perform(DispatcherImpl.java:214)
at com.softwareag.xbridge.util.WorkerThread.run(ThreadPool.java:365)
2002-12-30 17:49:12,885 ERROR - Error getting sequence=http://localhost:8080/orc
hestrator/samples/data/transformsequence.xml
com.softwareag.xbridge.exceptions.DocumentParseException: com.softwareag.xbridge
.exceptions.DocumentParseException com.softwareag.xbridge.exceptions.DocumentPar
seException Document parse exception detected ERROR error at line number 0: File
“http://localhost:8080/orchestrator/samples/data/transformsequence.xml” not fou
nd.
at com.softwareag.xbridge.util.DocumentParser.parse(DocumentParser.java:
165)
at com.softwareag.xbridge.sequencer.SequencerResource.resolve(SequencerR
esource.java:103)
at com.softwareag.xbridge.sequencer.SequencerResource.(SequencerRe
source.java:93)
at com.softwareag.xbridge.sequencer.SequencerResource.getInstance(Sequen
cerResource.java:156)
at com.softwareag.xbridge.sequencer.SequencerResource.getResource(Sequen
cerResource.java:198)
at com.softwareag.xbridge.sequencer.SequencerResource.getResource(Sequen
cerResource.java:172)
at com.softwareag.xbridge.sequencer.SequencerImpl.getElementToExecute(Se
quencerImpl.java:218)
at com.softwareag.xbridge.sequencer.SequencerImpl.dispatch(SequencerImpl
.java:121)
at com.softwareag.xbridge.infrastructure.DispatcherImpl$MessageDispatche
r.perform(DispatcherImpl.java:214)
at com.softwareag.xbridge.util.WorkerThread.run(ThreadPool.java:365)
So you can see from the error in the Factory window that your code is still trying to load “transformsequece.xml”:
2002-12-30 17:49:12,785 ERROR - Error getting sequence=http://localhost:8080/orc
hestrator/samples/data/transformsequece.xml
Have you really corrected and recompiled your code? If so I can only suggest you restart the Factory and Tomcat and try again…
BBill,
I compiled my code properly,i verified it again
when u see little down in the error which i had send u will find transformsequence.xml also
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStreamReader;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.Vector;
import java.util.Enumeration;
import java.net.HttpURLConnection;
import java.net.ProtocolException;
/
* The MediatorUtility class is used to
* post requests to mediator and recieve response
*
*/
public class MediatorUtility
{
//need to remove hardcoded values
final static String HTTP_PROTOCOL = “http:”;
final static String ORCHESTRATOR_NAME = “orchestrator”;
final static String XBRIDGE_WEB = “xbridge.web”;
final static String PORTAL_SERVLET = “portal.servlet”;
final static String TYPE_TEXT_XML = “text/xml”;
final static String S_CONTENT_TYPE = “Content-Type”;
final static String S_SLASH = “/”;
final static String TYPE_APPLICATION_XML = “application/xml”;
final static String SEQUENCER_PROPERTY = “xbd.sequence.uri”;
static final String DEFAULT_XBRIDGE_WEB = “default_xbridge.web”;
static final String DEFAULT_PORTAL_SERVLET = “default_portal.servlet”;
static String _destinationURL = null;
static byte[] _dataArray = null;
static String _url = null;
static String _sequenceFile = null;
/
* getResultsFromMediator will send the input XML and sequence file to the specified servlet passed through the
* system property, portal.servlet. The default servlet is
* OrchestratorGateway. If the servlet is OrchestratorGateway,
* an additional argument, the URL format of sequence file will
* be required.
* Note that the MediatorUtility only support the “POST” method.
/
public static byte[] getResultsFromMediator(String argSequenceFile, String argInputXML)throws Exception{
HttpURLConnection _httpConnection = null;
// use System.getProperty to figure out where the xbridge web is
// and what the portal servlet is
String xbridgeWeb = System.getProperty (XBRIDGE_WEB, “//localhost:8080/orchestrator”);
String portalServlet = System.getProperty (PORTAL_SERVLET, “OrchestratorGateway”);
_sequenceFile=argSequenceFile;
// get the destination URL
_destinationURL = HTTP_PROTOCOL + xbridgeWeb + S_SLASH + portalServlet;
//_destinationURL =“http://localhost:8080/orchestrator/OrchestratorGateway”;
//OrchestratorGateway";
//OrchestratorGateway";
_dataArray=argInputXML.getBytes();
// get the URL for HTTP protocol
_url = (_sequenceFile == null) ?
_destinationURL:
_destinationURL + “?” + SEQUENCER_PROPERTY + “=” + _sequenceFile;
System.out.println("URL: " + _url);
// get the HTTP URL
URL httpURL = null;
try {
httpURL = new URL(_url);
} catch(MalformedURLException e) {
System.out.println("new URL: " + _url + e.toString());
//throw new MediatorConnectionException(e);
}
// open the HTTP URL connection
try {
_httpConnection =(HttpURLConnection) httpURL.openConnection();
} catch(IOException e) {
System.out.println("Cannot open URL connection: " + e.toString());
//throw new MediatorConnectionException(e);
}
// mo caching of documents
_httpConnection.setUseCaches(false);
// only support the “POST” method
try {
_httpConnection.setRequestMethod(“POST”);
} catch(ProtocolException e) {
System.out.println(“setRquestMethod: " + e.toString());
}
// use the URL connection for output
_httpConnection.setDoOutput(true);
// set the default value of a general request property
_httpConnection.setRequestProperty(S_CONTENT_TYPE, TYPE_TEXT_XML);
// use the URL connection for input
_httpConnection.setDoInput(true);
// send the document and receive the reply through the HTTP connection
int responseCode = 0;
byte[] rDataArray = null;
try{
httpSend(_httpConnection);
System.out.println(“send was sucessfull”);
rDataArray = httpReceive(_httpConnection);
// get and check the three digit HTTP status code where
// 1xx: Informational
// 2xx: Success
// 3xx: Redirection
// 4xx: Client Error
// 5xx: Server Error
responseCode = _httpConnection.getResponseCode();
System.out.println(”-----> Response Code: " + responseCode);
// print the error message if the status code is not 200 (HTTP_OK)
if (responseCode != HttpURLConnection.HTTP_OK) {
System.out.println(“HttpURLConnection response error\n”+responseCode);
//throw new LicenseChkrException(“some error occured while connecting to mediator”);
return null;
}
return rDataArray;
} catch(Exception e) {
System.out.println("Error! " + _url + “: " + e.toString());
return null;
}finally{
// disconnet the HTTP connection
_httpConnection.disconnect();
System.out.println(”******** done **********\n");
}
}
/
* httpSend will send the document out through the opened
* HTTP connection.
*/
private static void httpSend(HttpURLConnection _httpConnection) throws Exception
{
System.out.println(“httpSend: … start …”);
int responseCode = 0;
String msg = null;
try {
System.out.println(“>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n” + new String(_dataArray));
// write the document to the output stream of the HTTP connection
_httpConnection.getOutputStream().write(_dataArray);
System.out.println(“>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n”);
} catch(IOException e) {
msg = "httpSend: " + e.toString();
System.out.println(msg);
throw new Exception(msg);
} finally {
// close the output stream of the HTTP connection if error
_httpConnection.getOutputStream().close();
}
System.out.println("httpSend: … done … bytes sent: " + _dataArray.length);
}
/
* httpReceive will receive the reply document through the opened
* HTTP connection.
*/
private static byte httpReceive(HttpURLConnection _httpConnection) throws Exception
{
System.out.println(“httpReceive: … start …”);
int rContentLength = 0;
byte rDataArray = null;
// get the content type
String rContentType = _httpConnection.getContentType();
// use application/xml if no content type is specified
if (rContentType == null)
rContentType = TYPE_APPLICATION_XML;
// read the document from the output stream of the HTTP connection
byte buf = new byte[4096];
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream ();
InputStream is = _httpConnection.getInputStream ();
for (int i=0; (i=is.read (buf, 0, 4096)) != -1; ) baos.write (buf, 0, i);
rDataArray = new byte[rContentLength=baos.size ()];
rDataArray = baos.toByteArray ();
} catch(IOException e) {
// cannot receive for some reason
String eMsg = "httpReceive: " + e.toString();
e.printStackTrace();
System.out.println(eMsg);
throw new Exception(e.getMessage());
} finally {
// close the output stream of the HTTP connection if error
_httpConnection.getInputStream().close();
}
// print the content type, content length, and the document
System.out.println("httpReceive: Content-Type: " + rContentType +
“, Content-Length: " + rContentLength + “\n” +
“<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n” + new String[rDataArray) + “\n” +
“<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n” +
“httpReceive: … done … bytes received: " + rContentLength);
return rDataArray;
}
public static void main(String args)throws Exception{
System.out.println(“Checking for valid license”);
String inputXML=”<?xml version='1.0'?>ramakrishna cellexchangeKKK KKKKKKKK chess cricket KKKKKKKK shoban business KKKKKKKKvollyballtennis KKKKKKKK ”;
MediatorUtility.getResultsFromMediator(“http://localhost:8080/orchestrator/samples/data/transformsequece.xml”, inputXML);
MediatorUtility.getResultsFromMediator(“http://localhost:8080/orchestrator/samples/data/transformsequence.xml”, inputXML);
}
} // MediatorUtility
OK I missed that -sorry- but it is still just a File Not Found Exception. If you make sure that the file
http://localhost:8080/orchestrator/samples/data/transformsequence.xml can be found, this problem will go away. Please put your “transformsequence.xml” file into directory /webapps/orchestrator/samples/data
and try again.
Bill i kept my transformsequence.xml in
http://localhost:8080/orchestrator/samples/data/trasformsequence.xml and item1.xsl in same location
i could access this thru browser
Regards
Dacha
In your last post you mention file
http://localhost:8080/orchestrator/samples/data/trasformsequence.xml
but the file we want to load is called
n[/b]sformsequence.xml]http://localhost:8080/orchestrator/samples/data/transformsequence.xml
Was this just a typo in your posting or a real problem in your filename?
Bill,
It was a typo,yes i got…there was some problem with item.xsl
Thanks a lot for all the help u extended
Regards
Dacha
…glad it worked!