Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How can we convert soap wrapped xml to simple xml?

843834Oct 11 2007 — edited Oct 11 2007
I am getting a soap wrapped xml as payload to JMS in JMS queue and need to convert that into a simple xml. Can anyone please suggest how this can be done? I am adding the xml as an attachment.

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:header="http://wsi.nat.bt.com/2005/06/StandardHeader/">
<SOAP-ENV:Body>
<setupXMLDataAcquisitionRequest xmlns="http://capabilities.nat.bt.com/xsd/ManageMISDataAcquisition/2007/06/30" xmlns:S18="http://capabilities.nat.bt.com/xsd/ManageMISDataAcquisition/2007/06/30/CCM/Activities" xmlns:S70="http://capabilities.nat.bt.com/xsd/ManageMISDataAcquisition/2007/06/30/CCM/Events" xmlns:S78="http://capabilities.nat.bt.com/xsd/ManageMISDataAcquisition/2007/06/30/CCM/Incidents" xsi:schemaLocation="http://capabilities.nat.bt.com/xsd/ManageMISDataAcquisition/2007/06/30
D:\Jay_137788\OffshoreCode\WSDLandXSD\WSDLandXSD\ManageMISDataAcquisition.20070630.xsd">
<header:standardHeader>
<header:e2e>
<header:E2EDATA>e2EData</header:E2EDATA>
</header:e2e>
<header:serviceState>
<header:stateCode>OK</header:stateCode>
</header:serviceState>
<header:serviceAddressing>
<header:from>http://ccm.intra.bt.com/neo</header:from>
<header:to>
<header:address>http://ccm.intra.bt.com/orbit</header:address>
<header:contextItemList>
<header:contextItem contextId="http://ccm.intra.bt.neo" contextName="serviceType">WLR</header:contextItem>
</header:contextItemList>
</header:to>
<header:messageId>http://ccm.intra.bt.com/neo/manageMISDataAcquasition/EC9DB800-5C5F-11DC-AECA-E60BE61DBC5B</header:messageId>
<header:serviceName>http://ccm.intra.bt.com/manageMISDataAcquasition</header:serviceName>
<header:action>http://ccm.intra.bt.com/manageMISDataAcquasition/2007/08#problemMISEventNotification</header:action>
</header:serviceAddressing>
<header:serviceSpecification>
<header:payloadFormat>XML</header:payloadFormat>
<header:version>1.0</header:version>
</header:serviceSpecification>
</header:standardHeader>
<activity>
<S18:Event>
<S70:id>KPI.SA.dispatchActionItem</S70:id>
<S70:eventDateTime>2007-09-06T15:29:56</S70:eventDateTime>
</S18:Event>
<S18:activityId>000000109</S18:activityId>
<S18:activityType>WFT</S18:activityType>
<S18:activityCode>BBHC5</S18:activityCode>
<S18:activityStatus>Not Started</S18:activityStatus>
<S18:activityCondition>Not Started-Dispatch</S18:activityCondition>
<S18:activityDateCreated>2007-09-06T16:30:36</S18:activityDateCreated>
<S18:activityDateCompleted>1753-01-01T00:00:00</S18:activityDateCompleted>
<S18:activityQueueID>ASG</S18:activityQueueID>
<S18:activityNote>
<S18:comment>Customer Apparatus SFI for BBHC5</S18:comment>
</S18:activityNote>
<S18:activityOwner>sa</S18:activityOwner>
<S18:activityAccessURL />
<S18:faultIdentifier>
<S78:name>faultId</S78:name>
<S78:value>NeoSAC00000041</S78:value>
</S18:faultIdentifier>
<S18:activityRelatedTo>Action Request</S18:activityRelatedTo>
</activity>
</setupXMLDataAcquisitionRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Comments

Jonathan Lewis

I'm puzzled that the no_merge hint is not working for you - perhaps it's (yet another) side effect of how Oracle treats ANSI syntax.

Step 1: put the no_merge where you've got the MATERIALIZE in your WITH TEMP_TAB example - this should put the factored subquery inline and then optimize it exactly the way you want.  (There have been cases in the past, though, where "manually inlining" a factored subquery produces a different plan from writing the subquery as a factored subquery and letting the optimizer decide to put it inline).

Can you try it both ways - simply hinting no_merge (and INLINE, if it doesn't move, which it should), and then copy the bracketed query in into place with the alias temp_tab, and tell us if you get two different plans.

Regards

Jonathan Lewis

Jonathan Lewis

On second thoughts - the no_merge() hint is about complex view merging, and this is an example of "simple view merging".

But it can't be stopped either by setting _simple_view_merging to false, or by hinting NO_QUERY_TRANSFORMATION

Regards

Jonathan Lewis

David Berger

Hello Jonathan

I tried the followings:

1.)

WITH TEMP_TAB

AS (SELECT /*+ NO_MERGE */

           n_finanzprodnummer

         , fpr_finanzprodnummer

         , ...

      FROM .....

   )

SELECT COUNT(*)

  FROM TEMP_TAB

WHERE n_finanzprodnummer = fpr_finanzprodnummer

;

Result is the same bad plan -> Here happens a Filter-Push down again.

2.)

SELECT COUNT(*)

  FROM (SELECT /*+ NO_MERGE */

               n_finanzprodnummer

             , fpr_finanzprodnummer

              , ...

          FROM .....

       )

WHERE n_finanzprodnummer = fpr_finanzprodnummer

;

Result is the same bad plan...

Jonathan Lewis

Reading through a 10053 trace, I found that the "problem" feature was "simple filter predicate pushdown".

So I set parameter "_optimizer_filter_pushdown" to false and (at least in my simple join example) bypassed your problem. It still needed the no_merge() hint to "surround" the inline view where you didn't want the predicate to go. Rather than doing "alter session" to set the parameter, you could use the hint:  /*+ opt_param('_optimizer_filter_pushdown','false') */ but this is not one of the parameters listed as working with the hint, and the hint won't get reflected into the outline.


Regards

Jonathan Lewis


Randolf Geist

Jonathan,

I think the "_optimizer_filter_pushdown" parameter is pretty new and was only added in 11.2.0.2 or 11.2.0.3, I can't remember off the top of my head. The potential problem is that it prevents any filter pushdowns I think, so if there are multiple query blocks where some should push filters and some don't I'm not sure this would be feasible with that parameter.

To the OP: I think one commonly used technique to prevent a filter pushdown is adding the ROWNUM pseudo-column (or a similar analytic function ROW_NUMBER() OVER (ORDER BY NULL)) to the query block where the filter shouldn't be pushed into.

Of course, adding ROWNUM adds its own overhead to the query (there will be an additional COUNT operator) and can have other side effects, some of them rather nasty when dealing with Parallel Execution.

Apart from that it usually makes sense to filter the data as early as possible, so possibly the filter pushdown itself is not the problem but as a side effect of the pushdown you get a less efficient execution plan, so it might make sense to understand what possibly goes wrong with the plan when the filter is pushed.

Randolf

David Berger

Hello Jonathan

Super! Your solution works!

SELECT /*+ opt_param('_optimizer_filter_pushdown','false') */

       COUNT(*)

  FROM (SELECT /*+ NO_MERGE */

               n_finanzprodnummer

             , fpr_finanzprodnummer

              , ...

          FROM .....

       )

WHERE n_finanzprodnummer = fpr_finanzprodnummer

;

Thank you and regards,

David

David Berger

Hello Randolf

Yes. You are right, in this case the optimizer hint operates on the whole query.

I tried your solution and it works too!

SELECT COUNT(*)

  FROM (SELECT /*+ NO_MERGE */

               n_finanzprodnummer

             , fpr_finanzprodnummer

              , ...

          FROM .....

          WHERE ...

           AND ROWNUM >= 0

       )

WHERE n_finanzprodnummer = fpr_finanzprodnummer

;

Thank you very much!

-> In this case the solution is the preventing of using the filter push-down. Reason: There are Views in the joins which have DB-links and the cost is not estimated good because of the remote objects.

This query is very complicated.

But anyway, I have learnt something again! Thank You all!

Regards, David

Randolf Geist

DavidBerger wrote:

Hello Randolf

Yes. You are right, in this case the optimizer hint operates on the whole query.

I tried your solution and it works too!

Hi David,

actually you don't need to reference ROWNUM in the WHERE clause, it should be sufficient to add ROWNUM to the list of projected columns. This should minimize the overhead - of course you might need to add then another layer of projection if you don't want to have that ROWNUM information shown in the result set.

Testing a query's performance by using COUNT(*) can be quite misleading, by the way, since the optimizer tries to be clever and avoid any work that's unnecessary. In your particular case it might not make a difference, but in general I would use a different technique, either SET AUTOTRACE TRACEONLY STATISTICS in SQL*Plus or wrapping the original query like this:

SELECT /*+ NO_MERGE(x) */ * FROM (

original query goes here

) x

WHERE ROWNUM > 1

;

The SQL*Plus approach needs to fetch all data to the client but doesn't spend any time in displaying/formatting it, the latter approach discards all data on the database server already, but needs to run the full projection logic due to the NO_MERGE hint. For very large data sets with many rows the FILTER operator that discards all rows on the server side can consume significant CPU time, but for smaller result sets this gives a pretty good and realistic indication of the actual runtime.

Randolf

Randolf Geist

DavidBerger wrote:

Hello Randolf

Yes. You are right, in this case the optimizer hint operates on the whole query.

I tried your solution and it works too!

One other thing: When using ROWNUM in current releases you don't need to add an explicit NO_MERGE hint as the query block is marked as non-mergeable due to the ROWNUM anyway, but it probably makes sense to use an explicit NO_MERGE hint nevertheless to make the intention clear and add another comment to the SQL stating why this all was done.

Randolf

David Berger

Hello Randolf

Ok. Thank you very much for your suggestions! They are really good!

Jonathan Lewis

DavidBerger wrote:

Hello Jonathan

Super! Your solution works!

SELECT /*+ opt_param('_optimizer_filter_pushdown','false') */

       COUNT(*)

  FROM (SELECT /*+ NO_MERGE */

               n_finanzprodnummer

             , fpr_finanzprodnummer

              , ...

          FROM .....

       )

WHERE n_finanzprodnummer = fpr_finanzprodnummer

;

Thank you and regards,

David

David,

As Randolf suggests, though, I shouldn't really have mentioned it - but I got a bit curious and decided to see if I could find a method when I realised that the no_merge wasn't supposed to work.

As Randolf also indicates - there's bound to be a way of getting the data faster while having the predicate operating earlier - but there's probably an optimizer "glitch" that's causing a change of plan because an early appearance of that predicate reduces the cardinality of some join to a point where a change of join order or method looks good.  ANSI SQL is much harder to unpick when this happens, though, so the rownum trick is a reasonable compromise between complexity and efficiency.


Regards

Jonathan Lewis

David Berger

Thank You Jonathan very much!

Jonathan Lewis

Randolf Geist wrote:

Jonathan,

I think the "_optimizer_filter_pushdown" parameter is pretty new and was only added in 11.2.0.2 or 11.2.0.3, I can't remember off the top of my head. The potential problem is that it prevents any filter pushdowns I think, so if there are multiple query blocks where some should push filters and some don't I'm not sure this would be feasible with that parameter.

To the OP: I think one commonly used technique to prevent a filter pushdown is adding the ROWNUM pseudo-column (or a similar analytic function ROW_NUMBER() OVER (ORDER BY NULL)) to the query block where the filter shouldn't be pushed into.

Of course, adding ROWNUM adds its own overhead to the query (there will be an additional COUNT operator) and can have other side effects, some of them rather nasty when dealing with Parallel Execution.

Apart from that it usually makes sense to filter the data as early as possible, so possibly the filter pushdown itself is not the problem but as a side effect of the pushdown you get a less efficient execution plan, so it might make sense to understand what possibly goes wrong with the plan when the filter is pushed.

Randolf

Randolf,

I just did a quick check on lists of parameters, and you're right; this one appeared very recently - 11.2.0.3

And you're also right that the OP shouldn't really make use of it.

Regards

Jonathan Lewis

1 - 13
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 8 2007
Added on Oct 11 2007
6 comments
482 views