src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/SOAPActionBasedOperationFinder.java

changeset 368
0989ad8c0860
parent 286
f50545b5e2f1
child 637
9c07ef4934dd
equal deleted inserted replaced
366:8c0b6bccfe47 368:0989ad8c0860
1 /* 1 /*
2 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2007, 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.Nullable; 28 import com.sun.istack.internal.Nullable;
29 import com.sun.xml.internal.ws.api.WSBinding; 29 import com.sun.xml.internal.ws.api.WSBinding;
30 import com.sun.xml.internal.ws.api.model.JavaMethod; 30 import com.sun.xml.internal.ws.api.model.JavaMethod;
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.model.wsdl.WSDLPort; 33 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
33 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation; 34 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
34 import com.sun.xml.internal.ws.api.message.Packet; 35 import com.sun.xml.internal.ws.api.message.Packet;
35 import com.sun.xml.internal.ws.model.AbstractSEIModelImpl; 36 import com.sun.xml.internal.ws.model.AbstractSEIModelImpl;
36 import com.sun.xml.internal.ws.model.JavaMethodImpl; 37 import com.sun.xml.internal.ws.model.JavaMethodImpl;
47 * request {@link com.sun.xml.internal.ws.api.message.Packet} is used as the key to identify the associated wsdl operation. 48 * request {@link com.sun.xml.internal.ws.api.message.Packet} is used as the key to identify the associated wsdl operation.
48 * 49 *
49 * @author Jitendra Kotamraju 50 * @author Jitendra Kotamraju
50 */ 51 */
51 final class SOAPActionBasedOperationFinder extends WSDLOperationFinder { 52 final class SOAPActionBasedOperationFinder extends WSDLOperationFinder {
52 private final Map<String, QName> methodHandlers; 53 private final Map<String, WSDLOperationMapping> methodHandlers;
53 54
54 public SOAPActionBasedOperationFinder(WSDLPort wsdlModel, WSBinding binding, @Nullable SEIModel seiModel) { 55 public SOAPActionBasedOperationFinder(WSDLPort wsdlModel, WSBinding binding, @Nullable SEIModel seiModel) {
55 super(wsdlModel,binding,seiModel); 56 super(wsdlModel,binding,seiModel);
56 methodHandlers = new HashMap<String, QName>(); 57 methodHandlers = new HashMap<String, WSDLOperationMapping>();
57 58
58 // Find if any SOAPAction repeat for operations 59 // Find if any SOAPAction repeat for operations
59 Map<String, Integer> unique = new HashMap<String, Integer>(); 60 Map<String, Integer> unique = new HashMap<String, Integer>();
60 if (seiModel != null) { 61 if (seiModel != null) {
61 for (JavaMethodImpl m : ((AbstractSEIModelImpl) seiModel).getJavaMethods()) { 62 for (JavaMethodImpl m : ((AbstractSEIModelImpl) seiModel).getJavaMethods()) {
71 for (JavaMethodImpl m : ((AbstractSEIModelImpl) seiModel).getJavaMethods()) { 72 for (JavaMethodImpl m : ((AbstractSEIModelImpl) seiModel).getJavaMethods()) {
72 String soapAction = m.getSOAPAction(); 73 String soapAction = m.getSOAPAction();
73 // Set up method handlers only for unique SOAPAction values so 74 // Set up method handlers only for unique SOAPAction values so
74 // that dispatching happens consistently for a method 75 // that dispatching happens consistently for a method
75 if (unique.get(soapAction) == 1) { 76 if (unique.get(soapAction) == 1) {
76 methodHandlers.put('"' + soapAction + '"', m.getOperationQName()); 77 methodHandlers.put('"' + soapAction + '"', wsdlOperationMapping(m));
77 } 78 }
78 } 79 }
79 } else { 80 } else {
80 for(WSDLBoundOperation wsdlOp: wsdlModel.getBinding().getBindingOperations()) { 81 for(WSDLBoundOperation wsdlOp: wsdlModel.getBinding().getBindingOperations()) {
81 methodHandlers.put(wsdlOp.getSOAPAction(),wsdlOp.getName()); 82 methodHandlers.put(wsdlOp.getSOAPAction(), wsdlOperationMapping(wsdlOp));
82 } 83 }
83 } 84 }
84 85
85 } 86 }
86 87
87 public QName getWSDLOperationQName(Packet request) { 88 // public QName getWSDLOperationQName(Packet request) {
89 public WSDLOperationMapping getWSDLOperationMapping(Packet request) throws DispatchException {
88 return request.soapAction == null ? null : methodHandlers.get(request.soapAction); 90 return request.soapAction == null ? null : methodHandlers.get(request.soapAction);
89 } 91 }
90 } 92 }

mercurial