JAXB 1.6 and xsi:type attribute
Does JAXB version 1.6 suppurt xsi:type attribute? I have mapped schema to Java classes and when I marshall it to xml, xsi:type attribute is missing.
I found one workaround for the problem,
"<from variable="StopSeq"/>"
As of now , StopSeq was a variable created by me in BPEL file.
I was using this variable to do some calculations.
As a workaround of the problem, I created a schema with "StopSeqType" as a simple int type element.
Then inside the BPEL, I marked the the existing variable "StopSeq" as a type of "StopSeqType" of my new schema.
After this change I found the expected result.
Now my doubt is , Is it the case for all variables created in BPEL ?
If yes , how we can prevent this ?
Similar Messages
-
Web Services, Schemas, and the xsi:type attribute
Hi List,
I have several questions reqarding web services, schemas, and the use of the xsi:type
attribute in messages.
Schemas:
Q1: How complex can a web service schema be?
Q2: Is it reasonable for a schema to contain derived types by extension [1]?
Q3: Could you use the International Purchase Order Schema [2] with a web service?
xsi:type
Q1: Is it reasonable for a web service to use the xsi:type attribute in the message(s)?
If I am interpreting Section 4.1.15 of the BasicProfile-1.0a [3] correctly, this
appears to be appropriate in certain circumstances.
Q2: When is it appropriate to use the xsi:type attribute? If a schema contains
derived types by extension [1]? If a schema contains xsd:anyType?
Q3: How does using the xsi:type attribute affect interoperability?
And finally,
Q4: Are there any examples available demonstrating the use of the xsi:type attribute
in messages?
Whew !!!
TIA,
Kent
[1] http://www.w3.org/TR/xmlschema-0/#DerivExt
[2] http://www.w3.org/TR/xmlschema-0/#ipo.xsd
[3] http://www.ws-i.org/Profiles/Basic/2003-08/BasicProfile-1.0a.htmlHi Kent,
A few answers inline...
HTH,
Bruce
Kent Kvarfordt wrote:
>
Hi List,
I have several questions reqarding web services, schemas, and the use of the xsi:type
attribute in messages.
Schemas:
Q1: How complex can a web service schema be?There are limits in converting the schema between language
representations, see this section [a] in the docs on roundtripping
generated data types.
[a]
http://edocs.bea.com/wls/docs81/webserv/assemble.html#1074725
Q2: Is it reasonable for a schema to contain derived types by extension [1]?
Q3: Could you use the International Purchase Order Schema [2] with a web service?
xsi:type
Q1: Is it reasonable for a web service to use the xsi:type attribute in the message(s)?
If I am interpreting Section 4.1.15 of the BasicProfile-1.0a [3] correctly, this
appears to be appropriate in certain circumstances.I've not seen this used.
http://www.ws-i.org/Profiles/Basic/2003-08/BasicProfile-1.0a.html#refinement34259632
>
Q2: When is it appropriate to use the xsi:type attribute? If a schema contains
derived types by extension [1]? If a schema contains xsd:anyType?
Q3: How does using the xsi:type attribute affect interoperability?My thought is that since this is not commonly used, then your risk of
interop failure is high.
>
And finally,
Q4: Are there any examples available demonstrating the use of the xsi:type attribute
in messages?Sorry, I looked and could not find any examples.
>
Whew !!!
TIA,
Kent
[1] http://www.w3.org/TR/xmlschema-0/#DerivExt
[2] http://www.w3.org/TR/xmlschema-0/#ipo.xsd
[3] http://www.ws-i.org/Profiles/Basic/2003-08/BasicProfile-1.0a.html -
Hi All,
I have a requirement where I need to set the xsi:type attribute to some value before I submit the SOAP request from SAP PI. I have not been able to figure out where how to set the value of this attribute. I have an XSD that I am using to generate the request, but I do not see anywhere in the mapping tools where I can assign this value. I tried using MAP Force to do XSLT mapping but couldn't really make that happen using that either...
This is how I would like the request message type to have...
<m:sObjects xsi:type="ns3:Account" xmlns:ns3="urn:sobject.enterprise.soap.sforce.com">
but this is how it comes...
<m:sObjects>
Any tips and ideas to make this happen would be highly appreciated...
Regards,
Jawwadhi,
there are at least two places where you can do it:
a) inside a mapping using XSLT
b) write an adapter module that will add this to your call and put it in receiver soap adapter
Regards,
Michal Krawczyk -
Did not find needed xsi:type attribute on element anyType
The followings exception is thrown when using the access a web service using the
proxy jar.
The return xml contains
<debts xm:bind="debts is return.safaccount.debts">
<anyType xm:multiple="debt in return.safaccount.debts">{debt}</anyType>
</debts>
debts is a vector contains Serializable Object class.
How do you resolve this?
<Nov 14, 2002 2:36:27 PM ICT> <Error> <HTTP> <101019> <[ServletContext(id=553030
0,name=EAIService,context-path=/EAIService)] Servlet failed with IOException
java.rmi.RemoteException: web service invoke failed; nested exception is:
javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.sch
ema.binding.DeserializationException: did not find needed xsi:type attribute on
element <anyType>
javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.schema.bind
ing.DeserializationException: did not find needed xsi:type attribute on element
<anyType>
at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:296)
at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:35
9)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
a:465)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.javHi Daniel,
This is really an "constructing and XMLMap issue" with WebLogic Workshop, so I
would post it on that newsweb group:
weblogic.developer.interest.workshop
BTW: Serialization/Deserialization required instanciable classes with no-arg constructors.
You should attach the WSDL for this web service, so that folks can see what Workshop
generated for the schema element(s). This (the schema elements) is probably where
the problem starts :-) Also, state if that is the default xmlmap generated by
Workshop, or a custom one.
Regards,
Mike Wooten
"daniel" <[email protected]> wrote:
>
The followings exception is thrown when using the access a web service
using the
proxy jar.
The return xml contains
<debts xm:bind="debts is return.safaccount.debts">
<anyType xm:multiple="debt in return.safaccount.debts">{debt}</anyType>
</debts>
debts is a vector contains Serializable Object class.
How do you resolve this?
<Nov 14, 2002 2:36:27 PM ICT> <Error> <HTTP> <101019> <[ServletContext(id=553030
0,name=EAIService,context-path=/EAIService)] Servlet failed with IOException
java.rmi.RemoteException: web service invoke failed; nested exception
is:
javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.sch
ema.binding.DeserializationException: did not find needed xsi:type attribute
on
element <anyType>
javax.xml.soap.SOAPException: failed to deserialize xml:weblogic.xml.schema.bind
ing.DeserializationException: did not find needed xsi:type attribute
on element
<anyType>
at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:296)
at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage.java:35
9)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav
a:465)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.jav -
XMLBeans and xsi:type overrides
The issue is one of the split of responsibility for the XML meta-data and the XML info-set. The XMLBeans classes are allowed to choose XML namespace prefixes at will (following the usual rules about uniqueness) and drop unused namespace prefixes. However the XMLBeans are not allowed to change the values of any elements or attributes which would alter the info-set.
The XML schema type attribute is held in the XML info-set as an attribute and therefore cannot be changed by the XMLBeans, however it also contains details of the namespace prefix.
For example the following piece of XML shows the usage of a xsi:type qualifier :
<v11:createOrderByValueRequest
xmlns:v1="http://videonetworks.com/ServiceActivation/v1-0"
xmlns:v11="http://ossj.org/xml/ServiceActivation/v1-1">
<v11:orderValue xsi:type="v1:VNLCreateOrderValue"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<v11:description>IPTV Consumer Order for WO999</v11:description>
</v11:orderValue>
</v11:createOrderByValueRequest>
If we extract the order value from the createOrderByValueRequest object as the only use of the namespace v1 is within the info-set, under the xsi:type attribute the newly created xml-fragment may look like the following :
<xml-fragment xsi:type="v1:VNLCreateOrderValue"
xmlns="http://ossj.org/xml/ServiceActivation/v1-1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<description>IPTV Consumer Order for WO999</description> </orderValue>
This no longer validates as the v1 namespace prefix is not defined. As a workaround we have created a method which checks for xsi:type attributes and inserts the namespaces required based on a set of types and namespaces we are using. The output would then look like :
<xml-fragment xsi:type="v1:VNLCreateOrderValue"
xmlns="http://ossj.org/xml/ServiceActivation/v1-1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:v1="http://videonetworks.com/ServiceActivation/v1-0">
<description>IPTV Consumer Order for WO999</description> </orderValue>Of course this is a namespace issue. But how can i solve it?
In jdeveloper a see all the variables and just use the graphical assign.
This writes
<to variable="inputVariable" part="payload" query="/payload/client:Reference/client:my_nte"/>
If i change from client: to anything else the workflow does not compile anymore... -
"xsi:type" attribute coming automatically in XML by using Assign activity
Hi,
I am using below copy operation in assign activity
*<copy>*
*<from variable="StopSeq"/>*
*<to variable="InvokeGlog_IV" part="Transmission"*
*query="/ns2:Transmission/ns2:TransmissionBody/ns2:GLogXMLElement/ns2:ActualShipment/ns2:Shipment /ns2:ShipmentStop[bpws:getVariableData('SCounter')]/ns2:StopSequence"/>*
*</copy>*
which is copying from one local variable(StopSeq of int type ) to another variable(StopSequence of string type).
It was working fine in SOA 11.1.1.3 and I was getting result as below
Expected Result *<StopSequence>1</StopSequence>*
But recently we have migrated from 11.1.1.3 to 11.1.1.5 and we started to get below output for the same assign activity.
Current Result *<StopSequence xsi:type="ns:int">1</StopSequence>*
Please suggest.
ThanksI found one workaround for the problem,
"<from variable="StopSeq"/>"
As of now , StopSeq was a variable created by me in BPEL file.
I was using this variable to do some calculations.
As a workaround of the problem, I created a schema with "StopSeqType" as a simple int type element.
Then inside the BPEL, I marked the the existing variable "StopSeq" as a type of "StopSeqType" of my new schema.
After this change I found the expected result.
Now my doubt is , Is it the case for all variables created in BPEL ?
If yes , how we can prevent this ? -
Workflow and Form-type attributes
Are Form-type attributes available in the Oracle Workflow included in the Oracle Database 10g or do I need to install the Oracle Workflow included in the Oracle Application Server 10g?
Hi,
The form type attribute must be available in the 10g database version of workflow.
Cheers,
Raja -
Xpath performance and xsi namespace
In my xpath, I need to use the "xsi" namespace to specify the xpath condition. It seems to be the performance of the xpath that uses the "xsi" namespace is extremly slow, compared with a similar xpath that does not use the name space, although the number of retrieved objects are the same in my test case.
What causes such a big difference in speed? Is that possible when I use the "xsi" namespace in the xpath, the xpath is not get rewritten? How can I improve the performance when using "xsi" namespace.
1)xpath not use the namespace
select extract(object_value, '/Test/Group/Object[uniqueName="a1"]') from Test where existsNode(object_value, '/Test/Group[uniqueName="N10001"])=1;
2)xpath use the "xsi" namespace
select extract(object_value, '/Test/Group/Object[uniqueName="a1" and @xsi:type="Architecture"]', 'xmlns="http://www.myspace.com/testXML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"') from Test where existsNode(object_value, '/Test/Group[uniqueName="N10001"])=1;Yes, you'll need to workout where to split the document.. Good, and typical points to break up the entity are if you have a choice of one or more complex structures.
The following code may help with looking at this..
You'll need to register the XML Schema with gentables="false" so that all the types get generated.. You can then look at the types and see how many columns each type will generate if you build a table on it...
create or replace package XDB_ANALYZE_XMLSCHEMA_11100
authid CURRENT_USER
as
function analyzeStorageModel(COMPLEX_TYPE VARCHAR2) return XMLTYPE;
function analyzeStorageModel(ATTR_NAME VARCHAR2, SUBTYPE VARCHAR2, SUBTYPE_OWNER VARCHAR2) return XMLType;
function analyzeComplexType(COMPLEX_TYPE VARCHAR2) return XMLTYPE;
procedure renameCollectionTable (XMLTABLE varchar2, XPATH varchar2, COLLECTION_TABLE_PREFIX varchar2);
function printNestedTables(XML_TABLE varchar2) return XMLType;
function generateSchemaFromTable(P_TABLE_NAME varchar2, P_OWNER varchar2 default USER) return XMLTYPE;
function showSQLTypes(schemaFolder varchar2) return XMLType;
NAMESPACES varchar2(1024) := xdb_namespaces.XMLSCHEMA_PREFIX_XSD || ' ' || xdb_namespaces.XDBSCHEMA_PREFIX_XDB;
end XDB_ANALYZE_XMLSCHEMA_11100;
show errors
create or replace package body XDB_ANALYZE_XMLSCHEMA_11100
as
TYPE STORAGE_MODEL_T is RECORD
TYPE_NAME varchar2(128),
TYPE_OWNER varchar2(32),
STORAGE_MODEL XMLType
TYPE STORAGE_MODEL_LIST_T is TABLE OF STORAGE_MODEL_T;
TYPE BASETYPE_T is RECORD
SUBTYPE varchar2(128),
SUBTYPE_OWNER varchar2(32),
BASETYPE varchar2(128),
BASETYPE_OWNER varchar2(32)
TYPE BASETYPE_LIST_T IS TABLE OF BASETYPE_T;
DEPTH_COUNT NUMBER(2) := 0;
STORAGE_MODEL_LIST STORAGE_MODEL_LIST_T := STORAGE_MODEL_LIST_T();
BASETYPE_LIST BASETYPE_LIST_T := BASETYPE_LIST_T();
function getLocalAttributes(SQLTYPE varchar2, SQLTYPE_OWNER VARCHAR2) return XMLType;
function makeElement(ATTR_NAME varchar2)
return xmltype
as
VALID_NAME varchar2(4000) := ATTR_NAME;
begin
-- dbms_output.put_line('Processing : ' || ATTR_NAME);
if (ATTR_NAME LIKE '%$') THEN
VALID_NAME := SUBSTR(VALID_NAME,1,LENGTH(VALID_NAME) - 1);
end if;
return XMLTYPE( '<' || VALID_NAME || '/>');
end;
function getPathToRoot(SUBTYPE VARCHAR2, SUBTYPE_OWNER VARCHAR2)
return varchar2
as
TYPE_HIERARCHY varchar2(4000);
begin
SELECT sys_connect_by_path( OWNER || '.' || TYPE_NAME , '/')
INTO TYPE_HIERARCHY
FROM ALL_TYPES
WHERE TYPE_NAME = SUBTYPE
AND OWNER = SUBTYPE_OWNER
CONNECT BY SUPERTYPE_NAME = PRIOR TYPE_NAME
AND SUPERTYPE_OWNER = PRIOR OWNER
START WITH SUPERTYPE_NAME IS NULL
AND SUPERTYPE_OWNER IS NULL;
return TYPE_HIERARCHY;
end;
function expandSQLType(ATTR_NAME VARCHAR2, SUBTYPE VARCHAR2, SUBTYPE_OWNER VARCHAR2)
return XMLType
as
STORAGE_MODEL XMLTYPE;
ATTRIBUTES XMLTYPE;
EXTENDED_TYPE XMLTYPE;
ATTR_COUNT NUMBER := 0;
CURSOR FIND_EXTENDED_TYPES
is
select TYPE_NAME, OWNER
from ALL_TYPES
where SUPERTYPE_NAME = SUBTYPE
and SUPERTYPE_OWNER = SUBTYPE_OWNER;
begin
dbms_output.put_line('Processing SQLType : "' || SUBTYPE_OWNER || '.' || SUBTYPE || '".' );
STORAGE_MODEL := makeElement(ATTR_NAME);
select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@type',SUBTYPE)
into STORAGE_MODEL
from dual;
select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@typeOwner',SUBTYPE_OWNER)
into STORAGE_MODEL
from dual;
ATTRIBUTES := getLocalAttributes(SUBTYPE, SUBTYPE_OWNER);
ATTR_COUNT := ATTR_COUNT + ATTRIBUTES.extract('/' || ATTRIBUTES.getRootElement() || '/@columns').getNumberVal();
select appendChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),ATTRIBUTES)
into STORAGE_MODEL
from DUAL;
for t in FIND_EXTENDED_TYPES loop
EXTENDED_TYPE := expandSQLType('ExtendedType',T.TYPE_NAME,T.OWNER);
ATTR_COUNT := ATTR_COUNT + EXTENDED_TYPE.extract('/' || EXTENDED_TYPE.getRootElement() || '/@columns').getNumberVal();
select appendChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),EXTENDED_TYPE)
into STORAGE_MODEL
from DUAL;
end loop;
select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@columns',ATTR_COUNT)
into STORAGE_MODEL
from dual;
return STORAGE_MODEL;
end;
function getTypeHierarchy(ELEMENT_NAME varchar2, TYPE_HIERARCHY varchar2)
return XMLType
as
SUBTYPE_HIERARCHY varchar2(4000);
ATTRIBUTES XMLTYPE;
SUBTYPE_STORAGE_MODEL XMLTYPE;
STORAGE_MODEL XMLTYPE;
ATTR_COUNT NUMBER := 0;
V_TYPE_OWNER varchar2(32);
V_TYPE_NAME varchar2(128);
CURSOR FIND_EXTENDED_TYPES
is
select TYPE_NAME, OWNER
from ALL_TYPES
where SUPERTYPE_NAME = V_TYPE_NAME
and SUPERTYPE_OWNER = V_TYPE_OWNER;
begin
dbms_output.put_line('Type Hierarchy : ' || TYPE_HIERARCHY );
if DEPTH_COUNT > 25 then
return null;
end if;
DEPTH_COUNT := DEPTH_COUNT + 1;
SUBTYPE_HIERARCHY := substr(TYPE_HIERARCHY,instr(TYPE_HIERARCHY,'/',2));
V_TYPE_OWNER := substr(TYPE_HIERARCHY,2,instr(TYPE_HIERARCHY,'.',2) - 2);
if (instr(TYPE_HIERARCHY,'/',-1) > 1) then
V_TYPE_NAME := substr(TYPE_HIERARCHY,instr(TYPE_HIERARCHY,'.',2) + 1,instr(TYPE_HIERARCHY,'/',2) - instr(TYPE_HIERARCHY,'.',2) -1);
else
V_TYPE_NAME := substr(TYPE_HIERARCHY,instr(TYPE_HIERARCHY,'.') + 1);
SUBTYPE_HIERARCHY := null;
end if;
dbms_output.put_line('Processing : "' || V_TYPE_OWNER || '"."' || V_TYPE_NAME || '"');
STORAGE_MODEL := makeElement(ELEMENT_NAME);
select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@type',V_TYPE_NAME)
into STORAGE_MODEL
from dual;
select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@typeOwner',V_TYPE_OWNER)
into STORAGE_MODEL
from dual;
ATTRIBUTES := getLocalAttributes(V_TYPE_NAME, V_TYPE_OWNER);
ATTR_COUNT := ATTR_COUNT + ATTRIBUTES.extract('/' || ATTRIBUTES.getRootElement() || '/@columns').getNumberVal();
select appendChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),ATTRIBUTES)
into STORAGE_MODEL
from DUAL;
if (SUBTYPE_HIERARCHY is not null) then
SUBTYPE_STORAGE_MODEL := getTypeHierarchy('subType',SUBTYPE_HIERARCHY);
ATTR_COUNT := ATTR_COUNT + SUBTYPE_STORAGE_MODEL.extract('/' || SUBTYPE_STORAGE_MODEL.getRootElement() || '/@columns').getNumberVal();
select appendChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),SUBTYPE_STORAGE_MODEL)
into STORAGE_MODEL
from DUAL;
else
dbms_output.put_line('Processing All known SubTypes of : "' || V_TYPE_OWNER || '"."' || V_TYPE_NAME || '"');
for t in FIND_EXTENDED_TYPES loop
SUBTYPE_STORAGE_MODEL := expandSQLType('ExtendedType',T.TYPE_NAME,T.OWNER);
ATTR_COUNT := ATTR_COUNT + SUBTYPE_STORAGE_MODEL.extract('/' || SUBTYPE_STORAGE_MODEL.getRootElement() || '/@columns').getNumberVal();
select appendChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),SUBTYPE_STORAGE_MODEL)
into STORAGE_MODEL
from DUAL;
end loop;
end if;
select insertChildXML(STORAGE_MODEL,'/' || STORAGE_MODEL.getRootElement(),'@columns',ATTR_COUNT)
into STORAGE_MODEL
from dual;
DEPTH_COUNT := DEPTH_COUNT - 1;
return STORAGE_MODEL;
end;
function getStorageModel(TYPE_NAME VARCHAR2, TYPE_OWNER VARCHAR2)
return XMLType
as
BASETYPE varchar2(128);
BASETYPE_OWNER varchar2(32);
STORAGE_MODEL STORAGE_MODEL_T;
begin
dbms_output.put_line('Depth : ' || DEPTH_COUNT || '. Getting Storage Model for "' || TYPE_OWNER || '.' || TYPE_NAME || '".' );
if DEPTH_COUNT > 25 then
return null;
end if;
DEPTH_COUNT := DEPTH_COUNT + 1;
for i in 1..STORAGE_MODEL_LIST.count loop
STORAGE_MODEL := STORAGE_MODEL_LIST(i);
if (STORAGE_MODEL.TYPE_NAME = TYPE_NAME and STORAGE_MODEL.TYPE_OWNER = TYPE_OWNER) then
DEPTH_COUNT := DEPTH_COUNT - 1;
return STORAGE_MODEL.STORAGE_MODEL;
end if;
end loop;
STORAGE_MODEL.TYPE_NAME := TYPE_NAME;
STORAGE_MODEL.TYPE_OWNER := TYPE_OWNER;
STORAGE_MODEL.STORAGE_MODEL := getTypeHierarchy('RootType',getPathToRoot(TYPE_NAME,TYPE_OWNER));
STORAGE_MODEL_LIST.extend(1);
STORAGE_MODEL_LIST(STORAGE_MODEL_LIST.count) := STORAGE_MODEL;
DEPTH_COUNT := DEPTH_COUNT - 1;
return STORAGE_MODEL.STORAGE_MODEL;
end;
function getLocalAttributes(SQLTYPE varchar2, SQLTYPE_OWNER VARCHAR2)
return XMLType
as
CHILD_ATTR XMLTYPE;
ATTR_COUNT NUMBER := 0;
COLLECTION_TYPE varchar2(128);
COLLECTION_OWNER varchar2(32);
SUPERTYPE varchar2(128);
STORAGE_MODEL xmlType;
SQL_ATTRIBUTES XMLTYPE := xmlType('<SQLAttributes/>');
CURSOR FIND_CHILD_ATTRS
is
select ATTR_NAME, ATTR_TYPE_OWNER, ATTR_TYPE_NAME, INHERITED
from ALL_TYPE_ATTRS
where TYPE_NAME = SQLTYPE
and OWNER = SQLTYPE_OWNER
and INHERITED = 'NO'
order by ATTR_NO;
begin
for ATTR in FIND_CHILD_ATTRS loop
CHILD_ATTR := makeElement(ATTR.ATTR_NAME);
begin
-- Check for Attributes based on collection types, With Nested Table storage each Collection will cost 2 columns.
select ELEM_TYPE_NAME, ELEM_TYPE_OWNER
into COLLECTION_TYPE, COLLECTION_OWNER
from ALL_COLL_TYPES
where TYPE_NAME = ATTR.ATTR_TYPE_NAME
and OWNER = ATTR.ATTR_TYPE_OWNER;
-- Attribute is a Collection Type. Each Collection requires 2 columns.
select insertChildXML(CHILD_ATTR,'/' || CHILD_ATTR.getRootElement(),'@collectionType',COLLECTION_TYPE)
into CHILD_ATTR
from dual;
select insertChildXML(CHILD_ATTR,'/' || CHILD_ATTR.getRootElement(),'@collectionOwner',COLLECTION_OWNER)
into CHILD_ATTR
from dual;
select insertChildXML(CHILD_ATTR,'/' || CHILD_ATTR.getRootElement(),'@columns',2)
into CHILD_ATTR
from dual;
exception
when no_data_found then
-- Attribute is not a collection type.
begin
-- Check for Attributes based on non-scalar types.
select SUPERTYPE_NAME
into SUPERTYPE
from ALL_TYPES
where TYPE_NAME = ATTR.ATTR_TYPE_NAME
and OWNER = ATTR.ATTR_TYPE_OWNER;
-- Attribute is based on a non-scalar type. Find the Storage Model for this type.
select insertChildXML(CHILD_ATTR,'/' || CHILD_ATTR.getRootElement(),'@type',ATTR.ATTR_TYPE_NAME)
into CHILD_ATTR
from dual;
select insertChildXML(CHILD_ATTR,'/' || CHILD_ATTR.getRootElement(),'@owner',ATTR.ATTR_TYPE_OWNER)
into CHILD_ATTR
from dual;
STORAGE_MODEL := getStorageModel(ATTR.ATTR_TYPE_NAME, ATTR.ATTR_TYPE_OWNER);
select appendChildXML(CHILD_ATTR,'/' || ATTR.ATTR_NAME,STORAGE_MODEL)
into CHILD_ATTR
from DUAL;
-- The cost of a non scalar Type is the number of attributes plus one for Type and one for the TYPEID.
select insertChildXML(CHILD_ATTR,'/' || ATTR.ATTR_NAME,'@columns',STORAGE_MODEL.extract(STORAGE_MODEL.GETROOTELEMENT() || '/@columns').getNumberVal() + 2)
into CHILD_ATTR
from dual;
exception
when no_data_found then
-- Attribute is based on a scalar type
select insertChildXML(CHILD_ATTR,'/' || CHILD_ATTR.getRootElement(),'@type',ATTR.ATTR_TYPE_NAME)
into CHILD_ATTR
from dual;
select insertChildXML(CHILD_ATTR,'/' || CHILD_ATTR.getRootElement(),'@columns',1)
into CHILD_ATTR
from dual;
end;
end;
select appendChildXML(SQL_ATTRIBUTES,'/' || SQL_ATTRIBUTES.getRootElement(),CHILD_ATTR)
into SQL_ATTRIBUTES
from DUAL;
ATTR_COUNT := ATTR_COUNT + CHILD_ATTR.extract('/' || CHILD_ATTR.getRootElement() || '/@columns').getNumberVal();
end loop;
select insertChildXML(SQL_ATTRIBUTES,'/' || SQL_ATTRIBUTES.getRootElement(),'@columns',ATTR_COUNT)
into SQL_ATTRIBUTES
from dual;
return SQL_ATTRIBUTES;
end;
function analyzeStorageModel(ATTR_NAME VARCHAR2, SUBTYPE VARCHAR2, SUBTYPE_OWNER VARCHAR2)
return XMLType
as
ROOT_NODE_NAME VARCHAR2(128);
TYPE_DEFINITION XMLTYPE;
STORAGE_MODEL XMLTYPE;
ATTR_COUNT NUMBER := 0;
begin
dbms_output.put_line('Processing Attribute : "' || ATTR_NAME || '". SQLType="' || SUBTYPE_OWNER || '.' || SUBTYPE || '".' );
TYPE_DEFINITION := makeElement(ATTR_NAME);
select insertChildXML(TYPE_DEFINITION,'/' || TYPE_DEFINITION.getRootElement(),'@type',SUBTYPE)
into TYPE_DEFINITION
from dual;
select insertChildXML(TYPE_DEFINITION,'/' || TYPE_DEFINITION.getRootElement(),'@owner',SUBTYPE_OWNER)
into TYPE_DEFINITION
from dual;
STORAGE_MODEL := getStorageModel(SUBTYPE, SUBTYPE_OWNER);
ATTR_COUNT := ATTR_COUNT + STORAGE_MODEL.extract('/' || STORAGE_MODEL.getRootElement() || '/@columns').getNumberVal();
select insertChildXML(TYPE_DEFINITION,'/' || TYPE_DEFINITION.getRootElement(),'@columns',ATTR_COUNT)
into TYPE_DEFINITION
from dual;
select appendChildXML
TYPE_DEFINITION,
'/' || TYPE_DEFINITION.getRootElement(),
STORAGE_MODEL
into TYPE_DEFINITION
from DUAL;
return TYPE_DEFINITION;
end;
function analyzeStorageModel(COMPLEX_TYPE VARCHAR2)
return XMLTYPE
as
SQLTYPE VARCHAR2(128);
SQLTYPE_OWNER VARCHAR2(32);
RESULT XMLTYPE;
begin
STORAGE_MODEL_LIST := STORAGE_MODEL_LIST_T();
select SQLTYPE, SQLTYPE_OWNER
into SQLTYPE, SQLTYPE_OWNER
from USER_XML_SCHEMAS,
xmlTable
xmlnamespaces
'http://www.w3.org/2001/XMLSchema' as "xsd",
'http://xmlns.oracle.com/xdb' as "xdb"
'/xsd:schema/xsd:complexType'
passing Schema
columns
COMPLEX_TYPE_NAME varchar2(4000) path '@name',
SQLTYPE varchar2(128) path '@xdb:SQLType',
SQLTYPE_OWNER varchar2(32) path '@xdb:SQLSchema'
where COMPLEX_TYPE_NAME = COMPLEX_TYPE;
-- dbms_output.put_line('Processing SQLType : "' || SQLTYPE_OWNER || '.' || SQLTYPE || '".' );
return analyzeStorageModel(COMPLEX_TYPE,SQLTYPE,SQLTYPE_OWNER);
exception
when no_data_found then
dbms_output.put_line('Unable to find SQLType mapping for complexType : "' || COMPLEX_TYPE || '".' );
return null;
end;
function analyzeSQLType(ATTR_NAME VARCHAR2, TARGET_TYPE_NAME VARCHAR2, TARGET_TYPE_OWNER VARCHAR2)
return XMLType
as
ROOT_NODE_NAME VARCHAR2(128);
ATTR_DETAIL XMLTYPE;
XPATH_EXPRESSION VARCHAR2(129);
CURSOR FIND_CHILD_ATTRS is
select ATTR_NAME, ATTR_TYPE_OWNER, ATTR_TYPE_NAME, INHERITED
from ALL_TYPE_ATTRS
where OWNER = TARGET_TYPE_OWNER
and TYPE_NAME = TARGET_TYPE_NAME
order by ATTR_NO;
CHILD_ATTR XMLTYPE;
ATTR_COUNT NUMBER := 0;
TEMP number;
COLLECTION_TYPE_NAME varchar2(256);
COLLECTION_TYPE_OWNER varchar2(256);
begin
-- dbms_output.put_line('Processing Attribute ' || ATTR_NAME || ' of ' || TARGET_TYPE_OWNER || '.' || TARGET_TYPE_NAME );
ATTR_DETAIL := makeElement(ATTR_NAME);
XPATH_EXPRESSION := '/' || ATTR_DETAIL.GETROOTELEMENT();
for ATTR in FIND_CHILD_ATTRS loop
begin
select ELEM_TYPE_NAME, ELEM_TYPE_OWNER
into COLLECTION_TYPE_NAME, COLLECTION_TYPE_OWNER
from ALL_COLL_TYPES
where TYPE_NAME = ATTR.ATTR_TYPE_NAME
and OWNER = ATTR.ATTR_TYPE_OWNER;
CHILD_ATTR := analyzeSQLType(ATTR.ATTR_NAME, COLLECTION_TYPE_NAME, COLLECTION_TYPE_OWNER );
ATTR_COUNT := ATTR_COUNT + CHILD_ATTR.extract('/' || CHILD_ATTR.GETROOTELEMENT() || '/@columns').getNumberVal();
select appendChildXML(ATTR_DETAIL,XPATH_EXPRESSION,CHILD_ATTR)
into ATTR_DETAIL
from DUAL;
exception
when no_data_found then
begin
select 1
into TEMP
from ALL_TYPES
where TYPE_NAME = ATTR.ATTR_TYPE_NAME
and OWNER = ATTR.ATTR_TYPE_OWNER;
CHILD_ATTR := analyzeSQLType(ATTR.ATTR_NAME, ATTR.ATTR_TYPE_NAME, ATTR.ATTR_TYPE_OWNER );
ATTR_COUNT := ATTR_COUNT + CHILD_ATTR.extract('/' || CHILD_ATTR.GETROOTELEMENT() || '/@columns').getNumberVal();
select appendChildXML(ATTR_DETAIL,XPATH_EXPRESSION,CHILD_ATTR)
into ATTR_DETAIL
from DUAL;
exception
when no_data_found then
ATTR_COUNT := ATTR_COUNT + 1;
end;
end;
end loop;
select insertChildXML(ATTR_DETAIL,XPATH_EXPRESSION,'@columns',ATTR_COUNT)
into ATTR_DETAIL
from dual;
return ATTR_DETAIL;
end;
function analyzeComplexType(COMPLEX_TYPE VARCHAR2)
return XMLType
as
RESULT xmltype;
SQLTYPE varchar2(128);
SQLTYPE_OWNER varchar2(32);
begin
select SQLTYPE, SQLTYPE_OWNER
into SQLTYPE, SQLTYPE_OWNER
from USER_XML_SCHEMAS,
xmlTable
xmlnamespaces
'http://www.w3.org/2001/XMLSchema' as "xsd",
'http://xmlns.oracle.com/xdb' as "xdb"
'/xsd:schema/xsd:complexType'
passing Schema
columns
COMPLEX_TYPE_NAME varchar2(4000) path '@name',
SQLTYPE varchar2(128) path '@xdb:SQLType',
SQLTYPE_OWNER varchar2(32) path '@xdb:SQLSchema'
where COMPLEX_TYPE_NAME = COMPLEX_TYPE;
result := analyzeSQLType(COMPLEX_TYPE,SQLTYPE,SQLTYPE_OWNER);
select insertChildXML(RESULT,'/' || COMPLEX_TYPE,'@SQLType',SQLTYPE)
into result
from dual;
return result;
end;
function showSQLTypes(schemaFolder varchar2) return XMLType
is
xmlSchema XMLTYPE;
begin
select xmlElement
"TypeList",
xmlAgg
xmlElement
"Schema",
xmlElement
"ResourceName",
extractValue(res,'/Resource/DisplayName')
xmlElement
"complexTypes",
select xmlAgg
xmlElement
"complexType",
xmlElement
"name",
extractValue(value(XML),'/xsd:complexType/@name',NAMESPACES)
xmlElement
"SQLType",
extractValue(value(XML),'/xsd:complexType/@xdb:SQLType',NAMESPACES)
from table
xmlsequence
extract
xdburitype(p.path).getXML(),
'/xsd:schema/xsd:complexType',
NAMESPACES
) xml
-- order by extractValue(value(XML),'/xsd:complexType/@name',NAMESPACES)
).extract('/*')
into xmlSchema
from path_view p
where under_path(res,schemaFolder) = 1
order by extractValue(res,'/Resource/DisplayName');
return xmlSchema;
end;
procedure renameCollectionTable (XMLTABLE varchar2, XPATH varchar2, COLLECTION_TABLE_PREFIX varchar2)
as
SYSTEM_GENERATED_NAME varchar2(256);
COLLECTION_TABLE_NAME varchar2(256);
CLUSTERED_INDEX_NAME varchar2(256);
PARENT_INDEX_NAME varchar2(256);
RENAME_STATEMENT varchar2(4000);
begin
COLLECTION_TABLE_NAME := COLLECTION_TABLE_PREFIX || '_TABLE';
CLUSTERED_INDEX_NAME := COLLECTION_TABLE_PREFIX || '_DATA';
PARENT_INDEX_NAME := COLLECTION_TABLE_PREFIX || '_LIST';
select TABLE_NAME
into SYSTEM_GENERATED_NAME
from ALL_NESTED_TABLES
where PARENT_TABLE_NAME = XMLTABLE
and PARENT_TABLE_COLUMN = XPATH
and OWNER = USER;
RENAME_STATEMENT := 'alter table ' || USER || '."' || SYSTEM_GENERATED_NAME || '" rename to "' ||COLLECTION_TABLE_NAME || '"';
-- dbms_output.put_line(RENAME_STATEMENT);
execute immediate RENAME_STATEMENT;
begin
select INDEX_NAME
into SYSTEM_GENERATED_NAME
from ALL_INDEXES
where TABLE_NAME = COLLECTION_TABLE_NAME
and INDEX_TYPE = 'IOT - TOP'
and OWNER = USER;
RENAME_STATEMENT := 'alter index ' || USER || '."' || SYSTEM_GENERATED_NAME || '" rename to "' || CLUSTERED_INDEX_NAME || '"';
-- dbms_output.put_line(RENAME_STATEMENT);
execute immediate RENAME_STATEMENT;
exception
when NO_DATA_FOUND then
null;
end;
begin
select INDEX_NAME
into SYSTEM_GENERATED_NAME
from ALL_IND_COLUMNS
where COLUMN_NAME = XPATH
and TABLE_NAME = XMLTABLE
and TABLE_OWNER = USER;
RENAME_STATEMENT := 'alter index ' || USER || '."' || SYSTEM_GENERATED_NAME || '" rename to "' || PARENT_INDEX_NAME || '"';
-- dbms_output.put_line(RENAME_STATEMENT);
execute immediate RENAME_STATEMENT;
exception
when NO_DATA_FOUND then
null;
end;
end;
function processNestedTable(currentLevel in out number, currentNode in out XMLType, query SYS_REFCURSOR)
return XMLType
is
thisLevel number;
thisNode xmlType;
result xmlType;
begin
thisLevel := currentLevel;
thisNode := currentNode;
fetch query into currentLevel, currentNode;
if (query%NOTFOUND) then
currentLevel := -1;
end if;
while (currentLevel >= thisLevel) loop
-- Next Node is a decendant of sibling of this Node.
if (currentLevel > thisLevel) then
-- Next Node is a decendant of this Node.
result := processNestedTable(currentLevel, currentNode, query);
select xmlElement
"Collection",
extract(thisNode,'/Collection/*'),
xmlElement
"NestedCollections",
result
into thisNode
from dual;
else
-- Next node is a sibling of this Node.
result := processNestedTable(currentLevel, currentNode, query);
select xmlconcat(thisNode,result) into thisNode from dual;
end if;
end loop;
-- Next Node is a sibling of some ancestor of this node.
return thisNode;
end;
function printNestedTables(XML_TABLE varchar2)
return XMLType
is
query SYS_REFCURSOR;
result XMLType;
rootLevel number := 0;
rootNode xmlType;
begin
open query for
select level, xmlElement
"Collection",
xmlElement
"CollectionId",
PARENT_TABLE_COLUMN
) as XML
from USER_NESTED_TABLES
connect by PRIOR TABLE_NAME = PARENT_TABLE_NAME
start with PARENT_TABLE_NAME = XML_TABLE;
fetch query into rootLevel, rootNode;
result := processNestedTable(rootLevel, rootNode, query);
select xmlElement
"NestedTableStructure",
result
into result
from dual;
return result;
end;
function generateSchemaFromTable(P_TABLE_NAME varchar2, P_OWNER varchar2 default USER)
return XMLTYPE
as
xmlSchema XMLTYPE;
begin
select xmlElement
"xsd:schema",
xmlAttributes
'http://www.w3.org/2001/XMLSchema' as "xmlns:xsd",
'http://xmlns.oracle.com/xdb' as "xmlns:xdb"
xmlElement
"xsd:element",
xmlAttributes
'ROWSET' as "name",
'rowset' as "type"
xmlElement
"xsd:complexType",
xmlAttributes
'rowset' as "name"
xmlElement
"xsd:sequence",
xmlElement
"xsd:element",
xmlAttributes
'ROW' as "name",
table_name || '_T' as "type",
'unbounded' as "maxOccurs"
xmlElement
"xsd:complexType",
xmlAttributes
table_name || '_T' as "name"
xmlElement
"xsd:sequence",
xmlAgg(ELEMENT order by INTERNAL_COLUMN_ID)
into xmlSchema
from (select TABLE_NAME, INTERNAL_COLUMN_ID,
case
when DATA_TYPE = 'VARCHAR2' then
xmlElement
"xsd:element",
xmlattributes
column_name as "name",
column_name as "xdb:SQLName",
DATA_TYPE as "xdb:SQLTYPE"
xmlElement
"xsd:simpleType",
xmlElement
"xsd:restriction",
xmlAttributes
'xsd:string' as "base"
xmlElement
"xsd:maxLength",
xmlAttributes
DATA_LENGTH as "value"
when DATA_TYPE = 'DATE' then
xmlElement
"xsd:element",
xmlattributes
column_name as "name",
'xsd:dateTime' as "type",
column_name as "xdb:SQLName",
DATA_TYPE as "xdb:SQLTYPE"
else
xmlElement
"xsd:element",
xmlattributes
column_name as "name",
'xsd:anySimpleType' as "type",
column_name as "xdb:SQLName",
DATA_TYPE as "xdb:SQLTYPE"
end ELEMENT
from all_tab_cols c
where c.TABLE_NAME = P_TABLE_NAME
and c.OWNER = P_OWNER
group by TABLE_NAME;
return xmlSchema;
end;
end XDB_ANALYZE_XMLSCHEMA_11100;
show errors
--You can use this as follows...
SQL> set long 100000
SQL> select xdb_analyze_xmlschema.analyzeStorageModel('ComponentA') from dual;
<ComponentA type="COMPONENTA_T" owner="XDBTEST" columns="50">
<RootType type="COMPONENTA_T" typeOwner="XDBTEST" columns="50">
<SQLAttributes columns="14">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<COMPONENTA_UNIQUENAME type="COMPONENTA_UNIQUENAME_T" owner="XDBTEST" columns="6">
<RootType type="COMPONENTA_UNIQUENAME_T" typeOwner="XDBTEST" columns="4">
<SQLAttributes columns="4">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<SYS_XDBBODY type="VARCHAR2" columns="1"/>
<DISPLAYNAME type="VARCHAR2" columns="1"/>
</SQLAttributes>
</RootType>
</COMPONENTA_UNIQUENAME>
<COMPONENTA_DESCRIPTION type="COMPONENTA_DESCRIPTION_T" owner="XDBTEST" columns="6">
<RootType type="COMPONENTA_DESCRIPTION_T" typeOwner="XDBTEST" columns="4">
<SQLAttributes columns="4">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<SYS_XDBBODY type="VARCHAR2" columns="1"/>
<DISPLAYNAME type="VARCHAR2" columns="1"/>
</SQLAttributes>
</RootType>
</COMPONENTA_DESCRIPTION>
</SQLAttributes>
<ExtendedType type="COMPONENTB_T" typeOwner="XDBTEST" columns="30">
<SQLAttributes columns="12">
<COMPONENTB_CONTROLNUMBER type="COMPONENTB_CONTROLNUMBER_T" owner="XDBTEST" columns="6">
<RootType type="COMPONENTB_CONTROLNUMBER_T" typeOwner="XDBTEST" columns="4">
<SQLAttributes columns="4">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<SYS_XDBBODY type="VARCHAR2" columns="1"/>
<DISPLAYNAME type="VARCHAR2" columns="1"/>
</SQLAttributes>
</RootType>
</COMPONENTB_CONTROLNUMBER>
<COMPONENTB_COREFOLDER type="COMPONENTB_COREFOLDER_T" owner="XDBTEST" columns="6">
<RootType type="COMPONENTB_COREFOLDER_T" typeOwner="XDBTEST" columns="4">
<SQLAttributes columns="4">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<SYS_XDBBODY type="VARCHAR2" columns="1"/>
<DISPLAYNAME type="VARCHAR2" columns="1"/>
</SQLAttributes>
</RootType>
</COMPONENTB_COREFOLDER>
</SQLAttributes>
<ExtendedType type="COMPONENTD_T" typeOwner="XDBTEST" columns="18">
<SQLAttributes columns="18">
<COMPONENTD_FINDINGTYPE type="COMPONENTD_FINDINGTYPE_T" owner="XDBTEST" columns="6">
<RootType type="COMPONENTD_FINDINGTYPE_T" typeOwner="XDBTEST" columns="4">
<SQLAttributes columns="4">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<SYS_XDBBODY type="VARCHAR2" columns="1"/>
<DISPLAYNAME type="VARCHAR2" columns="1"/>
</SQLAttributes>
</RootType>
</COMPONENTD_FINDINGTYPE>
<COMPONENTD_PRIORITY type="COMPONENTD_PRIORITY_T" owner="XDBTEST" columns="6">
<RootType type="COMPONENTD_PRIORITY_T" typeOwner="XDBTEST" columns="4">
<SQLAttributes columns="4">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<SYS_XDBBODY type="VARCHAR2" columns="1"/>
<DISPLAYNAME type="VARCHAR2" columns="1"/>
</SQLAttributes>
</RootType>
</COMPONENTD_PRIORITY>
<COMPONENTD_SUMMARY type="COMPONENTD_SUMMARY_T" owner="XDBTEST" columns="6">
<RootType type="COMPONENTD_SUMMARY_T" typeOwner="XDBTEST" columns="4">
<SQLAttributes columns="4">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<SYS_XDBBODY type="VARCHAR2" columns="1"/>
<DISPLAYNAME type="VARCHAR2" columns="1"/>
</SQLAttributes>
</RootType>
</COMPONENTD_SUMMARY>
</SQLAttributes>
</ExtendedType>
</ExtendedType>
<ExtendedType type="COMPONENTC_T" typeOwner="XDBTEST" columns="6">
<SQLAttributes columns="6">
<COMPONENTC_CONTROLNUMBER type="COMPONENTC_CONTROLNUMBER_T" owner="XDBTEST" columns="6">
<RootType type="COMPONENTC_CONTROLNUMBER_T" typeOwner="XDBTEST" columns="4">
<SQLAttributes columns="4">
<SYS_XDBPD collectionType="RAW" collectionOwner="" columns="2"/>
<SYS_XDBBODY type="VARCHAR2" columns="1"/>
<DISPLAYNAME type="VARCHAR2" columns="1"/>
</SQLAttributes>
</RootType>
</COMPONENTC_CONTROLNUMBER>
</SQLAttributes>
</ExtendedType>
</RootType>
</ComponentA>THis will tell you that a table based xml element of the complexType 'componentA' will have approx 50 columns.. -
InfoPath 2010: Problem with xsi:type on import
I'd like to create a form based on an XML file, but the XML file contains lots of xsi:type attributes, and this seems to cause an error. Is there any work around to this? Does anyone know if 2013 version has this problem?
Hi John,
I couldn't find much more information about the xsi:type used in InfoPath 2010 and 20113, only the following articles you can see if it could help, and for more questions about this topic you can post in Office forum (Office
for IT pro, or
Office for Dev) for a better assistance.
http://msdn.microsoft.com/en-us/library/office/bb608317(v=office.11).aspx
http://msdn.microsoft.com/en-us/library/office/ee526359.aspx
Elements with an Abstract Complex Type
InfoPath 2003
If an element is defined as having an abstract type, then the element cannot appear in the instance document as an instance of that type; rather, it must be specified as a type deriving from the abstract type. For the schema to validate correctly, the instance
of that element must use a different type and must specify that type with an xsi:type attribute. The type referenced in this attribute must derive from the abstract type.
Without InfoPath SP 1 installed, you cannot design a form against a schema that uses this construct. One workaround is to change the element type to a derived type of the abstract type in the schema itself.
Thanks
Daniel Yang
TechNet Community Support -
XPath Question related to xsi:type
I have the response of a service callout that I need to process. The service callout response uses xsi:type to specify the type of the object being returned. I need to use the value of the xsi:type attribute to collect the xml elements.
Here is the xpath that I am trying to use:
$addAssetInfoResponse/ast:addAssetInfoResponse/ast:result/ast:asset\[local-name-from-QName(attribute::xsi:type)='Customer'\]
(ast: is mapped to http://www.fatspaniel.com/ws/asset/)
When I test this XPath with the following XML fragement as value of addAssetInfoResponse variable:
<env:Body xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<ns2:addAssetInfoResponse xmlns:ns2="http://www.fatspaniel.com/ws/asset/" >
<ns2:result>
<ns2:status>SUCCESS</ns2:status>
<ns2:asset xsi:type="ns4:Customer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns4="http://www.fatspaniel.com/ws/sysobj/" >
<entityId>106934</entityId>
<type>Customer</type>
<name>AAI Customer - 200909081651</name>
</ns2:asset>
</ns2:result>
</ns2:addAssetInfoResponse>
</env:Body>
I get the following error:
Error executing the transformation: {err}XP0021: "ns4:Customer": can not cast to {http://www.w3.org/2001/XMLSchema}QName: error: Invalid QName value: Can't resolve prefix 'ns4'
Have I made a mistake in the xpath ? Is there a better way for extracting assets elements of certain type ?
Thank you.
Rahul Phadnis
Edited by: RahulPhadnis on Sep 15, 2009 10:57 AMJohn Spencer wrote:
Unless I missed something in the 11g new features, the maximum line length in DBMS_OUTPUT.Put_Line is still 255 characters.
SQL> select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod
PL/SQL Release 10.2.0.4.0 - Production
CORE 10.2.0.4.0 Production
TNS for 32-bit Windows: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production
SQL> set serveroutput on
SQL> exec dbms_output.put_line(lpad('X',512,'X'));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
PL/SQL procedure successfully completed.
SQL> SY. -
Xsi:type information is missing after Marshalling in JAXB
Hi,
I'm trying to mock the webservice, i have created classes for schema using JAXB (without any customization) and it's working. But when i try to marhsall my objects , it doesn't generate the xsi:type information of any element and attribute. I want this information since my webservice client needs this information.
I have tried to use mapSimpleTypeDef ="true" generateElementProperty="false" but it doesn�t help.
Following is output of marshal process
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageRetrieveResponseReturn xmlns:java="java:types.api.brokerapi.soap.mms"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<return>
<APIVersion>1.0</APIVersion>
<ErrorCode>1000</ErrorCode>
<ErrorInfo> Success</ErrorInfo>
<BillingInfo xsi:type="java:BillingInfoObject" xsi:nil="true"/>
<HeaderInfo xsi:type="java:HeaderInfoType" xsi:nil="true"/>
<Content xsi:type="java:MessageContentType" xsi:nil="true"/>
</return>
</MessageRetrieveResponseReturn>
I want output to be look like following
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MessageRetrieveResponseReturn xmlns:java="java:types.api.brokerapi.soap.mms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<return xsi:type="java:MessageRetrieveResponse" >
<APIVersion xsi:type="java:apiVersionType">1.0</APIVersion>
<ErrorCode xsi:type="xsd:string">1000</ErrorCode>
<ErrorInfo xsi:type="xsd:string">Success</ErrorInfo>
<BillingInfo xsi:type="java:BillingInfoObject" xsi:nil="true"/>
<HeaderInfo xsi:type="java:HeaderInfoType" xsi:nil="true"/>
<Content xsi:type="java:MessageContentType" xsi:nil="true"/>
</return>
</MessageRetrieveResponseReturn>
I'm new to JAXB. Please let me know what I�m missing here
RegardsNot got a single answer , surprise whether the question is too dumb to ask or JAXB doesn't support feature or my requirement is weird :-) ... in any case let me know please
regards -
Missing xsi:type, invalid xml generated, jaxb 1.6
Hi,
i've this XML Schema defined for my doc/lit web service:
<complexType name="CasDataType">
<sequence>
<element name="key" type="long" nillable="false minOccurs="1" maxOccurs="1"/>
</sequence>
</complexType>
<complexType name="AddressDataType">
<complexContent>
<extension base="tns:CasDataType">
<sequence>
<element name="FirstName" nillable="true" minOccurs="0" type="string"/>
<element name="LastName" nillable="true" minOccurs="0" type="string"/>
</sequence>
</extension>
</complexContent>
</complexType>If i create a AddressDataType and return it with my web service, the jaxb-marshaller generates this xml code:
<casDataTypes>
<key>123</key>
<FirstName>Ingo</FirstName>
<LastName>Siebert</LastName>
</casDataTypes>But correct would be this:
<casDataTypes xsi:type="AddressDataType" >
<key>123</key>
<FirstName>Ingo</FirstName>
<LastName>Siebert</LastName>
</casDataTypes>Is this error already known?
Is it fixed with jaxb 2.0?
I doesn't like annotations, is it possible with jaxb 2.0 (XJC task) to geneate files without annotations?
Cheers,
IngoNot got a single answer , surprise whether the question is too dumb to ask or JAXB doesn't support feature or my requirement is weird :-) ... in any case let me know please
regards -
URGENT HELP! - The prefix "xsi" for attribute "xsi:type" is not bound
Hi! i createD a WebService using the JWSDP 1.2. In the server-side i read a xml file, create another empty Document and using the importNode() method i populate the empty created doc. The problem is when i try to send client this created document. I'm using the DOMSource to send it to client side. Both client and WS method code are below! Does anyone know the answer??
And I'm getting this error:
[java] Endpoint address = http://localhost:8080/cm/ContextManager
[java] [Fatal Error] :2:42: The prefix "xsi" for attribute "xsi:type" is not bound.
[java] javax.xml.transform.TransformerException: org.xml.sax.SAXParseException: The prefix "xsi" for attribute "xsi:type" is not bound.
[java] at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:469)
[java] at contextclient.CMClient.main(Unknown Source)
[java] Caused by: org.xml.sax.SAXParseException: The prefix "xsi" for attribute "xsi:type" is not bound.
[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1139)
[java] at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:452)
[java] ... 1 more
[java] ---------
[java] org.xml.sax.SAXParseException: The prefix "xsi" for attribute "xsi:type" is not bound.
[java] at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1139)
[java] at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:452)
[java] at contextclient.CMClient.main(Unknown Source)
====================CLIENT CODE================================
Source getdevice = manager.getDevice("How");
DOMResult domResult = new DOMResult();
// getting a transformation factory instance
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.transform(getdevice, domResult);
Node node = domResult.getNode();
DOMSource domSRC = new DOMSource(node);
StreamResult streamResult = new StreamResult(System.out);
transformer.transform(domSRC, streamResult);
===============================================================
===================WebService Method CODE======================
public Source getDevice(String primaryContext)
Source src = null;
try
String uri = "C:\\foo\\DeviceInstance.xml";
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
//create the first Document
Document doc1 = builder.parse(uri);
//create the second Document
Document doc2 = builder.newDocument();
//create the second doc's root element and append it
Element rootDoc2 = (Element)doc2.createElement("device");
doc2.appendChild(rootDoc2);
//get root of first document
Element rootDoc1 = doc1.getDocumentElement();
NodeList list = rootDoc1.getElementsByTagName(primaryContext);
for(int i = 0; i < list.getLength(); i++)
Element nodeToMove = (Element) list.item(i);
Node newNode = doc2.importNode(nodeToMove, true);
rootDoc2.appendChild(newNode);
src = new DOMSource(doc2);
catch(DOMException dome)
dome.printStackTrace();
catch(Exception e)
e.printStackTrace();
return src;
===============================================================
Does anyone know what could it be? Please, it's very urgent!
Tks in Advance,
Rodrigo.The xml i'm trying to send is below. It's important explain that in a standalone app it works perfectly. Unfortunately, when i perform the same actions in the WS world, it doesn't work. See, i tried to put the attributes inside the root element with the setAttributeNS() method but i got the same error again. How could i bound the attribute with no errors like that said before???
<?xml version="1.0" encoding="UTF-8"?>
<device xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="context.xsd">
<Identity xsi:type="fooType">
<Name>
<GivenName>Rodrigo</GivenName>
<FamilyName>Felicio</FamilyName>
</Name>
</Identity>
<Identity xsi:type="foowType">
<DeviceID>dev00345</DeviceID>
</Identity>
</device>
Regards,
Rodrigo. -
SOAP-ERROR: Parsing Schema: element has both 'type' attribute and subtype
Hi,
i have created web service link which deals with calling a Pl/sql procedure with the help of DBAdapter in jdev 10.1.3.4 .here i am trying to insert a row in tables.my webservice is working fine from BPEL console
my collegue who is working on PHP is trying to access the the wsdl link with the help of Appcelator and php
code for php
<?php
//include("general.php");
$wsdl_url = 'http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/CreateRepairOrder/1.0/CreateRepairOrder?wsdl';
//$wsdl_url = 'http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/UpdateROStatus1/1.0/UpdateROStatus1?wsdl';
$client = new SoapClient($wsdl_url,array('trace' => 1,'exceptions' => 0));
print_r($client);
exit;
class CreateOrderNd
var $PARTY_ID="";
var $CUST_ACCOUNT_ID="";
var $INVENTORY_ITEM_ID="";
var $SERIAL_NUMBER="";
var $UNIT_OF_MEASURE="";
var $QUANTITY="";
var $ITEM_CROSS_REFERENCE="";
var $PROBLEM_DESCRIPTION="";
function CreateOrderNd($PartyNam,$AccountId,$ItemId_requestdata,$SerialNumber_requestdata,$uom_requestdata,
$quantity_requestdata,$ItemCrossReference_requestdata,$ProblemDescription_requestdata)
$this->PARTY_ID=$PartyName;
$this->CUST_ACCOUNT_ID=$AccountId;
$this->INVENTORY_ITEM_ID=$ItemId_requestdata;
$this->SERIAL_NUMBER=$SerialNumber_requestdata;
$this->UNIT_OF_MEASURE=$uom_requestdata;
$this->QUANTITY=$quantity_requestdata;
$this->ITEM_CROSS_REFERENCE=$ItemCrossReference_requestdata;
$this->PROBLEM_DESCRIPTION=$ProblemDescription_requestdata;
$parm = new CustomerNd($PartyName_requestdata,$AccountId_requestdata,$ItemId_requestdata,$SerialNumber_requestdata,$uom_requestdata,
$quantity_requestdata,$ItemCrossReference_requestdata,$ProblemDescription_requestdata);
$parm = new CustomerNd('Bus%','');
$parm = new CreateOrderNd(4429,1608,6761,'0722AB05','Ea',1,'abc123','Network error');
$ret=$client->process($parm);
print_r($ret);
?>
when she/he access it they are facing a error
SOAP-ERROR: Parsing Schema: element has both 'type' attribute and subtype
and some times it will give
Warning: SoapClient::SoapClient(http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/UpdateROStatus1/1.0/UpdateROStatus1?wsdl) http://function.SoapClient-SoapClient: failed to open stream: HTTP request failed! in C:\xampp\htdocs\DepotExtensions\version9\app\services\CreateOrderNd.class.php on line 6
Warning: SoapClient::SoapClient() http://function.SoapClient-SoapClient: I/O warning : failed to load external entity "http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/UpdateROStatus1/1.0/UpdateROStatus1?wsdl" in C:\xampp\htdocs\DepotExtensions\version9\app\services\CreateOrderNd.class.php on line 6
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/UpdateROStatus1/1.0/UpdateROStatus1?wsdl' in C:\xampp\htdocs\DepotExtensions\version9\app\services\CreateOrderNd.class.php on line 6Hi,
i have created web service link which deals with calling a Pl/sql procedure with the help of DBAdapter in jdev 10.1.3.4 .here i am trying to insert a row in tables.my webservice is working fine from BPEL console
my collegue who is working on PHP is trying to access the the wsdl link with the help of Appcelator and php
code for php
<?php
//include("general.php");
$wsdl_url = 'http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/CreateRepairOrder/1.0/CreateRepairOrder?wsdl';
//$wsdl_url = 'http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/UpdateROStatus1/1.0/UpdateROStatus1?wsdl';
$client = new SoapClient($wsdl_url,array('trace' => 1,'exceptions' => 0));
print_r($client);
exit;
class CreateOrderNd
var $PARTY_ID="";
var $CUST_ACCOUNT_ID="";
var $INVENTORY_ITEM_ID="";
var $SERIAL_NUMBER="";
var $UNIT_OF_MEASURE="";
var $QUANTITY="";
var $ITEM_CROSS_REFERENCE="";
var $PROBLEM_DESCRIPTION="";
function CreateOrderNd($PartyNam,$AccountId,$ItemId_requestdata,$SerialNumber_requestdata,$uom_requestdata,
$quantity_requestdata,$ItemCrossReference_requestdata,$ProblemDescription_requestdata)
$this->PARTY_ID=$PartyName;
$this->CUST_ACCOUNT_ID=$AccountId;
$this->INVENTORY_ITEM_ID=$ItemId_requestdata;
$this->SERIAL_NUMBER=$SerialNumber_requestdata;
$this->UNIT_OF_MEASURE=$uom_requestdata;
$this->QUANTITY=$quantity_requestdata;
$this->ITEM_CROSS_REFERENCE=$ItemCrossReference_requestdata;
$this->PROBLEM_DESCRIPTION=$ProblemDescription_requestdata;
$parm = new CustomerNd($PartyName_requestdata,$AccountId_requestdata,$ItemId_requestdata,$SerialNumber_requestdata,$uom_requestdata,
$quantity_requestdata,$ItemCrossReference_requestdata,$ProblemDescription_requestdata);
$parm = new CustomerNd('Bus%','');
$parm = new CreateOrderNd(4429,1608,6761,'0722AB05','Ea',1,'abc123','Network error');
$ret=$client->process($parm);
print_r($ret);
?>
when she/he access it they are facing a error
SOAP-ERROR: Parsing Schema: element has both 'type' attribute and subtype
and some times it will give
Warning: SoapClient::SoapClient(http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/UpdateROStatus1/1.0/UpdateROStatus1?wsdl) http://function.SoapClient-SoapClient: failed to open stream: HTTP request failed! in C:\xampp\htdocs\DepotExtensions\version9\app\services\CreateOrderNd.class.php on line 6
Warning: SoapClient::SoapClient() http://function.SoapClient-SoapClient: I/O warning : failed to load external entity "http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/UpdateROStatus1/1.0/UpdateROStatus1?wsdl" in C:\xampp\htdocs\DepotExtensions\version9\app\services\CreateOrderNd.class.php on line 6
Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://sfhyd1.softforce.com:8888/orabpel/DepotExtnDev/UpdateROStatus1/1.0/UpdateROStatus1?wsdl' in C:\xampp\htdocs\DepotExtensions\version9\app\services\CreateOrderNd.class.php on line 6 -
XML attributes and object types
I want to create an XML Document of the following form
<family>
<parent attr1="val1">
<child attr2="val2" attr3="val3"/>
</parent>
</family>
Using object table and object type (for the child element), I am able to produce the following XML Document (with a "select * from family" query)
<family> <!-- rowset -->
<parent> <!-- row -->
<attr1>val1</attr1>
<child>
<attr2>val2</attr2>
<attr3>val3</attr3>
</child>
</parent>
</family>
The question is: how am I going to query these data so that the "attr" elements are mapped to attributes (using XSU only, without XSLT)?
I have already tried the following:
1. Using
SELECT attr1 as "@attr1",
f.child.attr2 "@attr2",
f.child.attr3 "@attr3"
FROM family f
all the attributes are obviously appended to the "parent" element.
2. Using nested table for "child" and the following query
SELECT attr1 as "@attr1",
CURSOR (
SELECT n.child.attr2 as "@attr2", n.child.attr3 as "@attr3"
FROM TABLE(f.child n)
) AS "child"
FROM family f
I am getting the following document
<family>
<parent attr1="val1">
<child>
<child_ROW attr2="val2" attr3="val3"/>
</child>
</parent>
</family>
Is there a smart SQL query to produce the desired document? What data types
is it recommended to use to define my db schema (object types, nested tables...)?
Thank you in advance
nullFinally, I got the desired XML format output from relational tablse using schema based XMLType views.
Wherein I created Object Types from relational table, generated the schema for the Object type, registered the schema and finally created XMLType Views for populating the XML data from Relational Tables.
I guess, you all might aware of my problem, where I got struck. Instead of printing the data in XML format I am successful in generating the XML format data Using the Query Select from BLABLA_Type_view* . I am able to print the number of rows, that I require which is in the fallowing format.
Column Name
1. SYS.XMLTYPE ----- As a row
The view I am querying for is printing the data in a string format, where in I got to do the fallowing query
SELECT SYS.XMLTYPE.getStringVal(OBJECT_VALUE) FROM BLABLA_Type_view. Which ultimately gave me the required data in XML format with tags.
Thanks for every one who tried to give a try to solve, especially "mdrake"
Maybe you are looking for
-
Hi All, We are using a Z function on RF device we get a run time error.While packing a material for delivery we key in material no & hit enter to poulate the desc. of material and then enter quantity and continue.After keying in material when we hi
-
Add'l ideas to cure slow Time Machine backup
Over the past 10 days, the average duration of my Time Machine backups has gone from 1 minute to :42-:45 minutes. There's been no significant shift in my computing behavior during that time. To fix, I've tried nearly everything recommended in Pondini
-
Ftp/tcp: unknown service - Sol8, as root, my files are good!
I've done some research and tried a few things, but for one reason or another, I am unable to ftp OUT as the root (or any other) user on my Ultra 5/Solaris 8 box. /etc/inet/services, inetd.conf, and /etc/nsswitch.conf are all in proper order with 644
-
Does 3250 themes fit into N91? 3250 has more size in the display... I mean four icon lines while N91 only displays 3 like oldest S60 (6600, 7610, 6681)... And the principal doubt is if can use 3250 themes with perfect function in the N91 while it has
-
Where is the Content setting page?
Trying to allow popup .