Get sorted distinct element from XML message in BPEL
Hi,
I have a database adapter which picks all the records with status 'N', it has different batch IDs.
My requirement is to get all the distinct batch ID from the message collection, is it possible I can get the distinct batchID in ascending order in while process activity?
Please help me if anyone have idea.
Thanks in advance.
Regards,
Sreejit
Sreejit,
You can not sort element in the While activity. You need to use <xsl:sort/> to sort elements.
See the following articles for <xsl:sort/> :
http://www.w3schools.com/xsl/el_sort.asp
http://www.dpawson.co.uk/xsl/sect2/N6461.html#d10242e19
Regards,
Dharmendra
http://soa-howto.blogspot.com
Similar Messages
-
How get all child elements from XML
Hi
I have one xml i tried to parse that xml using dom parser and i need to get some child elements using java
<Group>
<NAME>ABC</NAME>
<Age>24</AgeC>
---------some data here......
<Group1>
<group1Category>
<NAME>ABCTest</NAME>
<age>27</Age>
----Some data here
<group1subcategory>
<subcategory>
<NAME>ABCDEF</NAME>
<age>28</Age>
my intention was
get group name (here ABC) i need all other name value from group1category ,group1 subcategory but pblm that
my xml contains any number of Group nodes...but only i want name contains ABC
i wriiten code like this
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(xmlFile);
NodeList nodeList = document.getElementsByTagName("*");
for (int i = 0; i < nodeList.getLength(); i++)
Element element = (Element) nodeList.item(i);
what is next step i need to do..please help964749 wrote:
Sorry for inconvenience caused..i only asked if any ideas i not ask any body to spent time for me...
This is simple code developed using xpath..i not know how i proceed further
public class Demo {
public static void main(String[] args) {
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document dDoc = builder.parse("hello.xml");
XPath xpath = XPathFactory.newInstance().newXPath();
javax.xml.xpath.XPathExpression expr = xpath.compile("//Group/NAME");
Object Name= expr.evaluate(dDoc, XPathConstants.STRING);
System.out.println(Name);
} catch (Exception e) {
e.printStackTrace();
i need get group name (here ABC) i need all other name value from group1category ,group1 subcategory but pblm that
..how i done in XPATH and also do manipulation of remining result...
i also try with DOM like
NodeList nodeList = document.getElementsByTagName("GROUP");
for (int i = 0; i < nodeList.getLength(); i++)
Element element = (Element) nodeList.item(i);
if (element.getNodeName().matches("ECUC-MODULE-DEF"))
String str=((Element) nodeList.item(i)).getElementsByTagName("NAME").item(0).getFirstChild().getNodeValue();
if(str.equalsIgnoreCase("abc")){
NodeList children = element.getChildNodes();
for (int k = 0; k < children.getLength(); k++) {
Node child = children.item(k);
System.out.println("children"+children.getLength());
if (child.getNodeType() != Node.TEXT_NODE) {
if(child.getNodeName().equalsIgnoreCase("Group1"))
how iterate for particular ABC name to group1 and subcategoryFew things
1. Use code tags to format code
2. Explain the problem statement clearly. Take time to formulate your question. Explain what you expect from your code and what you are getting along with any exceptions that are being thrown -
I cannot send email from my ipad. Getting address is rejected from server message.
I cannot send email from my ipad. Getting address is rejected from server message.
Check the outgoing mail server setting. Make sure that your username and password are in there.
Settings>Mail, Contacts, Calendars>Your email account>Account>Outgoing mail server - tap the server name next to SMTP and check in the primary server and make sure your username and password are entered and correct - even if it says that the password is optional. -
Remove element from xml using dom.
i want to remove an element from an xml file using dom.
i remove the element but the whole content of the file is also deleted.
how can i rewrite the file.vij_ay wrote:
subject :Remove element from xml,but if empty element in input file then output should be <tag></tag>, not like <tag.xml/>I assume you mean <tag/> but why do you want this? Any application that will not accept this valid XML construct is flawed and a bug report should be raised against it. -
Please help me in inserting data into table from XML message.
Hi Experts,
Please provide a procedure to implement my below requirement.
Since I am new to queue concept.
[code]- <MESSAGES>
- <MESSAGE ID="3026900">
<MSG_ID>3026900</MSG_ID>
<DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
<POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
<DT_LAST_QUEUED />
- <MSG>
- <WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="UPDATE" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="3838" geo="AT" sku="A0814818" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="202" geo="GB" sku="A0814819" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814820" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="ADD" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="202" geo="GB" sku="A0814821" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814822" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
- <WORK_UNIT GROUP="LEAD_TIME" ACTION="DELETE" AFFECTED="LEAD_TIME">
- <RECORDSET TABLE_NAME="LEAD_TIME">
- <xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data>
<z:row business_unit_id="202" geo="GB" sku="A0814817" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
<z:row business_unit_id="2828" geo="BE" sku="A0814816" dw_maint_flag="False" stock_status_id="0" lead_time="30" est_qty="0" leadtime_lock="False" update_dts="2013-06-12T02:08:30.367" update_uid="DEACTIVATE_SKU_PROCESS" leadtime_dts="2010-05-22T02:21:21.707" leadtime_uid="Lead_Time_Rules" />
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
</WORK_SET>
</MSG>
</MESSAGE>
</MESSAGES>[/code]
The above XML message is receieved by our oracle queue.Once the message is receieved to our queue.
We have to process the message according to the action(UPDATE ADD DELETE).
From this message we have to process only 3 fields (geo sku lead_time).
These three feilds data should be processed into the SKU_LEAD_TIME table based on the action.
Req1:
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
based on the below condition.
[code]UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
Req2:
IF the action is delete then the records should be deleted from the "LEAD_TIME_TABLE" table.
based on the below condition.
[code]DELETE FROM LEAD_TIME_TABLE
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;[/code]
Req3:
IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE" and "LEAD_TIME_TABLE_STAGING" table
based on the below conditions.
Req3.1:
If SKU from XML message is available in "SKU_TABLE" table
then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE" table.
Req3.2:
If SKU from XML message is not available in "SKU_TABLE" table
then the three parameter(GEO SKU LEAD_TIME) values from XML message should be inserted into "LEAD_TIME_TABLE_STAGING" table.
Req3.3:
Once the new SKU is avilable in "SKU_TABLE" table then the corresponding SKU record should be
inserted into "LEAD_TIME_TABLE" table and that record should be deleted from "LEAD_TIME_TABLE_STAGING" table.
I am posting required scripts and test cases.
[code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
CREATE TABLE LEAD_TIME_TABLE_STAGING(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
CREATE TABLE SKU_TABLE(sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
INSERT INTO SKU_TABLE VALUES('A0814817','GB',30);
INSERT INTO SKU_TABLE VALUES('A0814818','AT',30);
INSERT INTO SKU_TABLE VALUES('A0814819','GB',30);
INSERT INTO SKU_TABLE VALUES('A0814820','BE',30);
INSERT INTO SKU_TABLE VALUES('A0814821','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
INSERT INTO LEAD_TIME_TABLE_STAGING VALUES('A0814822','BE',30);[/code]
From the above message.
Test case for req3.1:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814821" is available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE.
[code]SELECT * FROM LEAD_TIME_TABLE;
SKU GEO LEAD_TIME
A0814817 GB 30
A0814818 AT 20
A0814819 GB 20
A0814820 BE 20
A0814821 GB 30[/code]
Test case for req3.2:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
SKU GEO LEAD_TIME
A0814822 BE 30[/code]
Test case for req3.3:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
Once I insert SKU number "A0814822" in SKU_TABLE table.
The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
and should be deleted from LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING; --- should return NULL.
SELECT * FROM LEAD_TIME_TABLE;
SKU GEO LEAD_TIME
A0814817 GB 30
A0814818 AT 20
A0814819 GB 20
A0814820 BE 20
A0814821 GB 30
A0814822 BE 30[/code]
Please help me.
Thanks in advance.Hi,
I have resolved this issue.
But I have stuck up in implementing some of the scenarios.
Req1:
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
IF the action is update then the records should be updated in the "LEAD_TIME_TABLE" table
based on the below condition.
UPDATE LEAD_TIME_TABLE SET lead_time= lead time from xml message
WHERE LEAD_TIME_TABLE.SKU=sku from xml message AND LEAD_TIME_TABLE.GEO=geo from xml message;
Req3:
IF the action is add then the records should be inserted in the "LEAD_TIME_TABLE" and "LEAD_TIME_TABLE_STAGING" table
based on the below conditions.
Req3.1:
If SKU from XML message is available in "schema_name.SKU_TABLE" table.
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
then the three parameter(GEO SKU LEAD_TIME) values from XML message and two fields MODEL,CLASS from SKU_TABLE
should be inserted into "LEAD_TIME_TABLE" table.
Req3.2:
If SKU from XML message is not available in "schema_name.SKU_TABLE" table
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of XML message and "sid" of MAPPING table WHERE business_unit_id=sid.
then the four parameter(BUSINESS_UNIT_ID GEO SKU LEAD_TIME) values from XML message
should be inserted into "LEAD_TIME_TABLE_STAGING" table.
Req3.3:
Once the new SKU is avilable in "schema_name.SKU_TABLE" table then the corresponding SKU record should be
inserted into "LEAD_TIME_TABLE" table and that record should be deleted from "LEAD_TIME_TABLE_STAGING" table.
The schema_name.SKU_TABLE table should be selected based on "business_unit_id" of LEAD_TIME_TABLE_STAGING and "sid" of MAPPING table WHERE business_unit_id=sid.
I am posting required scripts and test cases.
[code]CREATE TABLE LEAD_TIME_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class CHAR(1),geo VARCHAR2(6),lead_time NUMBER,created DATE);
CREATE TABLE LEAD_TIME_TABLE_STAGING(business_unit_id NUMBER,sku VARCHAR2(20),geo VARCHAR2(6),lead_time NUMBER);
CREATE TABLE SKU_TABLE(sku VARCHAR2(20),model VARCHAR2(20),class VARCHAR2(10));
CREATE TABLE mapping(sid NUMBER,schema_name VARCHAR2(20));
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814817','GB',30);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814818','AT',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814819','GB',20);
INSERT INTO LEAD_TIME_TABLE(SKU,GEO,LEAD_TIME) VALUES('A0814820','BE',20);
INSERT INTO SKU_TABLE VALUES('A0814817','M125','C111');
INSERT INTO SKU_TABLE VALUES('A0814818','M127','A111');
INSERT INTO SKU_TABLE VALUES('A0814819','M126','A111');
INSERT INTO SKU_TABLE VALUES('A0814820','N100','B111');
INSERT INTO SKU_TABLE VALUES('A0814821','P123','B111');
INSERT INTO mapping VALUES(202,'WEDB');
INSERT INTO mapping VALUES(2828,'HR');
INSERT INTO mapping VALUES(3838,'BB');
[/code]
Test case for req3.1:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814821" is available in schema_name.SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE.
[code]SELECT * FROM LEAD_TIME_TABLE;
SKU MODEL CLASS GEO LEAD_TIME
A0814817 M125 C111 GB 30
A0814818 M127 A111 AT 20
A0814819 M126 A111 GB 20
A0814820 N100 B111 BE 20
A0814821 P123 B111 GB 30
[/code]
Test case for req3.2:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
so the record should be inserted in the LEAD_TIME_TABLE_STAGING.
[code]SELECT * FROM LEAD_TIME_TABLE_STAGING;
BUSINESS_UNIT_ID SKU GEO LEAD_TIME
2828 A0814822 BE 30[/code]
Test case3.3.3:
The action for SKU numbers "A0814821" "A0814822" are insert.
The SKU number "A0814822" is not available in SKU_TABLE table.
Once I insert SKU number "A0814822" in SKU_TABLE table.
The corresponding records automatically should be inserted in the LEAD_TIME_TABLE
and should be deleted from LEAD_TIME_TABLE_STAGING.
[code]INSERT INTO SKU_TABLE VALUES('A0814822','P123','B111');
SELECT * FROM LEAD_TIME_TABLE_STAGING; --- should return NULL.
SELECT * FROM LEAD_TIME_TABLE;
SKU MODEL CLASS GEO LEAD_TIME
A0814817 M125 C111 GB 30
A0814818 M127 A111 AT 20
A0814819 M126 A111 GB 20
A0814820 N100 B111 BE 20
A0814821 P123 B111 GB 30
A0814822 P123 B111 GB 30[/code]
I am able to implement Req1 and Req3.1 for action UPDATE and INSERT in single merge statement.
However my code is not taking care of all my requirements.
Please find my below code.
[code] CREATE OR REPLACE PACKAGE BODY messg_values_process
AS
procedure ProcessInboundLtimeMessage(p_xml_message XmlType)
is
begin
for work_unit in (
select message.MESSAGE_ID
, work_unit.ACTION
, work_unit.LEADTIME_NODES
from XmlTable(
'/MESSAGES/MESSAGE'
passing p_xml_message
columns
MESSAGE_NO for ordinality
, MESSAGE_ID number path '@ID'
, WORK_UNIT_NODES XmlType path 'MSG/WORK_SET/WORK_UNIT'
) message
, XmlTable(
XmlNamespaces(
'urn:schemas-microsoft-com:rowset' as "rs"
, '#RowsetSchema' as "z"
'/WORK_UNIT'
passing message.WORK_UNIT_NODES
columns
WORK_UNIT_NO for ordinality
, ACTION varchar2(10 char) path '@ACTION'
, LEADTIME_NODES XmlType path 'RECORDSET[@TABLE_NAME="LEAD_TIME"]/xml/rs:data/z:row'
) work_unit
LOOP
CASE work_unit.ACTION
WHEN 'ADD' THEN MergeData(work_unit.LEADTIME_NODES);
WHEN 'UPDATE' THEN MergeData(work_unit.LEADTIME_NODES);
WHEN 'DELETE' THEN RemoveData(work_unit.LEADTIME_NODES);
ELSE null;
END CASE;
END LOOP;
END ProcessInboundLtimeMessage;
procedure MergeData(p_leadtime_nodes XmlType)
is
begin
if (p_leadtime_nodes is not null) then
merge into LEAD_TIME_TABLE old
using(
select *
from XmlTable(
XmlNamespaces(
'urn:schemas-microsoft-com:rowset' as "rs"
, '#RowsetSchema' as "z"
'/z:row[not(@business_unit_id=following-sibling::z:row/@business_unit_id)]'
passing p_leadtime_nodes
columns
ITEM_NO for ordinality
, BUSINESS_UNIT_ID number path '@business_unit_id'
, GEO varchar2(20 char) path '@geo'
, SKU varchar2(20 char) path '@sku'
, LEAD_TIME number path '@lead_time'
) NEW
ON (old.VK_UNIT = new.SKU
AND old.GEO=new.GEO)
when matched then update
set old.LEAD_TIME = new.LEAD_TIME
when not matched then INSERT
( old.VK_UNIT
, old.MODEL
, old.CLASS
, old.GEO
, old.LEAD_TIME
, old.COUNTDOWN
, old.LAST_UPDATED_DATE
values
( new.SKU
,'A123'
,'A1234'
, new.GEO
, new.LEAD_TIME
, 'N'
, sysdate
end if;
exception
when others then
LogDataError(
'MergeData Procedure Failed #: '||chr(10)||sqlerrm
, null
, null
END MergeData;
END messg_values_process;
/[/code]
Please help me.
Thanks. -
I have a white Macbook 2009 on OSX Lion. It came with the OSX Snow Leopard CD, I erased the HDD and am trying to install the OSX from disc but am getting "cannot install OSX from disc" message. What can I do?
I got the macbook from a friend a few years ago and it already had OSX Lion installed. Whenever it boots from the Snow Leopard disc it says it cannot install from disc. Is there anythingI can do or should I take it to an Apple store to get them to boot OSX Lion for me?Insert your Snow Leopard disc and restart, press and hold the C key as soon as you hearthe startup chime, hold C until you see the Apple Logo. When your computer starts up you'll be at the first install screen, choose your language and click the arrow to go to the next screen. This screen has a menu bar, from the Utilities menu select Disk Utility, select your hard drive, this is the one with the manufacturers name or numbers, click the partition tab and then delete any existing partitions by selecting them and clicking the minus. In the drop down box select one partition and click apply. Name your hard drive and click erase. When it's done quit DU and go back to the installer, install Snow Leopard. When the installer is done and the computer is back up and running run Software Update to get to 10.6.8
-
Failed to get hierarchy group elements from middleware
When iam configuring the Mobile Infrastructure and clicked on Hierarchy Grouping i got the following error.
Error:Failed to get hierarchy group elements from middleware. Reason: Could not connect to middleware
Could anyone tell meaning the above statement and why it is occuring.
Secondly when iam trying to start the MI Webconsole from the below URL, I was getting Page Cannot be Displayed Error.
https://server:50300/me/WebConsole/login. Can anyone tell why this error is coming.Hi Siva,
Sorry for the delay reply. I have a few things to ask.
First my problem is not solved, still iam getting the error.
Secondly, i have done the configuration for Mobile Administrator, but during the configuration When deploying the JRA File (Standard Installation and Installation of Cluster both needs to be done or Standard Installation is sufficient).
Not only that after configuring the Mobile Administrator do i need configure the CCMS also, if so if i configure the CCMS would my error be resolved.
My User has all the required Authorizations but why am i getting the error i could not able to trace out
Lastly do i need to configure the Mobile Applications part also.
I need to have a quick reply on this. Can anyone help me in this issue. -
Hello B2B Gurus,
I am able to process B2B inbound files successfully from Trading Partner --> B2B --> BPEL. When it comes to BPEL i am not able to parse/transform the received XML as i am getting selection failures in assign and empty nodes in transformation. When i look at the input XML payload which i received in ReceiveB2BConsume Payload i observed that i am getting namespace as " xmlns="NS_495C37A0921C418BB66A86A6E75B2CA120070312140549" instead of actual namespace xmlns="urn:oracle:b2b:X12/V4010/856" which is in my XSD as well and i am getting the XML start tag <?xml version="1.0" encoding="UTF-8" ?> 2 times. :
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<Transaction-856 xmlns="NS_495C37A0921C418BB66A86A6E75B2CA120070312140549" mlns:xsi="http://www.w3.org/2001/XMLSchema-instance" XDataVersion="1.0" Standard="X12" Version="V4010" CreatedDate="2013-08-21T16:33:57" CreatedBy="XEngine_2956" GUID="{00C28978-0AA1-11E3-88B9-80C16E7DC6DA}">
<Internal-Properties>
</Transaction-856>
I went back and checked the XSD which i loaded in the B2B Console and i am having the following namespace
"<xsd:schema xmlns="urn:oracle:b2b:X12/V4010/856" targetNamespace="urn:oracle:b2b:X12/V4010/856" xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0" elementFormDefault="qualified">"
I am not sure why the XML translated from EDI in B2B console has the different namespace and XML start tag 2 times. Can you please help me resolve the issue. Let me know if i am missing anything.
Thanks in Advance..Hi,
Please set property as b2b.setDynamicNameSpace=false.
To use EDI ecs and xsd files from Oracle B2B 10g version, set this property to true.
When using EDI ecs and xsd files in Oracle B2B 11g which were used in Oracle B2B 10g, the XEngine may generate dynamic namespace for the translated xml. For example,
xmlns="NS_31CA8D0F33324F95A0BF15D85539C27E20060518215520"
To turn off dynamic namespace generation for inbound EDI messages, set this property to false.
Thanks
Satendra Pare -
Set file name with XSLT - receiver channel - elements from XML?
Dear experts,
I have an XSLT mapping for a message that is sent via a receiver channel to a customer.
The customer wants a certain file name which is put toghether by elements from the XML message.
I have looked at:
Re: Java Map for writing the file
The java code and the XSLT work perfectly!
In the line
fos = new FileOutputStream(new File("Fixed_" + new Date().getTime() + ".xml"));
a fixed value, date and time are used for the file name.
But I need some values from the XML message to create my name. But how do I do that? Can I somehow get values from the XML message through that java function or do I have to adapt the XSLT?
Can someone please help me!
Thank you,
PeterHi Udo, Hello experts,
Now I do have a problem. I am using this XSL file:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:map="java:java.util.Map"
xmlns:dyn="java:com.sap.aii.mapping.api.DynamicConfiguration"
xmlns:key="java:com.sap.aii.mapping.api.DynamicConfigurationKey">
<xsl:output indent="no" />
<xsl:param name="inputparam"/>
<xsl:template match="/">
<!-- change dynamic configuration -->
<xsl:variable name="dynamic-conf"
select="map:get($inputparam, 'DynamicConfiguration')" />
<xsl:variable name="dynamic-key"
select="key:create('http://sap.com/xi/XI/System/File', 'FileName')" />
<xsl:variable name="dummy"
select="dyn:put($dynamic-conf, $dynamic-key, 'TOOLDATA_.xml')" />
<xsl:copy-of select="." />
</xsl:template>
</xsl:stylesheet>
But then the output file is only named "TOOLDATA_.xml". So I assume the XSL is working.
And I am using this Java-file:
package pi_mappings;
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.util.*;
public class SetFileName extends AbstractTransformation
static final int BUFFER = 1024*1000;
private Map param;
public SetFileName(){ }
public void setParameter (Map map)
param = map;
if (param == null)
param = new HashMap();
public static void main(String args[])
try
InputStream in = new FileInputStream(args[0]);
OutputStream out = new FileOutputStream(args[1]);
SetFileName sfn = new SetFileName();
//sfn.setParameter(mapOfMap);
sfn.execute(in, out);
catch (Exception e)
e.printStackTrace();
public void execute(InputStream inputstream, OutputStream outputstream)
throws StreamTransformationException {
try
DynamicConfiguration conf = (DynamicConfiguration) param.get("DynamicConfiguration");
DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
int len = 0;
byte buf[] = new byte[BUFFER];
FileOutputStream fos = null;
if (conf != null)
fos = new FileOutputStream(new File(conf.get(KEY_FILENAME) + new Date().getTime()) ); //sample only
else
fos = new FileOutputStream(new File("Fixed_" + new Date().getTime() + ".xml"));
while ((len = inputstream.read(buf)) > 0)
outputstream.write(buf, 0, len);
fos.write(buf, 0, len);
fos.close();
catch(Exception e){ e.printStackTrace();}
public void transform(TransformationInput arg0, TransformationOutput arg1)
throws StreamTransformationException {
getTrace().addInfo("JAVA Mapping Called");
this.execute(arg0.getInputPayload().getInputStream(), arg1
.getOutputPayload().getOutputStream());
Could you please help me find the mistake. I tried to test it locally by changing the main-method but I could not get it to work.
Thank you very much for any ideas!
Best regards,
Peter -
Why can't got element from XML
I try to load an XML element from an XML file using
HTTPService Object . But The loaded object always null .
Here is my XML Content
<?xml version="1.0" standalone="no"?>
<manifest identifier="imsmanifest.xml" version="1.3"
xmlns="
http://www.imsglobal.org/xsd/imscp_v1p1"
xmlns:adlcp="
http://www.adlnet.org/xsd/adlcp_v1p3"
xmlns:adlseq="
http://www.adlnet.org/xsd/adlseq_v1p3"
xmlns:imsss="
http://www.imsglobal.org/xsd/imsss"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.imsglobal.org/xsd/imscp_v1p1
imscp_v1p1.xsd
http://www.adlnet.org/xsd/adlcp_v1p3
adlcp_v1p3.xsd
http://www.adlnet.org/xsd/adlseq_v1p3
adlseq_v1p3.xsd
http://www.imsglobal.org/xsd/imsss
imsss_v1p0.xsd">
<metadata>
<schema>ADL SCORM</schema>
<schemaversion>CAM 1.3</schemaversion>
</metadata>
<organizations default="default_org">
<organization identifier="default_org">
<title>example_1</title>
<item identifier="lesson1"
identifierref="lesson1_ref">
<title>Lesson_1_Interface</title>
<imsss:sequencing xmlns:imsss="
http://www.imsglobal.org/xsd/imsss"
xmlns:adlseq="
http://www.adlnet.org/xsd/adlseq_vlp3">
<imsss:controlMode choiceExit="true" />
</imsss:sequencing>
</item>
<item identifier="lesson2"
identifierref="lesson2_ref">
<title>Lesson_2_Toolbox</title>
<imsss:sequencing xmlns:imsss="
http://www.imsglobal.org/xsd/imsss"
xmlns:adlseq="
http://www.adlnet.org/xsd/adlseq_vlp3">
<imsss:controlMode choiceExit="false" />
</imsss:sequencing>
</item>
<item identifier="lesson3"
identifierref="lesson3_ref">
<title>Lesson_3_Palettes</title>
<imsss:sequencing xmlns:imsss="
http://www.imsglobal.org/xsd/imsss"
xmlns:adlseq="
http://www.adlnet.org/xsd/adlseq_vlp3">
<imsss:controlMode choiceExit="true" />
</imsss:sequencing>
</item>
<item identifier="lesson4"
identifierref="lesson4_ref">
<title>Lesson_4_Layers</title>
<imsss:sequencing xmlns:imsss="
http://www.imsglobal.org/xsd/imsss"
xmlns:adlseq="
http://www.adlnet.org/xsd/adlseq_vlp3">
<imsss:controlMode choiceExit="true" />
</imsss:sequencing>
</item>
<imsss:sequencing xmlns:imsss="
http://www.imsglobal.org/xsd/imsss"
xmlns:adlseq="
http://www.adlnet.org/xsd/adlseq_vlp3">
<imsss:controlMode flow="false" forwardOnly="true"
choice="true" />
</imsss:sequencing>
</organization>
</organizations>
<resources>
<resource identifier="lesson1_ref"
adlcp:scormType="asset" type="webcontent" href="no title/Lesson 1
-- Interface/Lesson1.htm">
<file href="no title/Lesson 1 -- Interface/Lesson1.htm"
/>
<file href="no title/Lesson 1 --
Interface/images/headertop.gif" />
<file href="no title/Lesson 1 --
Interface/images/headerside.gif" />
<file href="no title/Lesson 1 --
Interface/images/pssidebar.gif" />
<file href="no title/Lesson 1 --
Interface/images/LessonTitle1.gif" />
<file href="no title/Lesson 1 --
Interface/images/interfacesmall.jpg" />
<file href="no title/Lesson 1 --
Interface/images/EndOfLesson.gif" />
</resource>
<resource identifier="lesson2_ref"
adlcp:scormType="asset" type="webcontent" href="no title/Lesson 2
-- Toolbox/Lesson2.htm">
<file href="no title/Lesson 2 -- Toolbox/Lesson2.htm"
/>
<file href="no title/Lesson 2 --
Toolbox/images/headertop.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/headerside.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/pssidebar.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/LessonTitle2.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/toolbox.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/selectiontools.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/enhancementtools.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/navagationtools.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/ZoomToolIcon.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/HandTool.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/colorselect.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/eyedroppertool.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/eyedroppertool.gif" />
<file href="no title/Lesson 2 --
Toolbox/images/EndOfLesson.gif" />
</resource>
<resource identifier="lesson3_ref"
adlcp:scormType="asset" type="webcontent" href="no title/Lesson 3
-- Palettes/Lesson3.htm">
<file href="no title/Lesson 3 -- Palettes/Lesson3.htm"
/>
<file href="no title/Lesson 3 --
Palettes/images/headertop.gif" />
<file href="no title/Lesson 3 --
Palettes/images/headerside.gif" />
<file href="no title/Lesson 3 --
Palettes/images/pssidebar.gif" />
<file href="no title/Lesson 3 --
Palettes/images/LessonTitle3.gif" />
<file href="no title/Lesson 3 --
Palettes/images/defaultpalettes.gif" />
<file href="no title/Lesson 3 --
Palettes/images/EndOfLesson.gif" />
</resource>
<resource identifier="lesson4_ref"
adlcp:scormType="asset" type="webcontent" href="no title/Lesson 4
-- Layers/Lesson4.htm">
<file href="no title/Lesson 4 -- Layers/Lesson4.htm"
/>
<file href="no title/Lesson 4 --
Layers/images/headertop.gif" />
<file href="no title/Lesson 4 --
Layers/images/headerside.gif" />
<file href="no title/Lesson 4 --
Layers/images/pssidebar.gif" />
<file href="no title/Lesson 4 --
Layers/images/LessonTitle4.gif" />
<file href="no title/Lesson 4 --
Layers/images/flatlayers.gif" />
<file href="no title/Lesson 4 -- Layers/images/37.gif"
/>
<file href="no title/Lesson 4 --
Layers/images/layers.gif" />
<file href="no title/Lesson 4 --
Layers/images/layerarrows.gif" />
<file href="no title/Lesson 4 --
Layers/images/eyeicon.gif" />
<file href="no title/Lesson 4 --
Layers/images/paintbrush.gif" />
<file href="no title/Lesson 4 --
Layers/images/linkicon.gif" />
<file href="no title/Lesson 4 --
Layers/images/newlayericon.gif" />
<file href="no title/Lesson 4 --
Layers/images/EndOfLesson.gif" />
</resource>
</resources>
</manifest>
quote:
Text
For example , i want to get metadata element .
var nodes:XML = XML(myManifestSrv.lastResult.metadata);
trace(nodes)
quote:
TextFollow your suggestion , i use AS style to load the XML.
below is my full code , it's an AIR application .
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute" initialize="init()">
<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.http.HTTPService;
public var myManifestSrv:HTTPService;
private function init():void{
myManifestSrv = new HTTPService();
myManifestSrv.url = "datas/example1/imsmanifest.xml";
myManifestSrv.resultFormat = "e4x";
myManifestSrv.addEventListener(ResultEvent.RESULT ,
manifestLoaded);
myManifestSrv.send();
private function manifestLoaded(event:Event):void{
var nodes:XML = XML(myManifestSrv.lastResult.metadata);
trace(nodes);
]]>
</mx:Script>
</mx:WindowedApplication>
you can try my code ,
trace(myManifestSrv.lastResult.metadata) is still null.
I am not quite sure whether the resaon of fault is from XML
problem .When i use a simple XML , such as :
<?xml version="1.0" encoding="UTF-8"?>
<galleries>
<gallery id="flextravel">
<description>Trip photos from various Flex team
members</description>
<photo>
<name>Acropolis: Matt Chotin</name>
<description>Acropolis on Calton Hill in
Edinburgh</description>
<source>flextravel/Acropolis on Calton
Hill.jpg</source>
</photo>
<photo>
<name>Edinburgh Castle: Matt Chotin</name>
<description>The Edinburgh Castle as seen from
fountain in the Princess Gardens</description>
<source>flextravel/Fountain and Edinburgh
Castle.jpg</source>
</photo>
</gallery>
</galleries>
It is OK. -
Delete elements from XML file using DOM and java
Hi
I want now is to remove element from my XML file
for example
i have following xml
<?xml version="1.0" encoding="UTF-8"?>
<printing>
<firstLineTexts>
<firstLineText />
<firstLineText>|line11</firstLineText>
<firstLineText>|line12</firstLineText>
</firstLineTexts>
</printing>how do i remove all elements fireLineText
my final output should be
<?xml version="1.0" encoding="UTF-8"?>
<printing>
<firstLineTexts>
</firstLineTexts>
</printing>How do i do it using DOM,
I can create instance of DOM and write it using TransformerFactory
AshishHi
I am trying the following code,
but it is not working
NodeList nScene = doc.getElementsByTagName("firstLineTexts");
NodeList nScene1 = nScene.item(0).getChildNodes();
for (int i = 0; i < nScene1.getLength(); i++)
Node n = nScene1.item(i);
nScene.item(0).removeChild(n);
} -
How to remove an Element from XML by confirming Attribute of that element
Hi guys
I have an XML file where i have all users DB. Now i want to remove a user from that XML file. I want to check an user id attribute which is uniqe with existing users in XML file, if its the same user then delete this user from XML file and save the changes in XML file.
here is my XML file:
<?xml version="1.0" encoding="UTF-8"?>
<users>
<user id="zahid" password="X8UrUN79avT27LYwUESiliAV328=" name="Zahid Nawaz" phone="9599808" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
<user id="Admin" name="alpha beta" password="fEqNCco3Yq9h5ZUglD3CZJT4lBs=" phone="456782656" email="[email protected]" role="Tnr+vPuuAAsix8heVWD4mioCgLQ=" />
<user id="Guest" name="beta alpha" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="8765432" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" /><user id="Guest1" name="unknown unknown" password="+ml3yZuAnbaOHFaIjsOL0ARxmzk=" phone="123122112" email="[email protected]" role="+s6D7jAUvcj5ggPMlOLokiJFLpA=" />
</users>for example i want to delete a user which have user id= Guest.
How can i do it in Java. Any code example please. i am using JDOM document and SAXBuilder for parsing.
Waiting for your replay.
Thanks in Advance
Best regardHi,
Till now i tried the following code which give null pointer exception at following line
element.getParentNode().removeChild(element);
public String removeUserByID(String id) throws Exception{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer tFormer = tFactory.newTransformer();
doc = builder.parse(usersXml);
Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);
// Remove the node
element.getParentNode().removeChild(element);
// Normalize the DOM tree to combine all adjacent nodes
doc.normalize();
FileOutputStream fos = new FileOutputStream(this.usersXml);
XMLOutputter out = new XMLOutputter();
out.output(((org.jdom.Document)doc), fos);
/* Source source = new DOMSource(doc);
Result dest = new StreamResult(System.out);
tFormer.transform(source, dest);
System.out.println();
return "true";
if following line i m trying to use first attribute of my XML file where i am passing a string which is for example like "user id=Guest". id is a string which have user Id "Guest".
Element element = (Element)doc.getElementsByTagName("user id="+id).item(0);So any suggestion??Whats wrong here?
Best regards and thanks again 4 ur reply. -
Get the mapping values from one message mapping into another message mappin
Hi All,
I created two graphical message mappings. In first message mapping i created one user defined function and set one global container parameter and I need to use this parameter in my second message mapping user defined function. But the global container parameters can be used in different user defined functions in same message mapping. So is there any way to use the values which are set in one message mapping into another message mapping. If yes, please help me how to get?Hi Koteswara rao,
As you said global container parameters from first message mapping are not accessible from second message mapping program.
i haven't faced situation like this.but, if you have some unmapped field in target message in first message mapping,you can put global variables data in that unmapped field.
anyway the output of first message mapping would be input for 2nd messages mapping,so you can access global data(unmapped field filled with global data in 1st MM) from 2nd mapping program..
Cheers,
Jag -
Extracting the input from xml document in BPEL
hi,
I have a simple JSP which invokes the "101.HelloWorld" provided with the samples.
The source code for the JSP is as follows:
<%@page import="com.oracle.bpel.client.Locator" %>
<%@page import="com.oracle.bpel.client.NormalizedMessage" %>
<%@page import="com.oracle.bpel.client.delivery.IDeliveryService" %>
<%@page import="java.util.Hashtable" %>
<%@page import="javax.naming.Context" %>
<%@page import="java.util.Map" %>
<%@page import="org.w3c.dom.Element" %>
<html>
<head>
<title>Invoke HelloWorld</title>
</head>
<body>
<%
Hashtable jndi = null;
jndi = new Hashtable();
jndi.put(Context.PROVIDER_URL, "opmn:ormi://BTP6ND09:6003:home/orabpel");
jndi.put(Context.INITIAL_CONTEXT_FACTORY,"com.evermind.server.rmi.RMIInitialContextFactory");
jndi.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
jndi.put(Context.SECURITY_CREDENTIALS, "welcome1");
jndi.put("dedicated.connection", "true");
jndi.put("dedicated.rmicontext","true");
String name = request.getParameter("name");
if(name == null)
name = "BPEL";
String xml = "<name xmlns=\"http://btp6nd09:8888/BPELConsole/default/HelloWorld\">" + name + "</name>";
Locator locator = new Locator("default","bpel",jndi);
IDeliveryService deliveryService = (IDeliveryService)locator.lookupService(IDeliveryService.SERVICE_NAME );
NormalizedMessage nm = new NormalizedMessage( );
nm.addPart("payload" , xml );
deliveryService.post("HelloWorld", "initiate", nm);
out.println( "BPELProcess HelloWorld initiated!" );
%>
Please refer to the
BPEL Console
to see the status of the initiated HelloWorld BPEL Process.
</body>
</html>Since the input goes as an xml to the Receive activity, i am not knowing how to extract the "name" element from it in the assign activity. Which "BPEL XPath Extension Function" should i use to extract the same?
Message was edited by:
user578981
Message was edited by:
user578981Hi,
can you please format your input?
Otherwise, no one will look into your question or problem.... ;-) -
Can't get UTF-8 characters from XML file displayed correctly (Cocoa Touch)
Hi there,
I'm trying to read an XML file with Japanese and Korean characters (encoded UTF-8) into a String like
NSString *s = [[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://.../data1.xml"] encoding:NSUTF8StringEncoding error:&e];
However, the output just gives me some wrong characters. I also tried use NSData, but the result was the same.
The same when I parse the XML file with
NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:URL];
The parser function just gives back gibberish.
When I write the data into a table cell (cell.text = ...), only the first character is displayed followed by "...".
Where can I start looking to get this right? I'm not so experienced in Cocoa yet, so I feel that I'm missing something simple here...
Thanks,
ThomasI think so (haven't checked), but it is a really simple test xml which is not really error prone).
But the problem is a different one, because I also just tried to read a txt file with some Japanese characters into an NSString using initWithContentsOfURL.
When I print the string in the console, I only get messed up characters (the latin characters next to the Japanese are displayed fine).
It is a general problem of reading out an UTF-8 file from an url.
Spent the whole last night to google something helpful but couldn't find anything. Now I'm tired at work
Thomas
Maybe you are looking for
-
Video camera no longer showing up
Have a Panisonic DV cam that was working ok on my G5 1.8GHz. Can't remember exactly when it stopped working, before or after Leopard install. System Profiler correctly identifies the camera as a FW device when it's plugged in. Also have a Mac Mini ru
-
Please help me on following Queries!! (Activities, Web-IC)
Hi CRM Experts, Please help me on following queries. 1)Can we create multiple follow-up activities for given activity by using action profile? 2)What is the differance between ERP Sale Order and ECC Sales Order in Web-IC? 3)Is there any relationship
-
Planning File entry is missing
Hi Friends, I have issues of planning file missing for material from Sales Order. We are using Reorder point planning(ZM) and new Item Category YP19 and No Production involved. I have followign questions. 1. Is Strategy make to order is to be defined
-
2 issues - Invalid Serial Number issue & Lightroom 5 Trial vs full version folder hierarchy question
Hello not sure if I should split these two questions... 1 - Invalid Serial Number issue I'm helping out a friend with their large photo collection and they bought Lightroom 5 and received the serial number but when we add this to Lightroom it states
-
What is it that resets the Music Location when iTunes starts?
So whenever you have your Music Location set to a mount on a remote device. Such as a share on a Time Capsule for instance if the mount isn't present when iTunes starts iTunes will always reset the Music Location back to it's default. Is there a way