FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

How To Handle SQL Select Return 0?

 
Post new topic   Reply to topic    NetBeans Forums -> SOA Users
View previous topic :: View next topic  
Author Message
hksduhksdu



Joined: 23 Sep 2008
Posts: 5

PostPosted: Fri Oct 23, 2009 3:54 pm    Post subject: How To Handle SQL Select Return 0? Reply with quote

Hi all,

I created a simple Database binding attached to BPEL. The public WSDL is to get all records from this database through Database binding module. The select statement is default.

It works when there are records but when there are no records, it shows exception as follow:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/ http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP-ENV:Body>
    <SOAP-ENV:Fault>
      <faultcode xmlns="">SOAP-ENV:Server</faultcode>
      <faultstring xmlns="">BPCOR-6135: A fault was not handled in the process scope; Fault Name is {http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure; Fault Data is &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;lt;jbi:message xmlns:sxeh=&amp;quot;http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling&amp;quot; type=&amp;quot;sxeh:faultMessage&amp;quot; version=&amp;quot;1.0&amp;quot; xmlns:jbi=&amp;quot;http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper&amp;quot;&amp;gt;&amp;lt;jbi:part&amp;gt;BPCOR-6174: Selection Failure occurred in BPEL({http://enterprise.netbeans.org/bpel/CareerManagement/AccountService}FindAccountById) at line 44&amp;lt;/jbi:part&amp;gt;&amp;lt;/jbi:message&amp;gt;. Sending errors for the pending requests in the process scope before terminating the process instance</faultstring>
      <faultactor xmlns="">sun-bpel-engine</faultactor>
      <detail xmlns="">
        <detailText>BPCOR-6135: A fault was not handled in the process scope; Fault Name is {http://docs.oasis-open.org/wsbpel/2.0/process/executable}selectionFailure; Fault Data is &amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&amp;lt;jbi:message xmlns:sxeh=&amp;quot;http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling&amp;quot; type=&amp;quot;sxeh:faultMessage&amp;quot; version=&amp;quot;1.0&amp;quot; xmlns:jbi=&amp;quot;http://java.sun.com/xml/ns/jbi/wsdl-11-wrapper&amp;quot;&amp;gt;&amp;lt;jbi:part&amp;gt;BPCOR-6174: Selection Failure occurred in BPEL({http://enterprise.netbeans.org/bpel/CareerManagement/AccountService}FindAccountById) at line 44&amp;lt;/jbi:part&amp;gt;&amp;lt;/jbi:message&amp;gt;. Sending errors for the pending requests in the process scope before terminating the process instance
   Caused by: BPCOR-6174: Selection Failure occurred in BPEL({http://enterprise.netbeans.org/bpel/CareerManagement/AccountService}FindAccountById) at line 44
BPCOR-6129: Line Number is 38
BPCOR-6130: Activity Name is Assign2</detailText>
      </detail>
    </SOAP-ENV:Fault>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Any clue?

Thanks in advance,

Andy
Back to top
View user's profile Send private message
bako



Joined: 11 Sep 2009
Posts: 10
Location: Italy

PostPosted: Sat Oct 24, 2009 1:00 pm    Post subject: Reply with quote

how is your code that extracts the record?
is a method that throws exception or u put a try catch statement.

the fault looks like a throws without a fault in the wsdl

so u can simply use the try catch in the code, when there's an exception u can return what u want in ur method.
Back to top
View user's profile Send private message
hksduhksdu



Joined: 23 Sep 2008
Posts: 5

PostPosted: Thu Oct 29, 2009 4:46 am    Post subject: Reply with quote

bako wrote:
how is your code that extracts the record?
is a method that throws exception or u put a try catch statement.

the fault looks like a throws without a fault in the wsdl

so u can simply use the try catch in the code, when there's an exception u can return what u want in ur method.


Thanks for your reply.

I wonder why it is a fault though. Isn't SQL select statement returning 0 query is a normal return?
Back to top
View user's profile Send private message
bako



Joined: 11 Sep 2009
Posts: 10
Location: Italy

PostPosted: Thu Oct 29, 2009 9:02 am    Post subject: Reply with quote

hksduhksdu wrote:
bako wrote:
how is your code that extracts the record?
is a method that throws exception or u put a try catch statement.

the fault looks like a throws without a fault in the wsdl

so u can simply use the try catch in the code, when there's an exception u can return what u want in ur method.


Thanks for your reply.

I wonder why it is a fault though. Isn't SQL select statement returning 0 query is a normal return?


maybe the sql returns 0 rows, and the bpel tries to extract data, but the dataset is empty.
i'm not sure about that, look at the row 44 or 38 of the bpel what is it.
Back to top
View user's profile Send private message
hksduhksdu



Joined: 23 Sep 2008
Posts: 5

PostPosted: Thu Nov 05, 2009 5:46 am    Post subject: How to handle fault? Reply with quote

Thanks for your reply.

I find that it's okay to have fault there since it's coming from assigning uninitialized values to the reply.

But I can't find any good tutorial that shows me how to use fault properly. I find that the GlassfishESB documentation is not very informative. I have no idea how to properly handle fault.

Also normally when you retrieve information from DB, it may return 0 result. In many web services, it will return an empty Set/Collection, how do you do that in NetBeans' SOA?

Thanks in advance.

Andy
Back to top
View user's profile Send private message
bako



Joined: 11 Sep 2009
Posts: 10
Location: Italy

PostPosted: Thu Nov 05, 2009 7:55 am    Post subject: Re: How to handle fault? Reply with quote

hksduhksdu wrote:

Also normally when you retrieve information from DB, it may return 0 result. In many web services, it will return an empty Set/Collection, how do you do that in NetBeans' SOA?

i don't really know, i'm not so expert, you might try using an if or using the trhow excpetion.
http://www.netbeans.org/kb/61/soa/bpel-guide-elements.html#ggbyc
Back to top
View user's profile Send private message
hksduhksdu



Joined: 23 Sep 2008
Posts: 5

PostPosted: Fri Nov 13, 2009 4:52 pm    Post subject: Re: How to handle fault? Reply with quote

bako wrote:
hksduhksdu wrote:

Also normally when you retrieve information from DB, it may return 0 result. In many web services, it will return an empty Set/Collection, how do you do that in NetBeans' SOA?

i don't really know, i'm not so expert, you might try using an if or using the trhow excpetion.
http://www.netbeans.org/kb/61/soa/bpel-guide-elements.html#ggbyc


Thank you.

I think I got the answer now. It's from the NetBeans SOA book. The example shows it but then I haven't got it working, once I have any update, I will post back.

Thanks again. Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> SOA Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB