1 package org.codehaus.xfire.service.binding;
2
3 import org.codehaus.xfire.soap.SoapConstants;
4
5 /***
6 * Create a MessageReaders and MessageWriters for a ObjectService.
7 *
8 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
9 * @since Apr 7, 2004
10 */
11 public class ObjectBindingFactory
12 {
13 public static ObjectBinding getMessageBinding(String style, String use)
14 {
15 if (style.equals(SoapConstants.STYLE_WRAPPED)
16 && use.equals(SoapConstants.USE_LITERAL))
17 {
18 return new WrappedBinding();
19 }
20 else if (style.equals(SoapConstants.STYLE_DOCUMENT)
21 && use.equals(SoapConstants.USE_LITERAL))
22 {
23 return new DocumentBinding();
24 }
25 else if (style.equals(SoapConstants.STYLE_RPC)
26 && use.equals(SoapConstants.USE_ENCODED))
27 {
28 return new RPCEncodedBinding();
29 }
30 else if (style.equals(SoapConstants.STYLE_MESSAGE)
31 && use.equals(SoapConstants.USE_LITERAL))
32 {
33 return new MessageBinding();
34 }
35 else
36 {
37 throw new UnsupportedOperationException( "Service style/use not supported." );
38 }
39 }
40 }