Error: No valid XML document received*_
Hi All,
We are connecting our CCMS system to NetWeaver J2EE engine on which E-Sourcing is running.
For this we registered java component and hosts in cen.
But we are getting error as : No valid XML document received
Please can anyone tell me how to overcome this error.
Thank you .
Regards
Mahesh
Hi,
Please re-read the answer from Marc carefully. He was in the exact same situation as yours:
- Monitored system: NW CE 7.1
- CEN: NW 7.01 (same as NW 7.0 EhP1)
The link you posted is for CEN with NW 7.3 and monitored systems from NW 7.02 (and up). Read the paragraph below the Caution sign:
If you want to centrally monitor any system with a central monitoring system with release SAP NetWeaver 7.0, this procedure is not applicable. In this case, follow the procedure described in the newest Monitoring Setup Guide for SAP NetWeaver 7.0 instead. You can obtain the Monitoring Setup Guide at the Internet address service.sap.com/operationsnw70 in the Monitoring area.
You should look for (and follow) the right Monitoring Setup Guide as mentioned.
Regards,
Dao
Edited by: Dao Ha on Sep 19, 2011 10:38 AM
Similar Messages
-
No valid XML document received
Hi All,
We are connecting our CCMS system to NetWeaver J2EE engine on which E-Sourcing is running.
For this we registered java component and hosts in cen.
But we are getting error as : No valid XML document received
Please can anyone tell me how to overcome this error.
Thank you .
Regards
MaheshHi,
Please re-read the answer from Marc carefully. He was in the exact same situation as yours:
- Monitored system: NW CE 7.1
- CEN: NW 7.01 (same as NW 7.0 EhP1)
The link you posted is for CEN with NW 7.3 and monitored systems from NW 7.02 (and up). Read the paragraph below the Caution sign:
If you want to centrally monitor any system with a central monitoring system with release SAP NetWeaver 7.0, this procedure is not applicable. In this case, follow the procedure described in the newest Monitoring Setup Guide for SAP NetWeaver 7.0 instead. You can obtain the Monitoring Setup Guide at the Internet address service.sap.com/operationsnw70 in the Monitoring area.
You should look for (and follow) the right Monitoring Setup Guide as mentioned.
Regards,
Dao
Edited by: Dao Ha on Sep 19, 2011 10:38 AM -
Error in validating XML against schema
Hi am getting some critical errors while Validating XML against schema
error is:
cvc-elt.1: Cannot find the declaration of element 'position' , here <position> is my root element.
my code is as follows:
package com.glemser.xmLabeling.library.component.spl;
import com.documentum.com.DfClientX;
import com.documentum.com.IDfClientX;
import com.documentum.fc.client.IDfClient;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.client.IDfSessionManager;
import com.glemser.common.helper.OperationHelper;
import org.xml.sax.*;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.InputStream;
public class Test {
static IDfSession m_session;
public static void main(String[] args) {
try {
new Test().validate();
} catch (Exception e) {
e.printStackTrace();
private XMLReader xmlReader;
private DefaultHandler handler; // Defines the handler for this parser
private boolean valid = true;
public void validate() {
try {
SetXML setXML = new SetXML();
OperationHelper operation = new OperationHelper();
String splObjPath = "C://Documents and Settings/dparikh/My Documents/xmLabelingStage/Test.xml";//operation.executeExportOperation(m_session, new DfId(m_objectId), true);
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(false);
spf.setValidating(true);
spf.setFeature("http://xml.org/sax/features/validation", true);
spf.setFeature("http://apache.org/xml/features/validation/schema", true);
spf.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
if (spf.isValidating()) {
System.out.println("The parser is validating");
javax.xml.parsers.SAXParser sp = spf.newSAXParser();
sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
sp.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation", "file://C:/Documents and Settings/dparikh/My Documents/xmLabelingStage/Test.xsd");
System.out.println("The parser is validating1");
//Create XMLReader
xmlReader = sp.getXMLReader();
xmlReader.setFeature("http://apache.org/xml/features/validation/schema", true);
xmlReader.setEntityResolver(new SchemaLoader());
ContentHandler cHandler = new MyDefaultHandler();
ErrorHandler eHandler = new MyDefaultHandler();
xmlReader.setContentHandler(cHandler);
xmlReader.setErrorHandler(eHandler);
System.out.println("The parser is validating2");
parseDocument(splObjPath);
} catch (SAXException se) {
se.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
public void parseDocument(String xmlFile) {
try {
xmlReader.parse(xmlFile);
if (valid) {
System.out.println("Document is valid!");
} catch (SAXException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
class MyDefaultHandler extends DefaultHandler {
private CharArrayWriter buff = new CharArrayWriter();
private String errMessage = "";
/* With a handler class, just override the methods you need to use
// Start Error Handler code here
public void warning(SAXParseException e) {
System.out.println("Warning Line " + e.getLineNumber() + ": " + e.getMessage() + "\n");
public void error(SAXParseException e) {
errMessage = new String("Error Line " + e.getLineNumber() + ": " + e.getMessage() + "\n");
System.out.println(errMessage);
valid = false;
public void fatalError(SAXParseException e) {
errMessage = new String("Error Line " + e.getLineNumber() + ": " + e.getMessage() + "\n");
System.out.println(errMessage);
valid = false;
public class SchemaLoader implements EntityResolver {
public static final String FILE_SCHEME = "file://";
public InputSource resolveEntity(String publicId, String systemId) throws SAXException {
if (systemId.startsWith(FILE_SCHEME)) {
String filename = systemId.substring(FILE_SCHEME.length());
InputStream stream = SchemaLoader.class.getClassLoader().getResourceAsStream(filename);
return new InputSource(stream);
} else {
return null;
My XML and XSD are as below:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="position" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="position_number" type="xsd:string"/>
<xsd:element name="position_title" type="xsd:string"/>
<xsd:element name="report_to_position" type="xsd:string"/>
<xsd:element name="incumbent" type="xsd:string"/>
<xsd:element name="operation" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<position xsi:schemaLocation="Test.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<position_number>12345</position_number>
<position_title>Sr. Engr</position_title>
<report_to_position>23456</report_to_position>
<incumbent>23456</incumbent>
<operation>INSERT</operation>
</position
Please help me out--> Could not find cached enumeration value Custom.CI.Enum.PeripheralDevice.Printer for property Type, class BMC.Custom.CI.PeripheralDevice in enumeration cache.
You must specify either the Name or Guid of an enumeration of type Custom.CI.Enum.PeripheralDevice.Type.
Be sure that you are specifying the Name property of the enumeration value you want to set, and not the DisplayName; the Internal Name is something like "IncidentCategoryEnum.Category" for out of the box enumerations, or ENUM.210ADA2282FDABC3210ADA2282FDABC
for enumerations created in the console.
you can check this by finding the enumeration in the XML or by using the the
SMLets commandlet
Get-SCSMEnumeration | ?{$_.DisplayName –eq “Printer”}
and then checking your value with
Get-SCSMEnumeration -Name "ENUM.210ADA2282FDABC3210ADA2282FDABC"
and see if you get the right displayname back -
Heap space error while creating XML document from Resultset
I am getting Heap space error while creating XML document from Resultset.
It was working fine from small result set object but when the size of resultset was more than 25,000, heap space error
I am already using -Xms32m -Xmx1024m
Is there a way to directly write to xml file from resultset instead of creating the whole document first and then writing it to file? Code examples please?
here is my code:
stmt = conn.prepareStatement(sql);
result = stmt.executeQuery();
result.setFetchSize(999);
Document doc = JDBCUtil.toDocument(result, Application.BANK_ID, interfaceType, Application.VERSION);
JDBCUtil.write(doc, fileName);
public static Document toDocument(ResultSet rs, String bankId, String interfaceFileType, String version)
throws ParserConfigurationException, SQLException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
Element results = doc.createElement("sims");
results.setAttribute("bank", bankId);
results.setAttribute("record_type", "HEADER");
results.setAttribute("file_type", interfaceFileType);
results.setAttribute("version", version);
doc.appendChild(results);
ResultSetMetaData rsmd = rs.getMetaData();
int colCount = rsmd.getColumnCount();
String columnName="";
Object value;
while (rs.next()) {
Element row = doc.createElement("rec");
results.appendChild(row);
for (int i = 1; i <= colCount; i++) {
columnName = rsmd.getColumnLabel(i);
value = rs.getObject(i);
Element node = doc.createElement(columnName);
if(value != null)
node.appendChild(doc.createTextNode(value.toString()));
else
node.appendChild(doc.createTextNode(""));
row.appendChild(node);
return doc;
public static void write(Document document, String filename) {
//long start = System.currentTimeMillis();
// lets write to a file
OutputFormat format = new OutputFormat(document); // Serialize DOM
format.setIndent(2);
format.setLineSeparator(System.getProperty("line.separator"));
format.setLineWidth(80);
try {
FileWriter writer = new FileWriter(filename);
BufferedWriter buf = new BufferedWriter(writer);
XMLSerializer FileSerial = new XMLSerializer(writer, format);
FileSerial.asDOMSerializer(); // As a DOM Serializer
FileSerial.serialize(document);
writer.close();
} catch (IOException ioe) {
ioe.printStackTrace();
//long end = System.currentTimeMillis();
//System.err.println("W3C File write time :" + (end - start) + " " + filename);
}you can increase your heap size..... try setting this as your environment variable.....
variable: JAVA_OPTS
value: -Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m -
Error while getting xml document with default connection in 8iJServer
I had used GZIP utility to zip and store the document in
the CLOB. If i use thin drivers and GZIP to retieve this document it works fine.
instead of thin drivers if i use oracle8iJserver defalut
connection i get the follwing error
:Error while getting xml document Not in GZIP format.
your response is appreciated.
thanks
sanjay.Hi Yepin Jin,
I am facing the same issue did you solved it?
Regards,
Orlando Covault -
Very urgent help needed- Error while passing XML document to Oracle stored
Hi !
I have been struggling a lot to call Oracle 9i stored procedure passing Stringbuilder object type from ASP.NET
I am using Visual Studio 2008 Professional, OS: Windows XP and Oracle: 9.2.0.1.0
Following is the procedure:
CREATE or REPLACE PROCEDURE loadCompanyInfo (clobxml IN clob) IS
-- Declare a CLOB variable
ciXML clob;
BEGIN
-- Store the Purchase Order XML in the CLOB variable
ciXML := clobxml;
-- Insert the Purchase Order XML into an XMLType column
INSERT INTO companyinfotbl (companyinfo) VALUES (XMLTYPE(ciXML));
commit;
--Handle the exceptions
EXCEPTION
WHEN OTHERS THEN
raise_application_error(-20101, 'Exception occurred in loadCompanyInfo procedure :'||SQLERRM);
END loadCompanyInfo ;
And following is the ASP.net code:
StringBuilder b = new StringBuilder();
b.Append("<?xml version=\"1.0\" encoding=\"utf-8\" ?>");
b.Append("<item>");
b.Append("<price>500</price>");
b.Append("<description>some item</description>");
b.Append("<quantity>5</quantity>");
b.Append("</item>");
//Here you'll have the Xml as a string
string myXmlString1 = b.ToString();
//string result;
using (OracleConnection objConn = new OracleConnection("Data Source=testdb; User ID=testuser; Password=pwd1"))
OracleCommand objCmd = new OracleCommand();
objCmd.Connection = objConn;
objCmd.CommandText = "loadCompanyInfo";
objCmd.CommandType = CommandType.StoredProcedure;
//OracleParameter pmyXmlString1 = new OracleParameter("pmyXmlString1", new OracleString(myXmlString1));
objCmd.Parameters.Add("myXmlString1", OracleType.clob);
objCmd.Parameters.Add(myXmlString1).Direction = ParameterDirection.Input;
//objCmd.Parameters.Add("result", OracleType.VarChar).Direction = ParameterDirection.Output;
try
objConn.Open();
objCmd.ExecuteNonQuery();
catch (Exception ex)
Label1.Text = "Exception: {0}" + ex.ToString();
objConn.Close();
When I am trying to execute it, I am getting the following error:
Exception: {0}System.Data.OracleClient.OracleException: ORA-06550: line 1, column 7: PLS-00306: wrong number or types of arguments in call to 'LOADCOMPANYINFO' ORA-06550: line 1, column 7: PL/SQL: Statement ignored at System.Data.OracleClient.OracleConnection.CheckError(OciErrorHandle errorHandle, Int32 rc) at System.Data.OracleClient.OracleCommand.Execute(OciStatementHandle statementHandle, CommandBehavior behavior, Boolean needRowid, OciRowidDescriptor& rowidDescriptor, ArrayList& resultParameterOrdinals) at System.Data.OracleClient.OracleCommand.ExecuteNonQueryInternal(Boolean needRowid, OciRowidDescriptor& rowidDescriptor) at System.Data.OracleClient.OracleCommand.ExecuteNonQuery() at Default.Button1Click(Object sender, EventArgs e)
I understand from this that the .net type is not the correct one, but I am not sure how to correct it. I could not find any proper example in any documentation that I came across. Most of the examples give information on how to read but not how to insert XML into Oracle table by calling Stored Procedure.
Can you please help me to solve this problem? I hope that you can help solve this.
Also, can you please give me an example of passing XML document XMLdocument to Oracle Stored procedure.
In both the cases, if you can provide the working code then it would be of great help.
Thanks,Hi ,
Additional to the Above error details my BPEL code looks like this:
<process name="BPELProcess1"
targetNamespace="http://xmlns.oracle.com/Application10/Project10/BPELProcess1"
xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
xmlns:client="http://xmlns.oracle.com/Application10/Project10/BPELProcess1"
xmlns:ora="http://schemas.oracle.com/xpath/extension"
xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
<partnerLinks>
<partnerLink name="bpelprocess1_client" partnerLinkType="client:BPELProcess1" myRole="BPELProcess1Provider" partnerRole="BPELProcess1Requester"/>
</partnerLinks>
<variables>
<variable name="inputVariable" messageType="client:BPELProcess1RequestMessage"/>
<variable name="outputVariable" messageType="client:BPELProcess1ResponseMessage"/>
</variables>
<sequence name="main">
<receive name="receiveInput" partnerLink="bpelprocess1_client" portType="client:BPELProcess1" operation="process" variable="inputVariable" createInstance="yes"/>
<invoke name="callbackClient" partnerLink="bpelprocess1_client" portType="client:BPELProcess1Callback" operation="processResponse" inputVariable="outputVariable"/>
</sequence>
</process>
Kindly help if anyone has faced this Issue before.
Regards,
Rakshitha -
Validating XML documents against a DTD
Guys I am new to XML and I have this requirement to validate a XML document against a DTD.This validation has to be done through my java application.In short , a user enters a XML data thru a JSP form ,and moment he presses the SAVE button my java program should validate the XML data against a DTD and then display any error or else save the data into an Oracle table.
I was wondering lot of program/utitlities must be available out there which will do the validation for me ,rather than me re-inventing the wheel.
Please advice.
Thanks
Manohar.You should go through this to learn more on XML with Java :
http://www.onjava.com/pub/a/onjava/excerpt/learnjava_23/index1.html
You can check following how to to parse XML doc against a schema
http://otn.oracle.com/sample_code/tech/java/codesnippet/xdk/SchemaValidation/SchemaValidation.html
You should also look at chapter 4 of following doc for parsing XML using java :
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96621/toc.htm
Chandar -
Error when emailing XML document
Hi there
I am trying to email an XML document to an external vendor by using the CL_DOCUMENT_BCS class. The email is sent successfully and I receive it in the relevant mailbox. To make it an XML document, I move 'XML' to the I_TYPE parameter of the class. This sends it perfectly as an XML document.
The problem occurs when I receive the email and open the attachment. When I open the attachment, I get the error "Whitespace is not allowed at this location". To rectify this problem, I open the XML attachment in notepad, concatenate these lines by deleting the return characters and I save the file and open it again. It then displays perfectly.
When I send the email as a normal text document and I change the extension manually to 'XML', the XML can be viewed perfectly.
Can anyone assist in rectifying this so that there is no manual intervention?
Kind Regards
Gustav ColeskeRaja
The code is as follows:
FORM send_data_via_email .
DATA: new_object_id LIKE sofolenti1-object_id,
l_idx LIKE sy-tabix.
All activities done via facade CL_BCS!
DATA: send_request TYPE REF TO cl_bcs.
DATA: text TYPE bcsy_text.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: bcs_exception TYPE REF TO cx_bcs.
DATA: lt_contents TYPE TABLE OF soli.
DATA: lt_contents2 TYPE TABLE OF solix.
DATA: lv_subject TYPE sood-objdes VALUE 'Rental Units'.
DATA: lv_length TYPE i.
DATA: lv_receiver_email_address TYPE adr6-smtp_addr.
DATA: lv_string TYPE string.
Select the record for email address to send to off parameter table
SELECT SINGLE value FROM zca_partr INTO gs_real_recipients-receiver
WHERE progid = sy-repid
AND id = 'OUT_EMAIL'.
APPEND gs_real_recipients TO gt_real_recipients.
CLEAR gs_real_recipients.
CLEAR new_object_id.
gv_items_sent = 'X'.
Send back non-delivery and delivery reports.
LOOP AT gt_real_recipients INTO gs_real_recipients.
gs_real_recipients-notif_del = 'X'.
gs_real_recipients-notif_ndel = 'X'.
gs_real_recipients-express = gv_express.
MODIFY gt_real_recipients FROM gs_real_recipients.
ENDLOOP.
gt_contents[] = gt_xml_out[].
Set the subject of the email
lv_subject = 'Rental Units for rent'.
gs_packing_list-mail_subject = lv_subject.
gs_packing_list-doc_type = 'XML'.
TRY.
Create persistent send request
send_request = cl_bcs=>create_persistent( ).
Create and set document
Create document from internal table with lt_content
lt_contents[] = gt_contents[].
DESCRIBE TABLE lt_contents[] LINES lv_length.
gs_packing_list-doc_size = lv_length * 255.
document = cl_document_bcs=>create_document(
i_type = gs_packing_list-doc_type
i_text = lt_contents
i_length = gs_packing_list-doc_size
i_subject = lv_subject
i_language = sy-langu
Set the subject for the sending of mails.
lv_string = gs_packing_list-mail_subject.
TRY .
CALL METHOD send_request->set_message_subject
EXPORTING
ip_subject = lv_string.
CATCH cx_sy_dyn_call_illegal_method .
ENDTRY.
Add document to send request
CALL METHOD send_request->set_document( document ).
Do send delivery info for successful mails
CALL METHOD send_request->set_status_attributes
EXPORTING
i_requested_status = 'E'
i_status_mail = 'A'.
Set sender
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
Add recipients (e-mail addresses)
LOOP AT gt_real_recipients INTO gs_real_recipients.
Create recipient
lv_receiver_email_address = gs_real_recipients-receiver.
CHECK lv_receiver_email_address IS NOT INITIAL.
recipient = cl_cam_address_bcs=>create_internet_address(
lv_receiver_email_address ).
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'
i_blind_copy = gs_real_recipients-blind_copy.
ENDLOOP.
Send document
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = gv_sent_to_all ).
Exception handling
CATCH cx_bcs INTO bcs_exception.
WRITE: text-001 , bcs_exception->error_type.
EXIT.
ENDTRY.
COMMIT WORK.
ENDFORM. " send_data_via_email
I am not using the add_attachment method as the normal document create automatically creates the attachment. Would using this method be critical?
Kind Regards
Gustav -
Validating XML document in Workshop 8.1
Hi,
I am new to Workshop. I have little experience with SAX or DOM. I found them
very confusing.
I am hoping Workshop 8.1 will provide a more user friendly solution. For a web
application, on
the client side, can Workshop validate an XML document, which is created from
user entries on
a browser form (Inquiry phase), against a predefined schema? Upon sucessful validation,
the
client invokes the web service which returns the result of the inquiry. Upon
receiving the result,
can the client augment the result with additional information from an external
schema before
displaying the result on the browser?
Thanks
MikeMike,
XMlbeans would provide with functionality to do what you are trying to do.
Please refer to the SchemaChoice.jws sample which is shipped with Workshop.
This sample shows how the document can be validated against a schema.
Please refer to the following document for more information on this
http://workshop.bea.com/xmlbeans/docindex.html
Hope this helps.
Regards,
Raj Alagumalai
WebLogic Workshop Support
"Michael Wong" <[email protected]> wrote in message
news:[email protected]..
>
Hi,
I am new to Workshop. I have little experience with SAX or DOM. I foundthem
very confusing.
I am hoping Workshop 8.1 will provide a more user friendly solution. Fora web
application, on
the client side, can Workshop validate an XML document, which is createdfrom
user entries on
a browser form (Inquiry phase), against a predefined schema? Uponsucessful validation,
the
client invokes the web service which returns the result of the inquiry.Upon
receiving the result,
can the client augment the result with additional information from anexternal
schema before
displaying the result on the browser?
Thanks
Mike -
Error in validation.xml file while deploying in server
Hi friends,
I am Venkataramana . I am doing one small structs application with Validation . as usual in XML file i wrote validations but when i am deploying in server it is showing error as
SEVERE: Parse Error at line 2 column 17: Document is invalid: no grammar found.
org.xml.sax.SAXParseException: Document is invalid: no grammar found.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
and
Jan 11, 2010 11:57:53 PM org.apache.commons.digester.Digester error
SEVERE: Parse Error at line 2 column 17: Document root element "form-validation", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "form-validation", must match DOCTYPE root "null".
Kindly find the validation.xml file for your reference.
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">
<form-validation>
<formset>
<form name="regFormForm">
<field property="username"
depends="required">
<arg0 key="uname"/>
</field>
<field property="password"
depends="required">
<arg0 key="password"/>
</field>
</form>
</formset>
</form-validation>
Please can any one help on this?I think your dtd entry - "http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd" is not compatible with your validation.jar file. If you have recently downloaded the these struts jar files then make sure this entry is matched with what they have provided in examples. Or download new set of jar files and copy the same doc-type tag as they have given in examples.
-
Validating xml document in java
Trying to do subject.
I'm trying to use xsd from file(schemasource = 1) and from clob (schemasource = 0). I have two xsd schemas common_types.xsd and migom.xsd. second includes first. The problem is that when I'm using common_types schema from file I get error
ORA-29532: Java call terminated by uncaught Java exception: oracle.xml.parser.v2.XMLParseException: An internal error condition occurred.
and when I validate xml against only first schema has being read from clob I get success, but when I add second xsd, i get the same error, which says nothing at all.
create or replace and compile java source named XmlTools AS
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
import oracle.sql.CLOB;
import java.io.IOException;
import org.xml.sax.SAXException;
import java.sql.SQLException;
import java.lang.IllegalArgumentException;
import oracle.xml.parser.v2.XMLParseException;
import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
public class XmlValidator
static final String JAXP_SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
static final String JAXP_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
public static void ValidateDocument(int schemasource, oracle.sql.CLOB schemadoc, oracle.sql.CLOB schemadoc1, oracle.sql.CLOB xmldoc) throws SAXException, IOException, SQLException, ParserConfigurationException, XMLParseException, IllegalArgumentException {
try
File myfile = new File(".//XML//common_types.xsd");
if (myfile.exists())
Serv.log("ValidateDocument", "file size" + Long.toString(myfile.length()));
/*else
Serv.log("ValidateDocument", "file doesn't exists" );
Serv.log("ValidateDocument", "1" );
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(true);
factory.setNamespaceAware(true);
Serv.log("ValidateDocument", "2" );
SAXParser saxParser = factory.newSAXParser();
saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
if (schemasource == 0)
InputSource schemaIs = new InputSource(schemadoc.getCharacterStream());
InputSource schemaIs1 = new InputSource(schemadoc1.getCharacterStream());
InputSource[] schemas = {schemaIs, schemaIs1};
//saxParser.setProperty(JAXP_SCHEMA_SOURCE, schemaIs);
saxParser.setProperty(JAXP_SCHEMA_SOURCE, schemas);
else
saxParser.setProperty(JAXP_SCHEMA_SOURCE, ".//XML//common_types.xsd");
XMLReader reader = saxParser.getXMLReader();
//Получаем входной XML документ
InputSource documentIs = new InputSource(xmldoc.getCharacterStream());
Serv.log("ValidateDocument", "3" );
//Запуск разбора
reader.parse(documentIs);
Serv.log("ValidateDocument", "4" );
documentIs = null;
/*catch (SAXException e)
Serv.log("ValidateDocument", "SAXException" );
Serv.log("ValidateDocument", "document is not valid because ");
Serv.log("ValidateDocument", e.getMessage());
throw(e);
catch (ParserConfigurationException e)
Serv.log("ValidateDocument", "ParserConfigurationException" );
throw(e);
catch (IOException e)
Serv.log("ValidateDocument", "IOException" );
throw(e);
catch (XMLParseException e)
Serv.log("ValidateDocument", "XMLParseException" );
Serv.log("ValidateDocument", e.getMessage());
StackTraceElement[] stack = e.getStackTrace();
for (int i = 0; i < stack.length; i++)
Serv.log("stacktrace element no " + Integer.toString(i), "toString: " + stack.toString());
Serv.log("stacktrace element no " + Integer.toString(i), "file name: " + stack[i].getFileName() + ", class name: " + stack[i].getClassName() + ", method name: " + stack[i].getMethodName() + ", line : " + stack[i].getLineNumber());
throw(e);
catch (IllegalArgumentException e)
Serv.log("ValidateDocument", "IllegalArgumentException" );
Serv.log("ValidateDocument", e.getMessage());
throw(e);
additional information got from java stacktrace:
file name: XMLError.java, class name: oracle.xml.parser.v2.XMLError, method name: flushErrors1, line : 320 file name: NonValidatingParser.java, class name: oracle.xml.parser.v2.NonValidatingParser, method name: parseDocument, line : 300 file name: XMLParser.java, class name: oracle.xml.parser.v2.XMLParser, method name: parse, line : 200 file name: XMLTOOLS, class name: XmlValidator, method name: ValidateDocument, line : 86
my oracle version is Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod But my aim is to make it work on all versions starting from 9I found another examples of xml document validation in Java, but it seems to me that ORACLE's JVM doesn't include such class as SchemaFactory and class SAXParserFactory doesn't have method setSchema. Is it possible to update JVM installed in Oracle?
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(false);
factory.setNamespaceAware(true);
SchemaFactory schemaFactory =
SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
factory.setSchema(schemaFactory.newSchema(
new Source[] {new StreamSource("contacts.xsd")}));
SAXParser parser = factory.newSAXParser();
XMLReader reader = parser.getXMLReader();
reader.setErrorHandler(new SimpleErrorHandler());
reader.parse(new InputSource("document.xml")); -
Error while building xml document
Hi Everyone,
I have a problem while building xml document.
I have developed my java files using IBM Eclipse 3.0 and i had no problem while executing the files.
But while i am trying to execute the same code in jdk/bin, xml document is not working..
No error encountered while compiling but while executing when i try to print the xml string it just gives the root element name like [root : null]
Can anyone suggest some solution?To the values element add xmlns:xsi and xsi:noNamespaceSchemaLocation.
<values xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="file:///c:/schema.xsd">schema.xsd is schema file. -
Error using SOAPRunner: XML document must have top level element
Hi all,...................xMII 11.5.3 b66
I am attempting to consume a BLS transaction as a web service from a J2EE app.
When I test it with http://naholldo31020/Lighthammer/SOAPRunner/Amy/GetListOfPlants I am getting an error message from the browser. The BLS transaction works fine when called from a Query template. What am I missing?
The XML page cannot be displayed
Cannot view XML input using style sheet.
Please correct the error and then click the Refresh button, or try again later.
XML document must have a top level element. Error processing
resource 'http://naholldo31020/Lighthammer/SOAPRunner/Amy/GetL...
WSDL from WSDLGen...
<?xml version="1.0" encoding="UTF-8" ?>
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://www.sap.com/xMII"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.sap.com/xMII">
- <!-- Types
-->
- <types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://www.sap.com/xMII">
- <s:complexType name="InputParams">
- <s:sequence id="InputSequence">
<s:element maxOccurs="1" minOccurs="0" name="RequestXML" type="s:Xml" />
<s:element maxOccurs="1" minOccurs="0" name="RowCount" type="s:long" />
<s:element maxOccurs="1" minOccurs="0" name="RowSkips" type="s:long" />
<s:element maxOccurs="1" minOccurs="0" name="Table" type="s:string" />
</s:sequence>
</s:complexType>
- <s:element name="XacuteRequest">
- <s:complexType>
- <s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="LoginName" type="s:string" />
<s:element maxOccurs="1" minOccurs="0" name="LoginPassword" type="s:string" />
<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:InputParams" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="Rowset">
- <s:sequence>
<s:element maxOccurs="unbounded" minOccurs="0" name="Row" type="s0:Row" />
</s:sequence>
<s:attribute name="Message" type="s:string" />
</s:complexType>
- <s:complexType name="Row">
- <s:sequence id="RowSequence">
<s:element maxOccurs="1" minOccurs="1" name="ErrorMessage" type="s:string" />
<s:element maxOccurs="1" minOccurs="1" name="OutputXML" type="s:string" />
</s:sequence>
</s:complexType>
- <s:element name="XacuteResponse">
- <s:complexType>
- <s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="Rowset" type="s0:Rowset" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
- <!-- Messages
-->
- <message name="XacuteSoapIn">
<part element="s0:XacuteRequest" name="parameters" />
</message>
- <message name="XacuteSoapOut">
<part element="s0:XacuteResponse" name="parameters" />
</message>
- <!-- Ports
-->
- <portType name="XacuteWSSoap">
- <operation name="Xacute">
<input message="s0:XacuteSoapIn" />
<output message="s0:XacuteSoapOut" />
</operation>
</portType>
- <!-- Bindings
-->
- <binding name="XacuteWSSoap" type="s0:XacuteWSSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="Xacute">
<soap:operation soapAction="http://www.sap.com/xMII" style="document" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <!-- Service mapping
-->
- <service name="XacuteWS">
- <port binding="s0:XacuteWSSoap" name="XacuteWSSoap">
<soap:address location="http://naholldo31020/Lighthammer/SOAPRunner/Amy/GetListOfPlants" />
</port>
</service>
</definitions>Hi Amy,
here is an example how you can call a WS via http GET:
http://<server>/Lighthammer/Runner?Transaction=<path_to_your_TRX>&XacuteLoginName=YourAccount&XacuteLoginPassword=yoursecret&outputparameter=*
Please note you do not need to use credentials in case you calling localhost.
I think in your case this should be the right url:
http://naholldo31020/Lighthammer/Runner?Transaction=Amy/GetListOfPlants&XacuteLoginName=YourAccount&XacuteLoginPassword=yoursecret&outputparameter=*
Please change parameters for
- XacuteLoginName
- XacuteLoginPassword
- outputparameter (you can specify * or one of your transaction output parameter) -
Problem validating XMl document
Hi everyone,
I'm facing a problem validating a XML document with Apache toolkit under windows XP and eclipse 3.0
I generate a pair of public/private keys using the RSA algorithm. The keys are of arbitrary length, but satisfying RSA conditions, ie we can encrypt and decrypt.
I can sign my XML document, but no way to validate it. Validation is only ok when I generate random keys using the KeyPairGenerator.
Do you think that arbitrary length keys don't allow to validate XML document. And do you have any idea how to solve the problem ( I'm not allowed to generate fixed length keys) ?
Thansk a lot for your precious help.solved!
urghh...forgot to load th eschema..duh. (must be friday)
here's the fixed code:
// parse the xml document (validate the xml string using a schema file)
// the xml document does not specified the System ID or location of
// schema..and use no namespace
public void parse(HandlerType type, String xmldoc) throws SAXException, IOException {
File schema = schemaMap.get(type);
DefaultHandler handler = handlerMap.get(yype);
XMLReader reader = XMLReaderFactory.createXMLReader(VENDOR);
InputSource source = new InputSource(new StringReader(xmldoc));
reader.setContentHandler(handler);
reader.setFeature("http://xml.org/sax/features/validation", true);
reader.setFeature("http://apache.org/xml/features/validation/schema", true);
reader.setFeature("http://apache.org/xml/features/validation/schema-full-checking", true);
reader.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
"file:///" + schema.getAbsolutePath());
reader.parse(source);
} -
Error in inserting XML document
I'm trying to insert into a table from an HTML form.
Here's the table I'm trying to insert into
TABLE employee
name VARCHAR2(40),
ssnum NUMBER NOT NULL
Note: even though SSNUM is number I take it as a string and I
have a before insert trigger that converts it to number. Works
from SQL plus if entry is number.
Here's the testxsql.html
<html>
<body>
Input your name and ssnumber ..
<form action="testxsql.xsql" method="post">
Name<input type="text" name="name_field" size="30">
SSNUM<input type = "text" name="ssnum_field" size="10">
<input type="submit">
</form>
</body>
</html>
it calls testxsql.xsql which is
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="employee.xsl"?>
<page connection="demo">
<insert table="employee" transform="testxsql.xsl"/>
<content>
<query tag-case="lower" max-rows="5" rowset-element=""
row-element="emp" >
select *
from employee
order by ssnum desc
</query>
</content>
</page>
and testxsql.xsl is
<?xml version = '1.0'?>
<ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:for-each select="request">
<ROW>
<NAME><xsl:value-of select="name_field"/></NAME>
<SSNUM><xsl:value-of select="ssnum_field"/></SSNUM>
<SOURCE>User-Submitted</SOURCE>
</ROW>
</xsl:for-each>
</ROWSET>
I get the following error while trying to insert
XSQL-015: Error inserting XML Document
invalid LABEL name in XML doc-
If I remove the insert tag, the query portion works fine.
I'm new to XML so I've already pulled all the hair that I can
muster. Thanks
nullKumar Pandey (guest) wrote:
: I'm trying to insert into a table from an HTML form.
: Here's the table I'm trying to insert into
: TABLE employee
: name VARCHAR2(40),
: ssnum NUMBER NOT NULL
: Note: even though SSNUM is number I take it as a string and I
: have a before insert trigger that converts it to number. Works
: from SQL plus if entry is number.
: Here's the testxsql.html
: <html>
: <body>
: Input your name and ssnumber ..
: <form action="testxsql.xsql" method="post">
: Name<input type="text" name="name_field"
size="30">
: SSNUM<input type = "text" name="ssnum_field"
size="10">
I'm using apache web and JServ and 8i as db
: <input type="submit">
: </form>
: </body>
: </html>
: it calls testxsql.xsql which is
: <?xml version="1.0"?>
: <?xml-stylesheet type="text/xsl" href="employee.xsl"?>
: <page connection="demo">
: <insert table="employee" transform="testxsql.xsl"/>
: <content>
: <query tag-case="lower" max-rows="5" rowset-element=""
: row-element="emp" >
: select *
: from employee
: order by ssnum desc
: </query>
: </content>
: </page>
: and testxsql.xsl is
: <?xml version = '1.0'?>
: <ROWSET xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
: <xsl:for-each select="request">
: <ROW>
: <NAME><xsl:value-of select="name_field"/></NAME>
: <SSNUM><xsl:value-of select="ssnum_field"/></SSNUM>
: <SOURCE>User-Submitted</SOURCE>
: </ROW>
: </xsl:for-each>
: </ROWSET>
: I get the following error while trying to insert
: XSQL-015: Error inserting XML Document
: invalid LABEL name in XML doc-
: If I remove the insert tag, the query portion works fine.
: I'm new to XML so I've already pulled all the hair that I can
: muster. Thanks
null
Maybe you are looking for
-
Does TM/TC backup external hard drive connected to usb-port of TC?
I have searched the web to find a straight forward answer to this question, but unfortumately have not been able to find it. The situation is as follows I want to make room om my Mac by copying my local iPhoto library (230Gb) to an external hard driv
-
CS4 InDesign "Export" anything but: can't export to anything but PDF
After two uninstallation/reinstallations of the whole frickin' CS4 Master Collection, and deleting the Defaults file repeatedly, InDesign still refuse to Export anything other than the first format that displays (usually, PDF -- although once I got i
-
Restriction of Field Change in VL02N change(After PGI)
Hi Gurus In outbound delivery we are using the following fields:- 1. Means of Tr id:- LIKP-TRATY 2. Means of Tr. Type:- LIKP-TRAID 3. Shipping Conditions:- LIKP-VSART 4. Special Procedure Indicator:- LIKP-SDABW The same fields are bei
-
WSDL first. Namespace of complx type's child elements.
Hello! I've got strange (for me) behavior of wscompile. I started to develop a web service from a WSDL definition (document-literal). I built two services built on the written WSDL: one in Java (was deployed to JBoss) and one in .Net. Also I wrote a
-
Function Does Not Return any value .
Hi , I am wrtting the below funtion without using any cursor to return any message if the value enters by parameters does not match with the value reterived by the function select statement or it does not reterive any value that for the parameters en