PLSQL and Java XML type mapping
Running database 10gR2. Trying to create a Java stored procedure that returns an XML type (oracle.xdb.XMLType) like so:
class MyCoolClass
static oracle.xdb.XMLType doSomething( String xmldata)
oracle.xdb.XMLType xmlt = new oracle.xdb.XMLType( xmldata );
return xmlt;
This, of course, is wrapped by a PL/SQL function:
function doSomething( xmldata varchar2 ) return SYS.XMLTYPE AS LANGUAGE JAVA
name 'MyCoolClass.doSomething(java.lang.String) return oracle.xdb.XMLType';
While everything compiles (that means it should work, right?), the above codes generates a runtime error ORA-00932 'inconsistent datatypes' error. I'm not sure what I'm doing wrong, it was my understanding that a default mapping existed between the PL/SQL SYS.XMLTYPE and oracle.xdb.XMLType. Is what I'm attempting even possible?
Sorry, I was being sloppy with my code example. It should be:
class MyCoolClass
static oracle.xdb.XMLType doSomething( String xmldata)
java.sql.Connection c = java.sql.DriverManager.getConnection("jdbc:default:connection:");
oracle.xdb.XMLType xmlt = new oracle.xdb.XMLType( c, xmldata );
return xmlt;
Similar Messages
-
How to combine "Object-to-XML (OXM)" and "Direct to XML Type" mapping?
hi
If I have an XMLType column in my table (wich I can map using TopLink) and I have defined the structure of the contents of this XMLType column using XML Schema (wich I can map using Toplink), how can I combine both types of TopLink mappings "as transparently as possible"?
for "Object-to-XML (OXM)" mapping
see http://www.oracle.com/technology/products/ias/toplink/technical/tips/ox/index.htm
for "Direct to XML Type" mapping
see http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/relmapun004.htm#CHDFIFEF
thanks
Jan VerveckenThanks for your reply James Sutherland.
Although I haven't used a "TopLink Converter" before, this seems like a good idea.
The thing is that the "TopLink Workbench Editor" for my "Direct to XML Type" mapping doesn't have a "Converter" tab, some other mapping type editors do have such a "Converter" tab.
I'm not sure if I completely understand how such a "TopLink Converter" is supposed to work. How many attributes do I need in the "XMLRow" Java object for the "MY_XML" column in the "XML_TABLE" table I try to map to?
I suppose I should try to get a situation where the "XMLRow" Java object has an "myXML" attribute of Java class type "MyXML" (where "MyXML" has been mapped to an XML Schema), not?
So do I also still need an attribute "myXMLDocument" of type org.w3c.dom.Document as I do now for the "Direct to XML Type" mapping?
Oh, by the way ... for anyone who hits this forum thread looking for the reason why the TopLink Workbench reports the problem "Attribute must be assignable to java.lang.String, org.w3c.dom.Document, or org.w3c.Node" while your attribute is of such a type, read this forum post
Re: Toplink WB 10.1.3 - Aggregate field mapping bug and XMLType question
For me the "Direct to XML Type" mapping works fine, just ignoring the waring. This is supposed to be bug number 5071250.
thanks
Jan Vervecken -
TopLink : attribute-mapping direct-xml-type-mapping
hi
Using TopLink Workbench 10g Release 3 (10.1.3.0.0) Build 060118 it is possible to configure a "Direct to XML Type" mapping.
see http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/relmapun004.htm#CHDFIFEF
In the TopLink map this results in a
<opm:attribute-mapping xsi:type="toplink:direct-xml-type-mapping">Is there a way to configure this kind of attribute mapping using JDeveloper?
thanks
Jan VerveckenHi Paul,
The problem you're going to hit trying to do this with a TransformationMapping in 904 (as in my other post) is that during the UnitOfWork commit, when TopLink is checking for changes a .equals will end up being called on an XMLType instance which will throw a NullPointerException (in oracle.sql.Datum I think).
One way to work around this (depending on the requirements for your app) is to set the isMutable flag on the TransformationMapping to false. This flag indicates that the value in the object's attribute isn't going to be changed, so we don't bother trying to check to see if it's changed. This will allow you to do reads, inserts and deletes with no problems.
The downside is that if you need to be able to change the XML content in your objects model and do an update of the row, TopLink will never detect a change and never issue an update of the XMLType field.
Incidentilly, if you happen to hit the same issue you had with the DirectToXMLTypeMapping where you were getting back an instance of java.sql.Opaque instead of the expected oracle.xdb.XMLType from JDBC, you should be able to handle that case in your AttributeTransformer by doing
XMLType myXML = XMLType.createXML(myOpaque)
Document = myXML.getDocument();
Hope this helps
Matt MacIvor -
Differnce between java script xml dom and Java Xml dom
Hi,
In my application For client side in Java Script for craetion of DOM MIcrosoft Activex object is used. USing that one they are buiidng DOM. And they are saving as XML. In server side i have to write one servlet which will parse that xml and i have to store in dynamic arrays.Which API is better for parsing XML in java.In util pacakge which class is better for storing dynamical values that means MAP,Hash Map,Hash table ??in java, the java..xml.parsers package is generally used for parsing xml into a DOM. there are also sax and stax parsers available.
which class in java.util is better for storing stuff depends on what you need to do with the stuff. find a nice tutorial on java collections and then decide which one makes sense for what you need. -
XSD size and Java XML Parsers (specifically SAX)
Does the size of XSD matter in terms of performace runtime. I would like to create an XSD as one contract that houses all non-mandatory elements so the resulting xml out of this will use similar structure but wont use all of the XSD elements.
Is there a problem with such an XSD which will be 1000 or more elements as far as Java parsing is concerned
Pl. let me knwo thanksI do a lot of work with an international standard -- S1000D -- for documentation and technical manuals. It has 58 schema files (10 that are main files that are referenced by an XML file, and the other 48 get imbedded as needed). It does not slow down the parsing of files by any noticable amount.
Dave Patterson -
Java.io.IOException: unable to find the type mapping resource file
Hi,
I am using weblogic7.0 to deploy my applications. I wrote a web service and
was able to deploy it sucessfully. I am trying to access the web service through
a jsp page. I am the error posted below on my server and " error:505 internal
server error" on the browser. Can any one please help me out with the problem.
My jsp page just displays the float value i am returing from the session bean
method.
Thanks,
Ramya.
<Apr 14, 2003 4:32:51 PM PDT> <Error> <HTTP> <101019> <[ServletContext(id=64204
55,name=bankwebapp,context-path=/bankwebapp)] Servlet failed with IOException
java.io.IOException: unable to find the type mapping resource file for:bank.Ban
kService
at weblogic.webservice.core.encoding.DefaultRegistry.<init>(DefaultRegi
stry.java:62)
at weblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:72)
at bank.BankService_Impl.<init>(BankService_Impl.java:23)
at jsp_servlet.__getbal._jspService(__getbal.java:106)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.ru
n(ServletStubImpl.java:1058)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:401)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:445)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:306)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActi
on.run(WebAppServletContext.java:5412)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:744)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppS
ervletContext.java:3086)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestI
mpl.java:2544)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
>
<Apr 14, 2003 4:40:59 PM PDT> <Notice> <Application Poller> <149400> <Activatin
g application: appsdirbankwebapp_war>
<Apr 14, 2003 4:40:59 PM PDT> <Notice> <Application Poller> <149404> <Activate
application appsdirbankwebapp_war on myserver - Running>
<Apr 14, 2003 4:41:01 PM PDT> <Notice> <Application Poller> <149404> <Activate
application appsdirbankwebapp_war on myserver - Completed>
The url value from the jsp page ishttp://localhost:7001
The wsdl value from the jsp page ishttp://localhost:7001/web_services/BankServi
ce
<Apr 14, 2003 4:41:06 PM PDT> <Error> <HTTP> <101019> <[ServletContext(id=72463
20,name=bankwebapp,context-path=/bankwebapp)] Servlet failed with IOException
java.io.IOException: unable to find the type mapping resource file for:bank.Ban
kService
at weblogic.webservice.core.encoding.DefaultRegistry.<init>(DefaultRegi
stry.java:62)
at weblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:72)
at bank.BankService_Impl.<init>(BankService_Impl.java:23)
at jsp_servlet.__getbal._jspService(__getbal.java:106)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.ru
n(ServletStubImpl.java:1058)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:401)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:445)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:306)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActi
on.run(WebAppServletContext.java:5412)
at weblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:744)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppS
ervletContext.java:3086)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestI
mpl.java:2544)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
>Hi Manoj,
Thanks a lot for your hepl. I tried as you said and its working now.
Ramya
"manoj cheenath" <[email protected]> wrote:
Make sure that you put the client jar file generated by
clientgen in the lib directory of the jsp web app.
It looks like the runtime is unable to load
<service>.xml type mapping file. This xml file
should be in the classpath (web-inf/lib or
web-inf/classes).
-manoj
"Ramya" <[email protected]> wrote in message
news:[email protected]...
Hi,
I am using weblogic7.0 to deploy my applications. I wrote a web serviceand
was able to deploy it sucessfully. I am trying to access the web servicethrough
a jsp page. I am the error posted below on my server and " error:505internal
server error" on the browser. Can any one please help me out with theproblem.
My jsp page just displays the float value i am returing from the sessionbean
method.
Thanks,
Ramya.
<Apr 14, 2003 4:32:51 PM PDT> <Error> <HTTP> <101019><[ServletContext(id=64204
55,name=bankwebapp,context-path=/bankwebapp)] Servlet failed withIOException
java.io.IOException: unable to find the type mapping resource filefor:bank.Ban
kService
atweblogic.webservice.core.encoding.DefaultRegistry.<init>(DefaultRegi
stry.java:62)
atweblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:72)
at bank.BankService_Impl.<init>(BankService_Impl.java:23)
at jsp_servlet.__getbal._jspService(__getbal.java:106)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
atweblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.ru
n(ServletStubImpl.java:1058)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:401)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:445)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:306)
atweblogic.servlet.internal.WebAppServletContext$ServletInvocationActi
on.run(WebAppServletContext.java:5412)
atweblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:744)
atweblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppS
ervletContext.java:3086)
atweblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestI
mpl.java:2544)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
>
<Apr 14, 2003 4:40:59 PM PDT> <Notice> <Application Poller> <149400><Activatin
g application: appsdirbankwebapp_war>
<Apr 14, 2003 4:40:59 PM PDT> <Notice> <Application Poller> <149404><Activate
application appsdirbankwebapp_war on myserver - Running>
<Apr 14, 2003 4:41:01 PM PDT> <Notice> <Application Poller> <149404><Activate
application appsdirbankwebapp_war on myserver - Completed>
The url value from the jsp page ishttp://localhost:7001
The wsdl value from the jsp page
ishttp://localhost:7001/web_services/BankServi
ce
<Apr 14, 2003 4:41:06 PM PDT> <Error> <HTTP> <101019><[ServletContext(id=72463
20,name=bankwebapp,context-path=/bankwebapp)] Servlet failed withIOException
java.io.IOException: unable to find the type mapping resource filefor:bank.Ban
kService
atweblogic.webservice.core.encoding.DefaultRegistry.<init>(DefaultRegi
stry.java:62)
atweblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:72)
at bank.BankService_Impl.<init>(BankService_Impl.java:23)
at jsp_servlet.__getbal._jspService(__getbal.java:106)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
atweblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.ru
n(ServletStubImpl.java:1058)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:401)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:445)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubI
mpl.java:306)
atweblogic.servlet.internal.WebAppServletContext$ServletInvocationActi
on.run(WebAppServletContext.java:5412)
atweblogic.security.service.SecurityServiceManager.runAs(SecurityServi
ceManager.java:744)
atweblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppS
ervletContext.java:3086)
atweblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestI
mpl.java:2544)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)
> -
Help on java.sql.Types class
Hai Friends ,
I want some help on java.sql.Types class .
What is the use of the above class ?
Some details about this class.Good Morning Yekesa
First of all i would like to thank U for looking into my problem.
I am using java.sql.Types.OTHER for
{"?=CALL(storedprocedurename.functionname(?))"}
registerOutParameter(1,javal.sql.Types.OTHER)
setString(2,"user")
here the
second parameter passes an argument to function name ( viz. username say "user")
and the function will return the ref cursor as follows:
// declaration in pl/sql procedure
begin
rc ref cursor
open rc for select * from ss_user where login_name="user";
return rc;
end
now the stored procedure has a return value (i.e. stored function) which it needs to register as
registerOutParameter(1,javal.sql.Types.OTHER)
and it finally results in the following errors :
Loading driver
Before conn stmt
After conn stmt
Calling Stored procedure
Stored procedure called
java.sql.SQLException: Invalid column type
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:243)
at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:2487)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:64)
at oracle.jdbc.driver.OracleCallableStatement.registerOutParameter(OracleCallableStatement.java:54)
at sptest.<init>(sptest.java:28)
at sptest.main(sptest.java:49)
T couldn't understand why it is saying Invalid Column Type because its working fine with both
java.sql.Types.INTEGER
and
java.sql.Types.VARCHAR
Pl help me at the earliest as i have wasted a lot of time on it.
pl mail me in detail at [email protected]
bye then
bansi
null -
Mapping Java Types to XML Types
Hi, I have a small doubt in web services,
1) how a java data type can match with xml data type in wsdl,
2) how and where the java program can find the matching java
data type to xml data type and vice versa
3) whether any mechanism is available for this data conversion?
4) where can i find that one?
Please advice me
Regards
Marimuthu.NHi Marimuthu.N,
My answers for your question, Kindly let me know if you need some more inputs.
+1) how a java data type can match with xml data type in wsdl,+
In SOAP 1.1 you have the following data types which is in XSD(XML Schema Definition), the same data type is also available in Java. For example (string, normalizedstring in xml is available as java.lang.String)
The complete list can be found in the table below.
XSD to Java Mapping.
XSD Type--------------------------------Java Type
base64Binary----------------------------byte[]
hexBinary---------------------------------byte[]
boolean------------------------------------Boolean
byte-----------------------------------------Byte
dateTime----------------------------------java.util.Calendar
date-----------------------------------------java.util.Calendar
time-----------------------------------------java.util.Calendar
decimal------------------------------------java.math.BigDecimal
double-------------------------------------Double
float-----------------------------------------Float
hexBinary---------------------------------byte[]
int--------------------------------------------Int
unsignedShort---------------------------Int
integer--------------------------------------java.math.BigInteger
long------------------------------------------Long
unsignedInt-------------------------------Long
QName-------------------------------------javax.xml.namespace.QName
short----------------------------------------Short
unsignedByte---------------------------Short
string---------------------------------------java.lang.String
anySimpleType-------------------------java.lang.String
+2) how and where the java program can find the matching java+
data type to xml data type and vice versa
Here is my WSDL which has a method getHello --> Pass Input as String --> Get Response as String.
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://zackria.googlepages.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://zackria.googlepages.com" xmlns:intf="http://zackria.googlepages.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://zackria.googlepages.com" xmlns="http://www.w3.org/2001/XMLSchema">
<element name="getHello">
<complexType>
<sequence>
<element name="s" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="getHelloResponse">
<complexType>
<sequence>
<element name="getHelloReturn" type="xsd:string"/>
</sequence>
</complexType>
</element>
</schema>
</wsdl:types>
<wsdl:message name="getHelloResponse">
<wsdl:part element="impl:getHelloResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="getHelloRequest">
<wsdl:part element="impl:getHello" name="parameters"/>
</wsdl:message>
<wsdl:portType name="Test">
<wsdl:operation name="getHello">
<wsdl:input message="impl:getHelloRequest" name="getHelloRequest"/>
<wsdl:output message="impl:getHelloResponse" name="getHelloResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestSoapBinding" type="impl:Test">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getHello">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getHelloRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getHelloResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestService">
<wsdl:port binding="impl:TestSoapBinding" name="Test">
<wsdlsoap:address location="http://localhost:8080/TestWebService/services/Test"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>I use apache axis for the client side code. I also suggest to start using this to get quickly into SOA(Service Oriented Architecture)
package com.googlepages.zackria;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.namespace.QName;
* TestClient for Webservice
* @author $author$Mohammed Zackria
* @version $Revision$1.00
public class TestClient {
* main method
* @param args pass nothing as far now
public static void main(String[] args) {
try {
String endpoint = "http://localhost:8080/TestWebService/services/Test";
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName(new QName("http://zackria.googlepages.com", "getHello"));
//String Conversion
String ret = (String) call.invoke(new Object[] { "Zack" });
System.out.println("Sent 'Zack', got '" + ret + "'");
} catch (Exception e) {
System.err.println(e.toString());
}+3) whether any mechanism is available for this data conversion?+
Check the above code which has the following portion
//String Conversion
String ret = (String) call.invoke(new Object[] { "Zack" });
By default APACHE Axis returns Object Array which can be Casted to your WSDL defined data type.
+4) where can i find that one?+
[Eclipse Webservice|http://www.eclipse.org/webtools/jst/components/ws/1.5/tutorials/BottomUpWebService/BottomUpWebService.html]
Hope this helps out, Kindly Let me know if you need some more or if i have not answered your question.
Regards,
Zack
Edited by: zack on Nov 22, 2008 1:47 PM
Edited by: zack on Nov 22, 2008 1:49 PM -
Error publishing plsql webservice (xml schema mapping and/or serializer)
Hi guys,
I'm with a problem when publishing plsql webservices from JDeveloper 11.
The scenario is something like this:
1) I have a connection with a database 9i, and the objects (packages, object types, etc) are all in there.
2) In this case, i can publish the package spec using the option "Publish as JAX-RPC Web Service" normally.
3) A database 11g was created, and i compiled the objects in this environment.
4) Then i've created a new connection with a database 11g.
5) In this case, when i'll publish the webservice, the error occurs: "The following types used by the program unit do not have an XML Schema mapping and/or serializer specified: REC_DMP_REMESSA"
I have no idea in how to solve this case. Someone can help?
Thank in advance.
Best Regards,
GustavoDuplicate of https://forums.oracle.com/thread/2610823
Timo -
DeserializationException: mapping lookup failure for xml type
I generated a web-services.xml with the wsdl2Service task without a type mapping. The service is a document/literal based web service. I implemented the Java method, which accepts a single parameter with type javax.xml.soap.SOAPElement and returns javax.xml.soap.SOAPElement. Everytime I invoke the method from a client I get the following error from the server (WebLogic 8.1 SP4):
weblogic.xml.schema.binding.DeserializationException: mapping lookup failure for xml type ['urn:mytest1']:test and java interface javax.xml.soap.SOAPElement
at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(RuntimeUtils.java:325)
What could be wrong with my configuration?Hi,
I am also facing the same problem on weblogic8.1SP1.
If you had rectified this problem, please advice me as well. -
Custom action with XML type input and output parameter.
Hi,
I want to develop custom action with xml type input and/or output parameter.
Is there sample code for java side. How is the definition of input and/or output parameter and set/get methods?
does it need special .jar file to develop custom action like this?
Thanks.Cemil - yes, you can use XML data types. Use the class
com.sap.lhcommon.xml.XMLDataType
for your parameter type. Here is a snippet from a custom action we use to log XML (instead of just returning the #text node like the default logger does):
public class XMLLogger extends ActionReflectionBase
private String source;
private String eventType;
private String textMessage;
private XMLDataType xmlMessage;
public XMLLogger()
log = new Logger("UserLog");
source = DEFAULT_SOURCE;
eventType = TYPE_INFO;
textMessage = "";
xmlMessage = new XMLDataType();
public XMLDataType getXmlMessage()
return xmlMessage;
public void setXmlMessage(XMLDataType xmlMessage)
this.xmlMessage = xmlMessage;
public void Invoke(Transaction transaction, ILog ilog)
StringBuffer sb = new StringBuffer();
sb.append('[');
sb.append(source);
sb.append("] ");
sb.append(textMessage);
sb.append(XMLUtils.convertXmlToString(xmlMessage));
XMLUtils is a helper class we wrote - it's just a bunch of standard Java XML boilerplate code. The important part you need to know is XMLDataType.getDocument() will return an org.w3c.dom.Document.
I hope that was enough information to help.
-tim -
Wanted to confirm my understaing for ABAP and JAVA mapping.
Am I correct in my assumption that these mapping techniques can be used only if input and ouput is in XML format ?
So if XI is receiving a flat comma separated text/non-XML file or an IDOC for that matter and output is NOT in XML format, say again flat text file or IDOC, I cannot use above two techniques?
All the docs I have read suggest that 'Execute' method is called when XML file/data is received, paresed using DOM/SAX/JAXB (for Java mapping) or IXML lib (for ABAP mapping) and then create a output XML file.
-Thanks in advanceHi Bob,
Here you have a code sample for deescaping. I have have written this code a couple of time ago. The incoming file can be any text format. It might be XML, but not necessarily.
The main method is not reqired, but good for testing.
Regards
Stefan
* Created on 28.09.2005
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
package sample;
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.util.Map;
public class Deescaping implements StreamTransformation{
public static void main (String[] args) {
try {
InputStream in = new FileInputStream(new File("in.xml"));
OutputStream out = new FileOutputStream(new File("out.xml"));
Deescaping change = new Deescaping();
change.execute(in, out);
} catch (Exception e) {
e.printStackTrace();
public void setParameter (Map map) {
public void execute (InputStream in, OutputStream out)
throws StreamTransformationException {
try {
int c;
while ((c = in.read()) != -1) {
if (c != '&') {
out.write(c);
} else {
// ampersand
String help = "&";
boolean exit = false;
// check the next 5 chars, if there is a ';'
for (int i = 0; i < 5 && !exit; i++) {
c = in.read();
if (c == -1) {
exit = true;
} else {
// another ampersand?
if (c == '&') {
out.write(help.getBytes());
help = "&";
i = 0; // check the next 5 chars
} else {
help = help + (char) c;
if (c == ';') {
exit = true;
if (help.equals("&")) {
help = "&";
if (help.equals("<")) {
help = "<";
if (help.equals(">")) {
help = ">";
if (help.equals(""")) {
help = """;
if (help.equals("'")) {
help = "'";
} // for
out.write(help.getBytes());
} // while
out.flush();
} catch (Exception e) {
throw new StreamTransformationException(e.getMessage(),e); -
Java.sql.types and oracletypes
There appear to be difference in the way the constants are mapped in java.sql.types vs oracletypes(). For example date is '91' in oracletypes and '93' in java.sql.types. The DatabaseMetaData.getColumns() function reports data_type as a java.sql.type. Is there any mapping available from one to the other.
ThanksErm,
One way to find out, I reckon.
Good Luck,
Avi. -
ADF Business Component Type MAP Oracls vs Java
what the advantages and disadvantages from each one map type
thank in advanceTake a look at this link in developer's guide:
http://docs.oracle.com/cd/E16162_01/web.1112/e16182/bcintro.htm#sm0062
The Java Extended for Oracle type map and the Oracle Domains type map handle numeric data differently. When you create a new application the default type map Java Extended for Oracle maps numeric data to the java.math.BigDecimal >class, which inherits from java.math.Number. The java.math.BigDecimal default matches the way the Fusion web application view layer, consisting of ADF Faces components, preserves alignment of numeric data (such as numeric values >displayed by ADF Faces input fields in a web page). Whereas the Oracle Domains type map, which maps numeric data to the oracle.jbo.domain.Number class, may not display the data with the alignment expected by certain ADF Faces >components. Aside from this alignment issue, the Oracle Domains type map remains a valid choice and applications without ADF Faces components will function without issue.Thanks,
Navaneeth -
Inconsistent java and sql object types
Hi,
I have run into error "Inconsistent java and sql object types"
while mapping a java class to a sql object type. The java class
is just a duplicate of sql data structure and I pretty much
follow the JDBC Developer's GUide's examples (20-43 to 20-45)
to create the mapping java class.
Any one runs into simliar problem or any clues?
Thanks,
Ed
Exception in thread "main" java.sql.SQLException: Inconsistent java and sql object types: InstantiationException:
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.sql.STRUCT.toClass(STRUCT.java:433)
at oracle.sql.STRUCT.toJdbc(STRUCT.java:366)
at oracle.jdbc.oracore.OracleTypeUPT.unpickle80rec
(OracleTypeUPT.java:236)
at
oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle80rec_elems
(OracleTypeCOLLECTION.java:553)
at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle80rec
(OracleTypeCOLLECTION.java:383)
at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle80
(OracleTypeCOLLECTION.java:329)
at oracle.jdbc.oracore.OracleTypeCOLLECTION.unlinearize
(OracleTypeCOLLECTION.java:218)
at oracle.sql.ArrayDescriptor.toJavaArray
(ArrayDescriptor.java:501)
at oracle.sql.ARRAY.getArray(ARRAY.java:197)The safest way would be to use JPublisher to generate the type classes. In your application, you can just use the generated code to manipulate the object.
Maybe you are looking for
-
Can't drag Firefox into applications folder: "libsmime3.dylib is in use".
I search for libsmime3.dylib but can't find it on the computer. The computer is a MacBook Pro running OS 10.6.7. I've quit the old Firefox.
-
When I use Airplay, I can mirror video from my Macbook Air but there was no sound from TV (the sound on my Air still on). I had use my Mac to do Airplay for six months without problem until now. My wife can use her iPad-4 to watch TV with Airply fin
-
Matrix Program - First time using multiple classes
I'm writing a program right now that takes matrices from an input file specified by the user. The file is in this format. #rows #columns 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 So in place of #rows I would have a 3, and #columns would be a 6. They are se
-
TCode to post a Controlling Document in Object Currency only
Is there a TCode that can be used to post to a secondary cost element but only updating the Object Currency Value? I had an issue with our recent periodic Assessment. Some of the posted assessment documents have line items that have different Object
-
"invalid url "/" is not valid" only appears for my laptop
i received the message "invalid url the requested url "/", is invalid. reference number #9.3e556acb.1337262673.220f958c" this message only appears for facebook webpage. other website is fine. Also only my laptop have this problem,my friend laptop con