|
Lines 10-57
Link Here
|
| 10 |
* yyyymmdd bug Email and other contact information |
10 |
* yyyymmdd bug Email and other contact information |
| 11 |
* -------- -------- ----------------------------------------------------------- |
11 |
* -------- -------- ----------------------------------------------------------- |
| 12 |
* 20070305 117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers |
12 |
* 20070305 117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers |
|
|
13 |
* 20070413 176493 makandre@ca.ibm.com - Andrew Mak, WSE: Make message/transport stack pluggable |
| 13 |
*******************************************************************************/ |
14 |
*******************************************************************************/ |
| 14 |
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions; |
15 |
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions; |
| 15 |
|
16 |
|
| 16 |
import java.io.BufferedReader; |
|
|
| 17 |
import java.io.IOException; |
17 |
import java.io.IOException; |
| 18 |
import java.util.Hashtable; |
18 |
import java.util.Hashtable; |
| 19 |
import java.util.Iterator; |
19 |
|
| 20 |
import java.util.List; |
|
|
| 21 |
import java.util.Vector; |
| 22 |
import javax.servlet.http.HttpServletResponse; |
20 |
import javax.servlet.http.HttpServletResponse; |
| 23 |
import javax.wsdl.BindingInput; |
|
|
| 24 |
import javax.wsdl.BindingOperation; |
| 25 |
import javax.wsdl.Definition; |
| 26 |
import javax.wsdl.Part; |
| 27 |
import javax.wsdl.extensions.ExtensibilityElement; |
| 28 |
import javax.wsdl.extensions.soap.SOAPBody; |
| 29 |
import javax.xml.parsers.DocumentBuilder; |
| 30 |
import javax.xml.parsers.DocumentBuilderFactory; |
| 31 |
import javax.xml.parsers.ParserConfigurationException; |
21 |
import javax.xml.parsers.ParserConfigurationException; |
| 32 |
import org.apache.axis.Constants; |
22 |
|
| 33 |
import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; |
23 |
import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller; |
| 34 |
import org.eclipse.wst.ws.internal.explorer.platform.perspective.MessageQueue; |
24 |
import org.eclipse.wst.ws.internal.explorer.platform.perspective.MessageQueue; |
| 35 |
import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; |
25 |
import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException; |
| 36 |
import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; |
26 |
import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser; |
| 37 |
import org.eclipse.wst.ws.internal.explorer.platform.util.XMLUtils; |
|
|
| 38 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.WSDLActionInputs; |
27 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.WSDLActionInputs; |
|
|
28 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.WSDLModelConstants; |
| 39 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.Endpoint; |
29 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.Endpoint; |
| 40 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.WSDLBindingElement; |
30 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.WSDLBindingElement; |
| 41 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.WSDLElement; |
|
|
| 42 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.WSDLOperationElement; |
31 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.WSDLOperationElement; |
| 43 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.WSDLServiceElement; |
|
|
| 44 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment; |
| 45 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.InvokeWSDLOperationTool; |
32 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.InvokeWSDLOperationTool; |
| 46 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.SOAPMessageQueue; |
|
|
| 47 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.WSDLPerspective; |
33 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.WSDLPerspective; |
| 48 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.transport.HTTPException; |
34 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.util.SOAPMessageUtils; |
| 49 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.transport.HTTPTransport; |
35 |
import org.eclipse.wst.ws.internal.explorer.transport.HTTPTransportException; |
| 50 |
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.util.SoapHelper; |
36 |
import org.eclipse.wst.ws.internal.explorer.transport.ISOAPMessage; |
| 51 |
import org.eclipse.wst.ws.internal.parser.discovery.NetUtils; |
37 |
import org.eclipse.wst.ws.internal.explorer.transport.ISOAPTransportProvider; |
| 52 |
import org.eclipse.wst.wsdl.binding.soap.SOAPHeader; |
38 |
import org.eclipse.wst.ws.internal.explorer.transport.TransportException; |
| 53 |
import org.w3c.dom.Document; |
|
|
| 54 |
import org.w3c.dom.Element; |
| 55 |
|
39 |
|
| 56 |
public abstract class InvokeWSDLSOAPOperationAction extends WSDLPropertiesFormAction |
40 |
public abstract class InvokeWSDLSOAPOperationAction extends WSDLPropertiesFormAction |
| 57 |
{ |
41 |
{ |
|
Lines 69-250
Link Here
|
| 69 |
return true; |
53 |
return true; |
| 70 |
} |
54 |
} |
| 71 |
|
55 |
|
| 72 |
protected final void addRPCWrapper(Vector bodyEntries,WSDLElement wsdlElement,WSDLOperationElement operElement,Hashtable soapEnvelopeNamespaceTable) throws ParserConfigurationException |
|
|
| 73 |
{ |
| 74 |
// Must be RPC style. |
| 75 |
String encodingNamespaceURI = null; |
| 76 |
/* |
| 77 |
* WS-I: In a rpc-literal SOAP binding, the serialized child element of the |
| 78 |
* soap:Body element consists of a wrapper element, whose namespace is the value |
| 79 |
* of the namespace attribute of the soapbind:body element and whose local name is |
| 80 |
* either the name of the operation or the name of the operation suffixed |
| 81 |
* with "Response". The namespace attribute is required, as opposed to being |
| 82 |
* optional, to ensure that the children of the soap:Body element are namespace- |
| 83 |
* qualified. |
| 84 |
*/ |
| 85 |
BindingOperation bindingOperation = operElement.getBindingOperation(); |
| 86 |
if (bindingOperation != null) |
| 87 |
{ |
| 88 |
BindingInput bindingInput = bindingOperation.getBindingInput(); |
| 89 |
if (bindingInput != null) |
| 90 |
{ |
| 91 |
List extElements = bindingInput.getExtensibilityElements(); |
| 92 |
for (Iterator it = extElements.iterator(); it.hasNext();) |
| 93 |
{ |
| 94 |
ExtensibilityElement extElement = (ExtensibilityElement)it.next(); |
| 95 |
if (extElement instanceof SOAPBody) |
| 96 |
{ |
| 97 |
encodingNamespaceURI = ((SOAPBody)extElement).getNamespaceURI(); |
| 98 |
break; |
| 99 |
} |
| 100 |
} |
| 101 |
} |
| 102 |
} |
| 103 |
// If the namespace of the soapbind:body element is not set, get it from the operation element |
| 104 |
if (encodingNamespaceURI == null) |
| 105 |
encodingNamespaceURI = operElement.getEncodingNamespace(); |
| 106 |
// If the namespace of the operation element is not set, get it from the definition element |
| 107 |
if (encodingNamespaceURI == null) |
| 108 |
{ |
| 109 |
Definition definition = wsdlElement.getDefinition(); |
| 110 |
encodingNamespaceURI = definition.getTargetNamespace(); |
| 111 |
} |
| 112 |
// Generate an RPC style wrapper element. |
| 113 |
Document doc = XMLUtils.createNewDocument(null); |
| 114 |
String encodingStyle = (operElement.isUseLiteral() ? null : operElement.getEncodingStyle()); |
| 115 |
Element wrapperElement = SoapHelper.createRPCWrapperElement(doc,soapEnvelopeNamespaceTable,encodingNamespaceURI,operElement.getOperation().getName(),encodingStyle); |
| 116 |
for (int i=0;i<bodyEntries.size();i++) |
| 117 |
wrapperElement.appendChild(doc.importNode((Element)bodyEntries.elementAt(i),true)); |
| 118 |
bodyEntries.removeAllElements(); |
| 119 |
bodyEntries.addElement(wrapperElement); |
| 120 |
} |
| 121 |
|
| 122 |
/** |
56 |
/** |
| 123 |
* Generate a Vector of the elements inside the Soap Header. |
57 |
* Returns an ISOAPMessage to use for the current SOAP operation invocation. |
| 124 |
* @param soapEnvelopeNamespaceTable - Hashtable containing a map of the namespace URIs to prefixes. |
58 |
* |
| 125 |
* @param operElement - WSDLOperationElement encapsulating the WSDL operation. |
59 |
* @param operElement The operation element from the WSDL model. |
|
|
60 |
* |
| 61 |
* @return An ISOAPMessage, or null if a message cannot be constructed. |
| 126 |
*/ |
62 |
*/ |
| 127 |
protected Vector getHeaderEntries(Hashtable soapEnvelopeNamespaceTable,WSDLOperationElement operElement) throws ParserConfigurationException,Exception |
63 |
protected ISOAPMessage getSOAPRequestMessage(WSDLOperationElement operElement) { |
| 128 |
{ |
64 |
ISOAPTransportProvider provider = operElement.getSOAPTransportProvider(); |
| 129 |
Vector headerEntries = new Vector(); |
65 |
if (provider == null) |
| 130 |
|
66 |
return null; |
| 131 |
Iterator it = operElement.getSOAPHeaders().iterator(); |
67 |
return provider.newTransport().newMessage(operElement.getMessageContext()); |
| 132 |
while (it.hasNext()) |
|
|
| 133 |
{ |
| 134 |
SOAPHeader soapHeader = (SOAPHeader) it.next(); |
| 135 |
|
| 136 |
StringBuffer encodingStyle = null; |
| 137 |
boolean isUseLiteral = "literal".equals(soapHeader.getUse()); |
| 138 |
|
| 139 |
if (!isUseLiteral) { |
| 140 |
Iterator encodingStyles = soapHeader.getEncodingStyles().iterator(); |
| 141 |
encodingStyle = new StringBuffer(); |
| 142 |
while (encodingStyles.hasNext()) { |
| 143 |
Object next = encodingStyles.next(); |
| 144 |
if (Constants.URI_SOAP11_ENC.equals(next)) |
| 145 |
continue; |
| 146 |
encodingStyle.append(" ").append(next); |
| 147 |
} |
| 148 |
} |
| 149 |
|
| 150 |
IXSDFragment frag = (IXSDFragment)operElement.getHeaderFragment(soapHeader); |
| 151 |
Element[] instanceDocuments = frag.genInstanceDocumentsFromParameterValues(!isUseLiteral,soapEnvelopeNamespaceTable, XMLUtils.createNewDocument(null)); |
| 152 |
for (int j=0;j<instanceDocuments.length;j++) |
| 153 |
{ |
| 154 |
if (instanceDocuments[j] == null) |
| 155 |
continue; |
| 156 |
if (encodingStyle != null && encodingStyle.length() > 0) |
| 157 |
instanceDocuments[j].setAttribute("soapenv:encodingStyle",encodingStyle.substring(1)); |
| 158 |
headerEntries.addElement(instanceDocuments[j]); |
| 159 |
} |
| 160 |
} |
| 161 |
|
| 162 |
return headerEntries; |
| 163 |
} |
68 |
} |
| 164 |
|
69 |
|
| 165 |
/** |
70 |
/** |
| 166 |
* Generate a Vector of the elements inside the Soap Body. |
71 |
* Populate the given ISOAPMessage's header using the inputs from WSE |
| 167 |
* @param soapEnvelopeNamespaceTable - Hashtable containing a map of the namespace URIs to prefixes. |
72 |
* |
| 168 |
* @param operElement - WSDLOperationElement encapsulating the WSDL operation. |
73 |
* @param soapEnvelopeNamespaceTable Hashtable containing a map of the namespace URIs to prefixes. |
|
|
74 |
* @param operElement WSDLOperationElement encapsulating the WSDL operation. |
| 75 |
* @param soapMessage The ISOAPMessage to populate |
| 169 |
*/ |
76 |
*/ |
| 170 |
protected Vector getBodyEntries(Hashtable soapEnvelopeNamespaceTable,WSDLOperationElement operElement,WSDLBindingElement bindingElement,WSDLServiceElement serviceElement) throws ParserConfigurationException,Exception |
77 |
protected void setHeaderContent(Hashtable soapEnvelopeNamespaceTable, WSDLOperationElement operElement, ISOAPMessage soapMessage) |
| 171 |
{ |
78 |
throws ParserConfigurationException { |
| 172 |
Vector bodyEntries = new Vector(); |
79 |
SOAPMessageUtils.setHeaderContentFromModel(soapEnvelopeNamespaceTable, operElement, soapMessage); |
| 173 |
boolean isUseLiteral = operElement.isUseLiteral(); |
|
|
| 174 |
String encodingStyle = operElement.getEncodingStyle(); |
| 175 |
boolean addEncodingStyle = (!isUseLiteral && !Constants.URI_SOAP11_ENC.equals(encodingStyle)); |
| 176 |
Iterator it = operElement.getOrderedBodyParts().iterator(); |
| 177 |
while (it.hasNext()) |
| 178 |
{ |
| 179 |
Part part = (Part)it.next(); |
| 180 |
IXSDFragment frag = (IXSDFragment)operElement.getFragment(part); |
| 181 |
Element[] instanceDocuments = frag.genInstanceDocumentsFromParameterValues(!isUseLiteral,soapEnvelopeNamespaceTable, XMLUtils.createNewDocument(null)); |
| 182 |
for (int j=0;j<instanceDocuments.length;j++) |
| 183 |
{ |
| 184 |
if (instanceDocuments[j] == null) |
| 185 |
continue; |
| 186 |
if (addEncodingStyle) |
| 187 |
instanceDocuments[j].setAttribute("soapenv:encodingStyle",encodingStyle); |
| 188 |
bodyEntries.addElement(instanceDocuments[j]); |
| 189 |
} |
| 190 |
} |
| 191 |
|
| 192 |
if (!operElement.isDocumentStyle()) |
| 193 |
{ |
| 194 |
try |
| 195 |
{ |
| 196 |
addRPCWrapper(bodyEntries,(WSDLElement)serviceElement.getParentElement(),operElement,soapEnvelopeNamespaceTable); |
| 197 |
} |
| 198 |
catch (ParserConfigurationException e) |
| 199 |
{ |
| 200 |
throw e; |
| 201 |
} |
| 202 |
} |
| 203 |
return bodyEntries; |
| 204 |
} |
| 205 |
|
| 206 |
protected Element getSOAPEnvelope(Hashtable soapEnvelopeNamespaceTable, Vector bodyEntries) throws ParserConfigurationException |
| 207 |
{ |
| 208 |
return getSOAPEnvelope(soapEnvelopeNamespaceTable, null, bodyEntries); |
| 209 |
} |
| 210 |
|
| 211 |
protected Element getSOAPEnvelope(Hashtable soapEnvelopeNamespaceTable, Vector headerEntries, Vector bodyEntries) throws ParserConfigurationException |
| 212 |
{ |
| 213 |
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
| 214 |
Document doc = XMLUtils.createNewDocument(docBuilder); |
| 215 |
Element soapEnvelopeElement = SoapHelper.createSoapEnvelopeElement(doc,soapEnvelopeNamespaceTable); |
| 216 |
|
| 217 |
if (headerEntries != null && !headerEntries.isEmpty()) { |
| 218 |
Element soapHeaderElement = SoapHelper.createSoapHeaderElement(doc); |
| 219 |
for (int i=0;i<headerEntries.size();i++) |
| 220 |
soapHeaderElement.appendChild(doc.importNode((Element)headerEntries.elementAt(i),true)); |
| 221 |
soapEnvelopeElement.appendChild(soapHeaderElement); |
| 222 |
} |
| 223 |
|
| 224 |
Element soapBodyElement = SoapHelper.createSoapBodyElement(doc); |
| 225 |
for (int i=0;i<bodyEntries.size();i++) |
| 226 |
soapBodyElement.appendChild(doc.importNode((Element)bodyEntries.elementAt(i),true)); |
| 227 |
soapEnvelopeElement.appendChild(soapBodyElement); |
| 228 |
return soapEnvelopeElement; |
| 229 |
} |
| 230 |
|
| 231 |
private final void recordSoapRequest(SOAPMessageQueue soapRequestQueue,Hashtable soapEnvelopeNamespaceTable,Element soapEnvelope) throws ParserConfigurationException,IOException |
| 232 |
{ |
| 233 |
soapRequestQueue.clear(); |
| 234 |
soapRequestQueue.addMessage(XMLUtils.serialize(soapEnvelope,false)); |
| 235 |
} |
80 |
} |
| 236 |
|
81 |
|
| 237 |
private final void recordSOAPResponse(SOAPMessageQueue soapResponseQueue,BufferedReader responseReader) throws IOException |
82 |
/** |
| 238 |
{ |
83 |
* Populate the given ISOAPMessage's body using the inputs from WSE |
| 239 |
soapResponseQueue.clear(); |
84 |
* |
| 240 |
if (responseReader != null) |
85 |
* @param soapEnvelopeNamespaceTable Hashtable containing a map of the namespace URIs to prefixes. |
| 241 |
{ |
86 |
* @param operElement WSDLOperationElement encapsulating the WSDL operation. |
| 242 |
String line = null; |
87 |
* @param soapMessage The ISOAPMessage to populate |
| 243 |
while ((line = responseReader.readLine()) != null) |
88 |
*/ |
| 244 |
soapResponseQueue.addMessage(line); |
89 |
protected void setBodyContent(Hashtable soapEnvelopeNamespaceTable, WSDLOperationElement operElement, ISOAPMessage soapMessage) |
| 245 |
responseReader.close(); |
90 |
throws ParserConfigurationException { |
| 246 |
} |
91 |
SOAPMessageUtils.setBodyContentFromModel(soapEnvelopeNamespaceTable, operElement, soapMessage); |
| 247 |
} |
92 |
} |
| 248 |
|
93 |
|
| 249 |
public boolean run() |
94 |
public boolean run() |
| 250 |
{ |
95 |
{ |
|
Lines 253-259
Link Here
|
| 253 |
MessageQueue messageQueue = wsdlPerspective.getMessageQueue(); |
98 |
MessageQueue messageQueue = wsdlPerspective.getMessageQueue(); |
| 254 |
WSDLOperationElement operElement = (WSDLOperationElement)getSelectedNavigatorNode().getTreeElement(); |
99 |
WSDLOperationElement operElement = (WSDLOperationElement)getSelectedNavigatorNode().getTreeElement(); |
| 255 |
WSDLBindingElement bindingElement = (WSDLBindingElement)operElement.getParentElement(); |
100 |
WSDLBindingElement bindingElement = (WSDLBindingElement)operElement.getParentElement(); |
| 256 |
WSDLServiceElement serviceElement = (WSDLServiceElement)bindingElement.getParentElement(); |
|
|
| 257 |
operElement.setPropertyAsObject(WSDLActionInputs.SOAP_RESPONSE_CACHED, new Boolean(false)); |
101 |
operElement.setPropertyAsObject(WSDLActionInputs.SOAP_RESPONSE_CACHED, new Boolean(false)); |
| 258 |
try |
102 |
try |
| 259 |
{ |
103 |
{ |
|
Lines 263-309
Link Here
|
| 263 |
// xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
107 |
// xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 264 |
// xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
108 |
// xmlns:xsd="http://www.w3.org/2001/XMLSchema"> |
| 265 |
// ... |
109 |
// ... |
| 266 |
Hashtable soapEnvelopeNamespaceTable = new Hashtable(); |
|
|
| 267 |
SoapHelper.addDefaultSoapEnvelopeNamespaces(soapEnvelopeNamespaceTable); |
| 268 |
Vector headerEntries = getHeaderEntries(soapEnvelopeNamespaceTable, operElement); |
| 269 |
Vector bodyEntries = getBodyEntries(soapEnvelopeNamespaceTable,operElement,bindingElement,serviceElement); |
| 270 |
Element soapEnvelope = getSOAPEnvelope(soapEnvelopeNamespaceTable, headerEntries, bodyEntries); |
| 271 |
recordSoapRequest(wsdlPerspective.getSOAPRequestQueue(),soapEnvelopeNamespaceTable,soapEnvelope); |
| 272 |
|
110 |
|
| 273 |
// Execute the SOAP operation. |
111 |
ISOAPMessage soapMessage = getSOAPRequestMessage(operElement); |
|
|
112 |
if (soapMessage == null) |
| 113 |
throw new TransportException(wsdlPerspective.getMessage("MSG_ERROR_NO_SUITABLE_TRANSPORT")); |
| 114 |
|
| 115 |
Hashtable namespaceTable = new Hashtable(soapMessage.getNamespaceTable()); |
| 116 |
setHeaderContent(namespaceTable, operElement, soapMessage); |
| 117 |
setBodyContent(namespaceTable, operElement, soapMessage); |
| 118 |
soapMessage.setNamespaceTable(namespaceTable); |
| 119 |
|
| 120 |
// store the request |
| 121 |
operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOAP_REQUEST, soapMessage); |
| 122 |
|
| 123 |
// Execute the SOAP operation. |
| 274 |
if (soapAddressLocation != null) |
124 |
if (soapAddressLocation != null) |
| 275 |
{ |
125 |
{ |
| 276 |
// Send the message and record the SOAP Response Envelope. |
126 |
soapMessage.setProperty(ISOAPMessage.PROP_SOAP_ACTION, operElement.getSoapAction()); |
| 277 |
HTTPTransport transport = createTransport(bindingElement, soapAddressLocation); |
127 |
String[] authParams = retrieveAuthParams(bindingElement, soapAddressLocation); |
| 278 |
transport.send(NetUtils.createURL(soapAddressLocation),operElement.getSoapAction(),XMLUtils.serialize(soapEnvelope, true)); |
128 |
|
| 279 |
recordSOAPResponse(wsdlPerspective.getSOAPResponseQueue(),transport.receive()); |
129 |
// invoke! |
|
|
130 |
ISOAPMessage soapResponse = operElement.getSOAPTransportProvider().newTransport() |
| 131 |
.send(soapAddressLocation, authParams[0], authParams[1], soapMessage); |
| 132 |
|
| 133 |
// store the response |
| 134 |
operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOAP_RESPONSE, soapResponse); |
| 135 |
|
| 280 |
wsdlPerspective.setOperationNode(getSelectedNavigatorNode()); |
136 |
wsdlPerspective.setOperationNode(getSelectedNavigatorNode()); |
| 281 |
return true; |
137 |
return true; |
| 282 |
} |
138 |
} |
| 283 |
throw new IOException(wsdlPerspective.getMessage("MSG_ERROR_UNABLE_TO_CONNECT",soapAddressLocation)); |
139 |
throw new IOException(wsdlPerspective.getMessage("MSG_ERROR_UNABLE_TO_CONNECT",soapAddressLocation)); |
| 284 |
} |
140 |
} |
| 285 |
catch (ParserConfigurationException e) |
141 |
catch (HTTPTransportException e) { |
| 286 |
{ |
142 |
throwHTTPTransportException(bindingElement, soapAddressLocation, e); |
| 287 |
handleUnexpectedException(wsdlPerspective,messageQueue,"ParserConfigurationException",e); |
|
|
| 288 |
} |
| 289 |
catch (IOException e) |
| 290 |
{ |
| 291 |
handleUnexpectedException(wsdlPerspective,messageQueue,"IOException",e); |
| 292 |
} |
143 |
} |
| 293 |
catch (HTTPException httpe) |
144 |
catch (Exception e) { |
| 294 |
{ |
145 |
Throwable t = e; |
| 295 |
throwHTTPException(bindingElement, soapAddressLocation, httpe); |
146 |
if (e instanceof TransportException && e.getCause() != null) |
| 296 |
} |
147 |
t = e.getCause(); |
| 297 |
catch (Exception e) |
148 |
handleUnexpectedException(wsdlPerspective, messageQueue, t.getClass().getSimpleName(), t); |
| 298 |
{ |
|
|
| 299 |
handleUnexpectedException(wsdlPerspective,messageQueue,"Exception",e); |
| 300 |
} |
149 |
} |
| 301 |
return false; |
150 |
return false; |
| 302 |
} |
151 |
} |
| 303 |
|
152 |
|
| 304 |
private void throwHTTPException(WSDLBindingElement bindingElement, String endpointString, HTTPException httpException) throws HTTPException |
153 |
private void throwHTTPTransportException(WSDLBindingElement bindingElement, String endpointString, HTTPTransportException httpTransportException) throws HTTPTransportException |
| 305 |
{ |
154 |
{ |
| 306 |
if (httpException.getStatusCode() == HttpServletResponse.SC_UNAUTHORIZED) |
155 |
if (httpTransportException.getStatusCode() == HttpServletResponse.SC_UNAUTHORIZED) |
| 307 |
{ |
156 |
{ |
| 308 |
Endpoint endpoint = bindingElement.getEndpoint(endpointString); |
157 |
Endpoint endpoint = bindingElement.getEndpoint(endpointString); |
| 309 |
if (endpoint != null) |
158 |
if (endpoint != null) |
|
Lines 313-324
Link Here
|
| 313 |
endpoint.setHttpBasicAuthPassword(null); |
162 |
endpoint.setHttpBasicAuthPassword(null); |
| 314 |
} |
163 |
} |
| 315 |
} |
164 |
} |
| 316 |
throw httpException; |
165 |
throw httpTransportException; |
| 317 |
} |
166 |
} |
| 318 |
|
167 |
|
| 319 |
private HTTPTransport createTransport(WSDLBindingElement bindingElement, String endpointString) |
168 |
private String[] retrieveAuthParams(WSDLBindingElement bindingElement, String endpointString) |
| 320 |
{ |
169 |
{ |
| 321 |
HTTPTransport transport = new HTTPTransport(); |
170 |
String[] authParams = new String[] { null, null }; |
| 322 |
Endpoint endpoint = bindingElement.getEndpoint(endpointString); |
171 |
Endpoint endpoint = bindingElement.getEndpoint(endpointString); |
| 323 |
if (endpoint != null) |
172 |
if (endpoint != null) |
| 324 |
{ |
173 |
{ |
|
Lines 335-345
Link Here
|
| 335 |
} |
184 |
} |
| 336 |
if (httpBasicAuthUsername != null && httpBasicAuthPassword != null) |
185 |
if (httpBasicAuthUsername != null && httpBasicAuthPassword != null) |
| 337 |
{ |
186 |
{ |
| 338 |
transport.setHttpBasicAuthUsername(httpBasicAuthUsername); |
187 |
authParams[0] = httpBasicAuthUsername; |
| 339 |
transport.setHttpBasicAuthPassword(httpBasicAuthPassword); |
188 |
authParams[1] = httpBasicAuthPassword; |
| 340 |
} |
189 |
} |
| 341 |
} |
190 |
} |
| 342 |
} |
191 |
} |
| 343 |
return transport; |
192 |
return authParams; |
| 344 |
} |
193 |
} |
| 345 |
} |
194 |
} |