1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
27 |
27 |
28 import com.sun.istack.internal.NotNull; |
28 import com.sun.istack.internal.NotNull; |
29 import com.sun.istack.internal.Nullable; |
29 import com.sun.istack.internal.Nullable; |
30 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; |
30 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; |
31 import com.sun.xml.internal.ws.api.model.SEIModel; |
31 import com.sun.xml.internal.ws.api.model.SEIModel; |
|
32 import com.sun.xml.internal.ws.api.model.WSDLOperationMapping; |
32 import com.sun.xml.internal.ws.api.WSBinding; |
33 import com.sun.xml.internal.ws.api.WSBinding; |
33 import com.sun.xml.internal.ws.api.message.Packet; |
34 import com.sun.xml.internal.ws.api.message.Packet; |
34 import com.sun.xml.internal.ws.api.message.Message; |
35 import com.sun.xml.internal.ws.api.message.Message; |
35 import com.sun.xml.internal.ws.resources.ServerMessages; |
36 import com.sun.xml.internal.ws.resources.ServerMessages; |
36 import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; |
37 import com.sun.xml.internal.ws.fault.SOAPFaultBuilder; |
63 opFinders.add(new SOAPActionBasedOperationFinder(wsdlModel, binding, seiModel)); |
64 opFinders.add(new SOAPActionBasedOperationFinder(wsdlModel, binding, seiModel)); |
64 |
65 |
65 } |
66 } |
66 |
67 |
67 /** |
68 /** |
68 * |
69 * @deprecated use getWSDLOperationMapping(Packet request) |
69 * @param request Packet |
70 * @param request Packet |
70 * @return QName of the wsdl operation. |
71 * @return QName of the wsdl operation. |
71 * @throws DispatchException if a unique operartion cannot be associated with this packet. |
72 * @throws DispatchException if a unique operartion cannot be associated with this packet. |
72 */ |
73 */ |
73 public @NotNull QName getWSDLOperationQName(Packet request) throws DispatchException { |
74 public @NotNull QName getWSDLOperationQName(Packet request) throws DispatchException { |
74 QName opName; |
75 WSDLOperationMapping m = getWSDLOperationMapping(request); |
|
76 return m != null ? m.getOperationName() : null; |
|
77 } |
|
78 |
|
79 public @NotNull WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException { |
|
80 WSDLOperationMapping opName; |
75 for(WSDLOperationFinder finder: opFinders) { |
81 for(WSDLOperationFinder finder: opFinders) { |
76 opName = finder.getWSDLOperationQName(request); |
82 opName = finder.getWSDLOperationMapping(request); |
77 if(opName != null) |
83 if(opName != null) |
78 return opName; |
84 return opName; |
79 } |
85 } |
80 //No way to dispatch this request |
86 //No way to dispatch this request |
81 String err = MessageFormat.format("Request=[SOAPAction={0},Payload='{'{1}'}'{2}]", |
87 String err = MessageFormat.format("Request=[SOAPAction={0},Payload='{'{1}'}'{2}]", |
83 request.getMessage().getPayloadLocalPart()); |
89 request.getMessage().getPayloadLocalPart()); |
84 String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(err); |
90 String faultString = ServerMessages.DISPATCH_CANNOT_FIND_METHOD(err); |
85 Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage( |
91 Message faultMsg = SOAPFaultBuilder.createSOAPFaultMessage( |
86 binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient); |
92 binding.getSOAPVersion(), faultString, binding.getSOAPVersion().faultCodeClient); |
87 throw new DispatchException(faultMsg); |
93 throw new DispatchException(faultMsg); |
88 |
|
89 } |
94 } |
90 } |
95 } |