Skip to content

Commit 2f6a23a

Browse files
committed
add resource bundle for messages
1 parent 9e9fb8b commit 2f6a23a

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MyFault-001=Department {0} not found
2+
MyFault-999=Unknown error occured
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package nl.amis.ws.test;
2+
3+
import java.util.Locale;
4+
import java.util.ResourceBundle;
5+
6+
import javax.xml.rpc.soap.SOAPFaultException;
7+
import javax.xml.ws.WebServiceException;
8+
import javax.xml.ws.WebServiceRef;
9+
10+
import nl.amis.ws.client.BusinessFaultMessage;
11+
import nl.amis.ws.client.FrontMediator_ep;
12+
import nl.amis.ws.client.Front_ptt;
13+
import nl.amis.ws.types.Departments;
14+
import nl.amis.ws.types.InputDepartmentType;
15+
import nl.amis.ws.types.ObjectFactory;
16+
17+
import oracle.adf.share.logging.ADFLogger;
18+
import oracle.jbo.JboException;
19+
import oracle.jbo.common.ResourceBundleDef;
20+
21+
public class TestWS {
22+
public TestWS() {
23+
}
24+
25+
private static ADFLogger logger = ADFLogger.createADFLogger(TestWS.class);
26+
27+
@WebServiceRef
28+
private static FrontMediator_ep frontMediator_ep;
29+
30+
private static ResourceBundle messages =
31+
ResourceBundle.getBundle("nl.amis.ws.bundle.ClientBundle",Locale.getDefault());
32+
33+
public static void main(String [] args) {
34+
35+
36+
frontMediator_ep = new FrontMediator_ep();
37+
Front_ptt front_ptt = frontMediator_ep.getFront_pt();
38+
ObjectFactory obj = new ObjectFactory();
39+
InputDepartmentType input = obj.createInputDepartmentType();
40+
Integer department = 101;
41+
input.setDepartmentId(department);
42+
try {
43+
Departments dep = front_ptt.validateDepartment(input);
44+
logger.log(ADFLogger.NOTIFICATION,"Department =" + dep.getDepartmentId());
45+
} catch (BusinessFaultMessage e) {
46+
logger.warning("got a business fault: " +
47+
e.getFaultInfo().getFaultCode() +
48+
" message: "+
49+
e.getFaultInfo().getFaultDesciption());
50+
throw new JboException( messages.getString( e.getFaultInfo().getFaultCode()),
51+
e.getFaultInfo().getFaultCode(),
52+
new String[] { department.toString() });
53+
} catch (SOAPFaultException e) {
54+
logger.severe("got soap fault: "+ e.getMessage());
55+
throw new JboException( messages.getString("MyFault-999"),
56+
"MyFault-999",
57+
null);
58+
} catch (WebServiceException e) {
59+
logger.severe("got web service fault: "+ e.getMessage());
60+
throw new JboException( messages.getString("MyFault-999"),
61+
"MyFault-999",
62+
null );
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)