1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/WsaTubeHelper.java Thu Apr 04 19:05:24 2013 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/WsaTubeHelper.java Tue Apr 09 14:51:13 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -30,7 +30,7 @@ 1.11 import com.sun.xml.internal.ws.api.SOAPVersion; 1.12 import com.sun.xml.internal.ws.api.WSBinding; 1.13 import com.sun.xml.internal.ws.api.addressing.AddressingVersion; 1.14 -import com.sun.xml.internal.ws.api.message.Message; 1.15 +import com.sun.xml.internal.ws.api.message.AddressingUtils; 1.16 import com.sun.xml.internal.ws.api.message.Packet; 1.17 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation; 1.18 import com.sun.xml.internal.ws.api.model.wsdl.WSDLFault; 1.19 @@ -39,6 +39,7 @@ 1.20 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort; 1.21 import com.sun.xml.internal.ws.api.model.SEIModel; 1.22 import com.sun.xml.internal.ws.api.model.JavaMethod; 1.23 +import com.sun.xml.internal.ws.api.model.WSDLOperationMapping; 1.24 import com.sun.xml.internal.ws.model.wsdl.WSDLOperationImpl; 1.25 import com.sun.xml.internal.ws.model.JavaMethodImpl; 1.26 import com.sun.xml.internal.ws.model.CheckedExceptionImpl; 1.27 @@ -53,7 +54,6 @@ 1.28 import javax.xml.soap.SOAPFault; 1.29 import javax.xml.soap.SOAPMessage; 1.30 import javax.xml.ws.WebServiceException; 1.31 -import java.util.Map; 1.32 1.33 /** 1.34 * @author Rama Pulavarthi 1.35 @@ -75,14 +75,15 @@ 1.36 if(seiModel != null) { 1.37 action = getFaultActionFromSEIModel(requestPacket,responsePacket); 1.38 } 1.39 - if(action != null) 1.40 + if (action != null) { 1.41 return action; 1.42 - else 1.43 + } else { 1.44 action = addVer.getDefaultFaultAction(); 1.45 + } 1.46 if (wsdlPort != null) { 1.47 - QName wsdlOp = requestPacket.getWSDLOperation(); 1.48 + WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping(); 1.49 if (wsdlOp != null) { 1.50 - WSDLBoundOperation wbo = wsdlPort.getBinding().get(wsdlOp); 1.51 + WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation(); 1.52 return getFaultAction(wbo, responsePacket); 1.53 } 1.54 } 1.55 @@ -91,29 +92,34 @@ 1.56 1.57 String getFaultActionFromSEIModel(Packet requestPacket, Packet responsePacket) { 1.58 String action = null; 1.59 - if (seiModel == null || wsdlPort == null) 1.60 + if (seiModel == null || wsdlPort == null) { 1.61 return action; 1.62 + } 1.63 1.64 try { 1.65 SOAPMessage sm = responsePacket.getMessage().copy().readAsSOAPMessage(); 1.66 - if (sm == null) 1.67 + if (sm == null) { 1.68 return action; 1.69 + } 1.70 1.71 - if (sm.getSOAPBody() == null) 1.72 + if (sm.getSOAPBody() == null) { 1.73 return action; 1.74 + } 1.75 1.76 - if (sm.getSOAPBody().getFault() == null) 1.77 + if (sm.getSOAPBody().getFault() == null) { 1.78 return action; 1.79 + } 1.80 1.81 Detail detail = sm.getSOAPBody().getFault().getDetail(); 1.82 - if (detail == null) 1.83 + if (detail == null) { 1.84 return action; 1.85 + } 1.86 1.87 String ns = detail.getFirstChild().getNamespaceURI(); 1.88 String name = detail.getFirstChild().getLocalName(); 1.89 1.90 - QName wsdlOp = requestPacket.getWSDLOperation(); 1.91 - JavaMethodImpl jm = (JavaMethodImpl) seiModel.getJavaMethodForWsdlOperation(wsdlOp); 1.92 + WSDLOperationMapping wsdlOp = requestPacket.getWSDLOperationMapping(); 1.93 + JavaMethodImpl jm = (wsdlOp != null) ? (JavaMethodImpl)wsdlOp.getJavaMethod() : null; 1.94 if (jm != null) { 1.95 for (CheckedExceptionImpl ce : jm.getCheckedExceptions()) { 1.96 if (ce.getDetailType().tagName.getLocalPart().equals(name) && 1.97 @@ -129,28 +135,34 @@ 1.98 } 1.99 1.100 String getFaultAction(@Nullable WSDLBoundOperation wbo, Packet responsePacket) { 1.101 - String action = responsePacket.getMessage().getHeaders().getAction(addVer, soapVer); 1.102 - if (action != null) 1.103 - return action; 1.104 + String action = AddressingUtils.getAction(responsePacket.getMessage().getHeaders(), addVer, soapVer); 1.105 + if (action != null) { 1.106 + return action; 1.107 + } 1.108 1.109 action = addVer.getDefaultFaultAction(); 1.110 - if (wbo == null) 1.111 + if (wbo == null) { 1.112 return action; 1.113 + } 1.114 1.115 try { 1.116 SOAPMessage sm = responsePacket.getMessage().copy().readAsSOAPMessage(); 1.117 - if (sm == null) 1.118 + if (sm == null) { 1.119 return action; 1.120 + } 1.121 1.122 - if (sm.getSOAPBody() == null) 1.123 + if (sm.getSOAPBody() == null) { 1.124 return action; 1.125 + } 1.126 1.127 - if (sm.getSOAPBody().getFault() == null) 1.128 + if (sm.getSOAPBody().getFault() == null) { 1.129 return action; 1.130 + } 1.131 1.132 Detail detail = sm.getSOAPBody().getFault().getDetail(); 1.133 - if (detail == null) 1.134 + if (detail == null) { 1.135 return action; 1.136 + } 1.137 1.138 String ns = detail.getFirstChild().getNamespaceURI(); 1.139 String name = detail.getFirstChild().getLocalName(); 1.140 @@ -158,10 +170,10 @@ 1.141 WSDLOperation o = wbo.getOperation(); 1.142 1.143 WSDLFault fault = o.getFault(new QName(ns, name)); 1.144 - if (fault == null) 1.145 + if (fault == null) { 1.146 return action; 1.147 + } 1.148 1.149 - WSDLOperationImpl impl = (WSDLOperationImpl)o; 1.150 action = fault.getAction(); 1.151 1.152 return action; 1.153 @@ -174,9 +186,9 @@ 1.154 String action = null; 1.155 1.156 if (wsdlPort != null) { 1.157 - QName wsdlOp = packet.getWSDLOperation(); 1.158 + WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping(); 1.159 if (wsdlOp != null) { 1.160 - WSDLBoundOperation wbo = wsdlPort.getBinding().get(wsdlOp); 1.161 + WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation(); 1.162 WSDLOperation op = wbo.getOperation(); 1.163 action = op.getInput().getAction(); 1.164 } 1.165 @@ -194,18 +206,20 @@ 1.166 */ 1.167 public String getEffectiveInputAction(Packet packet) { 1.168 //non-default SOAPAction beomes wsa:action 1.169 - if(packet.soapAction != null && !packet.soapAction.equals("")) 1.170 - return packet.soapAction; 1.171 - String action = null; 1.172 + if(packet.soapAction != null && !packet.soapAction.equals("")) { 1.173 + return packet.soapAction; 1.174 + } 1.175 + String action; 1.176 1.177 if (wsdlPort != null) { 1.178 - QName wsdlOp = packet.getWSDLOperation(); 1.179 + WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping(); 1.180 if (wsdlOp != null) { 1.181 - WSDLBoundOperation wbo = wsdlPort.getBinding().get(wsdlOp); 1.182 + WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation(); 1.183 WSDLOperation op = wbo.getOperation(); 1.184 action = op.getInput().getAction(); 1.185 - } else 1.186 + } else { 1.187 action = packet.soapAction; 1.188 + } 1.189 } else { 1.190 action = packet.soapAction; 1.191 } 1.192 @@ -213,12 +227,14 @@ 1.193 } 1.194 1.195 public boolean isInputActionDefault(Packet packet) { 1.196 - if (wsdlPort == null) 1.197 + if (wsdlPort == null) { 1.198 return false; 1.199 - QName wsdlOp = packet.getWSDLOperation(); 1.200 - if(wsdlOp == null) 1.201 + } 1.202 + WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping(); 1.203 + if(wsdlOp == null) { 1.204 return false; 1.205 - WSDLBoundOperation wbo = wsdlPort.getBinding().get(wsdlOp); 1.206 + } 1.207 + WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation(); 1.208 WSDLOperation op = wbo.getOperation(); 1.209 return ((WSDLOperationImpl) op).getInput().isDefaultAction(); 1.210 1.211 @@ -227,17 +243,20 @@ 1.212 public String getSOAPAction(Packet packet) { 1.213 String action = ""; 1.214 1.215 - if (packet == null || packet.getMessage() == null) 1.216 + if (packet == null || packet.getMessage() == null) { 1.217 return action; 1.218 + } 1.219 1.220 - if (wsdlPort == null) 1.221 + if (wsdlPort == null) { 1.222 return action; 1.223 + } 1.224 1.225 - QName opName = packet.getWSDLOperation(); 1.226 - if(opName == null) 1.227 + WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping(); 1.228 + if (wsdlOp == null) { 1.229 return action; 1.230 + } 1.231 1.232 - WSDLBoundOperation op = wsdlPort.getBinding().get(opName); 1.233 + WSDLBoundOperation op = wsdlOp.getWSDLBoundOperation(); 1.234 action = op.getSOAPAction(); 1.235 return action; 1.236 } 1.237 @@ -245,18 +264,17 @@ 1.238 public String getOutputAction(Packet packet) { 1.239 //String action = AddressingVersion.UNSET_OUTPUT_ACTION; 1.240 String action = null; 1.241 - QName wsdlOp = packet.getWSDLOperation(); 1.242 + WSDLOperationMapping wsdlOp = packet.getWSDLOperationMapping(); 1.243 if (wsdlOp != null) { 1.244 - if (seiModel != null) { 1.245 - JavaMethodImpl jm = (JavaMethodImpl) seiModel.getJavaMethodForWsdlOperation(wsdlOp); 1.246 + JavaMethod javaMethod = wsdlOp.getJavaMethod(); 1.247 + if (javaMethod != null) { 1.248 + JavaMethodImpl jm = (JavaMethodImpl) javaMethod; 1.249 if (jm != null && jm.getOutputAction() != null && !jm.getOutputAction().equals("")) { 1.250 return jm.getOutputAction(); 1.251 } 1.252 } 1.253 - if (wsdlPort != null) { 1.254 - WSDLBoundOperation wbo = wsdlPort.getBinding().get(wsdlOp); 1.255 - return getOutputAction(wbo); 1.256 - } 1.257 + WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation(); 1.258 + if (wbo != null) return getOutputAction(wbo); 1.259 } 1.260 return action; 1.261 } 1.262 @@ -265,8 +283,9 @@ 1.263 String action = AddressingVersion.UNSET_OUTPUT_ACTION; 1.264 if (wbo != null) { 1.265 WSDLOutput op = wbo.getOperation().getOutput(); 1.266 - if (op != null) 1.267 + if (op != null) { 1.268 action = op.getAction(); 1.269 + } 1.270 } 1.271 return action; 1.272 }