Re: [Fwd: TooManyElements Exception]

View: New views
1 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: [Fwd: TooManyElements Exception]

by Kiran Bhumana-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Nigel,
 You should post these questions in nbentpack@... (Cced) alias. So others will know as well and others could suggest as well.
There must be NB tutorials, If you couldn't find , please comment on the same on nbentpack@... alias. For now you can use this blog entry,
http://blogs.sun.com/kiransden/ (BPEL Variable creation).

-Kiran.

Nigel wrote:
Hi Kiran,

Please unzip my bpel and load into netbeans.  You will see that I have an
external wsdl's complex type (HelloWordlResult-Class1) which maps to a Java
wsdl's complex type (result-Class1).  I get a return of the correct amount
when I run the process.  

What I want to achieve is to copy the elements of these complex types
(HelloWorldOut to NigOperationOut).  I get a toomanyelements exception if I
map each element to the output elements.  I thought I would need a loop.

I can drag a while loop over to the bpel process.  How do I define new
variables to hold the counters?

Thanks for your support with this.

Regards

Nigel

-----Original Message-----
From: Kiran.Bhumana@... [Kiran.Bhumana@...] 
Sent: 26 February 2008 19:42
To: Jun Xu
Cc: Nigel; Gabriel Badescu
Subject: Re: [Fwd: [entpack] TooManyElements Exception]

Sorry, I thought he was talking about the selection failure mentioned 
somewhere in the thread.

Nigel,
 There are few ways to loop through your xml nodes.

1. within BPEL, using xpath predicate expression.
    a. you can use while, repeatUntil, or for-each.
       a.1. I will explain for while, Define a variable of type xsd:int, 
called counter. Define a variable of type xsd:int, called totalNodes. 
You can use the condition in while ($counter < $totalNodes). Have two 
assigns inside the while, First assign will have
    From => /yourVariable/someNode/interestedFromNode[$counter]  
    To    => /yourVariable/someNode/interestedToNode[$counter]  
   In the second assign, increment the $counter.

2. withinBPEL using the xslt transform. If you are familiar with xslt 
syntax. This link 
http://wiki.open-esb.java.net/Wiki.jsp?page=DoXSLTransform , should help 
you in doing that.

let us know if you need more help,

-Kiran.

Jun Xu wrote:
  
Hi Kiran,

Nigel just wants someone to help him write a while loop or a foreach 
loop in BPEL.  Why do you consider this as a bug?

Regards,
Jun

Sun's Open ESB Community (http://open-esb.org)



Kiran Bhumana wrote:
    
I would like to.

Gabe,
Do you want me to look at this? How do we want to help the user? Ask 
him to file a bug?

thanks,
-Kiran.


Jun Xu wrote:
      
Hi Kiran,

Could you help Nigel on this?

Thanks.
Jun

Nigel wrote:
        
Hi Jun,

Thanks for your continued support.  I feel I am getting there.

I mapped the Class1 element to the corresponding Class1 element, which
returned the right amount of counts of Class1.  I guess I need to do a
foreach loop to copy each element in the class to my Reply out 
variable.  I
don't know how to do this.  Can you help?

Thanks

Nigel

-----Original Message-----
From: J.Xu@... [J.Xu@...] Sent: 24 February 2008 17:48
To: Nigel; bpelengine-dev
Subject: Re: [Fwd: [entpack] TooManyElements Exception]


Hi Nigel,

How many {http://xml.netbeans.org/schema/nig}name element(s) 
is(are) there in the response message?  Based on the XSD you 
provided, at most there can only be one for each Class1 element.  
TooManyElementsException will be thrown if in an XML message, more 
elements are found than what is allowed by its XSD.  I don't have 
.Net installation, neither do I have your database.  But here is my 
best guess:

Maybe in the response message, there are multiple Class1 elements, 
as below:

<Class1 xmlns="http://xml.netbeans.org/schema/nig">
    <name>class one</name>
    <price>1111</price>
    <height>11</height>
    <approved>true</approved>
</Class1>
<Class1 xmlns="http://xml.netbeans.org/schema/nig">
    <name>class two</name>
    <price>2222</price>
    <height>22</height>
    <approved>false</approved>
</Class1>

I looked at your BPEL and it looks like that you are not using 
'while' loop (or any other loops) to do data copy.  You are 
selecting leaf nodes directly using XPath.  This way, after the 
assignment block is executed, the content of 
$NigOperationOut1.part1 may look like following:

<Class1 xmlns="http://xml.netbeans.org/schema/nig">
    <name>class one</name>
    <name>class two</name>
    <price>1111</price>
    <price>2222</price>
    <height>11</height>
    <height>22</height>
    <approved>true</approved>
    <approved>false</approved>
</Class1>

This is not a valid document based on its XSD.  You may use some 
loops to resolve this problem.  Or maybe just map at Class1 element 
level and not going into leaf node level.

Regards,
Jun

Sun's Open ESB Community (http://open-esb.org)


Nigel wrote:
 
          
Hi Jun,

You were absolutely right.  I have got my HelloWorld wsdl working, 
however
    
            
I
 
          
now get a "toomanyelements" exception (error.txt).  I would be 
grateful
    
            
for
 
          
any advice.

Regards

Nigel

-----Original Message-----
From: J.Xu@... [J.Xu@...] Sent: 23 February 2008 15:22
To: Nigel
Cc: bpelengine-dev
Subject: Re: [Fwd: [entpack] TooManyElements Exception]


Hi,

By looking at the error.txt, it seems to be that a system level 
SelectionFailure fault occurred first and then while processing 
this system level fault, a NullPointerException was thrown from 
the debugger code.  A SelectionFailure usually occurs when in BPEL 
Assign block one of the copy/from XPaths didn't hit any elements.  
Basically the selection is empty.  Probably you need to double 
check the $HelloWorldOut message to see if all the expected 
elements are actually there.

CC'ing bpelengine-dev so BPEL folks can give more insights.

Regards,
Jun

      
            
  
          

  

-- 
Kiran Bhumana
Open ESB Community (http://open-esb.org)
LightInTheBox - Buy quality products at wholesale price