Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 117034 | Differences between
and this patch

Collapse All | Expand All

(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/constants/WSDLActionInputs.java (-2 / +8 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004 IBM Corporation and others.
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants;
14
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants;
12
15
Lines 25-32 Link Here
25
28
26
  public static final String SUBMISSION_ACTION = "submissionAction";
29
  public static final String SUBMISSION_ACTION = "submissionAction";
27
  public static final String SUBMISSION_ACTION_FORM = "submissionActionForm";
30
  public static final String SUBMISSION_ACTION_FORM = "submissionActionForm";
31
  public static final String SUBMISSION_ACTION_BROWSE_FILE_HEADER = "submissionActionBrowseFileHeader";
28
  public static final String SUBMISSION_ACTION_BROWSE_FILE = "submissionActionBrowseFile";
32
  public static final String SUBMISSION_ACTION_BROWSE_FILE = "submissionActionBrowseFile";
33
  public static final String SUBMISSION_ACTION_SAVE_AS_HEADER = "submissionActionSaveAsHeader";
29
  public static final String SUBMISSION_ACTION_SAVE_AS = "submissionActionSaveAs";
34
  public static final String SUBMISSION_ACTION_SAVE_AS = "submissionActionSaveAs";
35
  public static final String SELECTED_FILE_HEADER = "selectedFileHeader";
30
  public static final String SELECTED_FILE = "selectedFile";
36
  public static final String SELECTED_FILE = "selectedFile";
31
  public static final String OPERATION_ELEMENT = "operationElement";
37
  public static final String OPERATION_ELEMENT = "operationElement";
32
38
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/constants/FragmentConstants.java (-2 / +8 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004 IBM Corporation and others.
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants;
14
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants;
12
15
Lines 36-45 Link Here
36
  public static final String FRAGMENT_VIEW_ID = "::fragmentViewID";
39
  public static final String FRAGMENT_VIEW_ID = "::fragmentViewID";
37
  public static final String XSD_ATOMIC_ENUM_ID = "::xsdAtomicEnumID";
40
  public static final String XSD_ATOMIC_ENUM_ID = "::xsdAtomicEnumID";
38
  public static final String XSD_ALL_GROUP_ID = "::xsdAllGroupID";
41
  public static final String XSD_ALL_GROUP_ID = "::xsdAllGroupID";
42
  public static final String PART_TOKEN = "^";
39
43
40
  // Fragment view IDs
44
  // Fragment view IDs
41
  public static final String FRAGMENT_VIEW_SWITCH_FORM_TO_SOURCE = "::fragmentViewSwitchFormToSource";
45
  public static final String FRAGMENT_VIEW_SWITCH_FORM_TO_SOURCE = "::fragmentViewSwitchFormToSource";
42
  public static final String FRAGMENT_VIEW_SWITCH_SOURCE_TO_FORM = "::fragmentViewSwitchSourceToForm";
46
  public static final String FRAGMENT_VIEW_SWITCH_SOURCE_TO_FORM = "::fragmentViewSwitchSourceToForm";
47
  public static final String SOURCE_CONTENT_HEADER = "::sourceContentHeader";
43
  public static final String SOURCE_CONTENT = "::sourceContent";
48
  public static final String SOURCE_CONTENT = "::sourceContent";
44
  public static final String SOURCE_CONTENT_NAMESPACE = "::sourceContentNS";
49
  public static final String SOURCE_CONTENT_NAMESPACE = "::sourceContentNS";
45
50
Lines 58-63 Link Here
58
  public static final String QNAME_LOCAL_NAME_ARRAY_TYPE = "arrayType";
63
  public static final String QNAME_LOCAL_NAME_ARRAY_TYPE = "arrayType";
59
  public static final String QNAME_LOCAL_NAME_ARRAY = "Array";
64
  public static final String QNAME_LOCAL_NAME_ARRAY = "Array";
60
  public static final String COLON = ":";
65
  public static final String COLON = ":";
66
  public static final String QNAME_LOCAL_NAME_HEADER = "Header";  
61
  public static final String QNAME_LOCAL_NAME_BODY = "Body";
67
  public static final String QNAME_LOCAL_NAME_BODY = "Body";
62
  public static final String QNAME_LOCAL_NAME_FAULT = "Fault";
68
  public static final String QNAME_LOCAL_NAME_FAULT = "Fault";
63
69
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/constants/WSDLModelConstants.java (-2 / +6 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2001, 2004 IBM Corporation and others.
2
 * Copyright (c) 2001, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
14
12
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants;
15
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants;
Lines 23-28 Link Here
23
    public final static String PROP_DOCUMENTATION = "propDocumentation";
26
    public final static String PROP_DOCUMENTATION = "propDocumentation";
24
27
25
    // Source Content
28
    // Source Content
29
    public final static String PROP_SOURCE_CONTENT_HEADER = "propSourceContentHeader";
26
    public final static String PROP_SOURCE_CONTENT = "propSourceContent";
30
    public final static String PROP_SOURCE_CONTENT = "propSourceContent";
27
    public final static String PROP_SOURCE_CONTENT_NAMESPACE = "propSourceContentNS";
31
    public final static String PROP_SOURCE_CONTENT_NAMESPACE = "propSourceContentNS";
28
}
32
}
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/actions/InvokeWSDLSOAPOperationSourceAction.java (-20 / +63 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004 IBM Corporation and others.
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions;
14
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions;
12
15
Lines 34-39 Link Here
34
{
37
{
35
  private boolean newFileSelected_;
38
  private boolean newFileSelected_;
36
  private boolean saveAsSelected_;
39
  private boolean saveAsSelected_;
40
  private boolean isHeader_;
37
  private static final String DUMMY_WRAPPER_START_TAG = "<dummyWrapper>";
41
  private static final String DUMMY_WRAPPER_START_TAG = "<dummyWrapper>";
38
  private static final String DUMMY_WRAPPER_END_TAG = "</dummyWrapper>";
42
  private static final String DUMMY_WRAPPER_END_TAG = "</dummyWrapper>";
39
  
43
  
Lines 42-47 Link Here
42
    super(controller);
46
    super(controller);
43
    newFileSelected_ = false;
47
    newFileSelected_ = false;
44
    saveAsSelected_ = false;
48
    saveAsSelected_ = false;
49
    isHeader_ = false;
45
  }
50
  }
46
51
47
  protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException
52
  protected boolean processParsedResults(MultipartFormDataParser parser) throws MultipartFormDataException
Lines 50-86 Link Here
50
    WSDLOperationElement operElement = (WSDLOperationElement)getSelectedNavigatorNode().getTreeElement();
55
    WSDLOperationElement operElement = (WSDLOperationElement)getSelectedNavigatorNode().getTreeElement();
51
    newFileSelected_ = false;
56
    newFileSelected_ = false;
52
    saveAsSelected_ = false;
57
    saveAsSelected_ = false;
58
    isHeader_ = false;
53
    /*  try and catch is needed if we are doing fragmentization.
59
    /*  try and catch is needed if we are doing fragmentization.
54
    try
60
    try
55
    {
61
    {
56
    */
62
    */
57
      String submissionAction = parser.getParameter(WSDLActionInputs.SUBMISSION_ACTION);
63
      String submissionAction = parser.getParameter(WSDLActionInputs.SUBMISSION_ACTION);
58
      String sourceContents = parser.getParameter(FragmentConstants.SOURCE_CONTENT);
64
      String sourceContents = parser.getParameter(FragmentConstants.SOURCE_CONTENT_HEADER);
65
      if (sourceContents != null)
66
    	operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT_HEADER,sourceContents);  
67
      sourceContents = parser.getParameter(FragmentConstants.SOURCE_CONTENT);
59
      if (sourceContents != null)
68
      if (sourceContents != null)
60
        operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT,sourceContents);
69
        operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT,sourceContents);
61
      if (WSDLActionInputs.SUBMISSION_ACTION_BROWSE_FILE.equals(submissionAction))
70
      if (WSDLActionInputs.SUBMISSION_ACTION_BROWSE_FILE_HEADER.equals(submissionAction))
71
      {
72
    	newFileSelected_ = true;
73
        String fileContents = parser.getParameter(WSDLActionInputs.SELECTED_FILE_HEADER);
74
        if (fileContents != null)
75
          operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT_HEADER,fileContents);
76
      }
77
      else if (WSDLActionInputs.SUBMISSION_ACTION_BROWSE_FILE.equals(submissionAction))
62
      {
78
      {
63
        newFileSelected_ = true;
79
        newFileSelected_ = true;
64
        String fileContents = parser.getParameter(WSDLActionInputs.SELECTED_FILE);
80
        String fileContents = parser.getParameter(WSDLActionInputs.SELECTED_FILE);
65
        if (fileContents != null)
81
        if (fileContents != null)
66
          operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT,fileContents);
82
          operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT,fileContents);
67
      }
83
      }
68
      else
84
      else if (WSDLActionInputs.SUBMISSION_ACTION_SAVE_AS_HEADER.equals(submissionAction))
69
      {
85
      {
70
        if (WSDLActionInputs.SUBMISSION_ACTION_SAVE_AS.equals(submissionAction))
86
    	saveAsSelected_ = true;
71
        {
87
    	isHeader_ = true;
72
          // Save As... action
88
    	return true;
73
          saveAsSelected_ = true;
74
        }
75
        else
76
        {
77
          // Fragmentize on Go action.
78
          // fragmentize(new StringBuffer(sourceContents));
79
          String[] nsDeclarations = parser.getParameterValues(FragmentConstants.SOURCE_CONTENT_NAMESPACE);
80
          if (nsDeclarations != null)
81
            operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT_NAMESPACE,nsDeclarations);
82
        }
83
      }
89
      }
90
      else if (WSDLActionInputs.SUBMISSION_ACTION_SAVE_AS.equals(submissionAction))
91
      {
92
        // Save As... action
93
        saveAsSelected_ = true;      
94
    	return true;
95
      }
96
      
97
      String[] nsDeclarations = parser.getParameterValues(FragmentConstants.SOURCE_CONTENT_NAMESPACE);
98
      if (nsDeclarations != null)
99
        operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT_NAMESPACE,nsDeclarations);    	
100
84
      return true;
101
      return true;
85
    /*
102
    /*
86
    }       
103
    }       
Lines 104-109 Link Here
104
    */
121
    */
105
  }
122
  }
106
123
124
  protected Vector getHeaderEntries(Hashtable soapEnvelopeNamespaceTable, WSDLOperationElement operElement) throws ParserConfigurationException, Exception {
125
	
126
	  Vector headerEntries = new Vector();
127
      String[] nsDeclarations = (String[])operElement.getPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT_NAMESPACE);
128
   	  for (int i = 0; i < nsDeclarations.length; i++)
129
	  {
130
	    String[] prefix_ns = SoapHelper.decodeNamespaceDeclaration(nsDeclarations[i]);
131
	    if (!soapEnvelopeNamespaceTable.contains(prefix_ns[1]))
132
	      soapEnvelopeNamespaceTable.put(prefix_ns[1], prefix_ns[0]);
133
	  }
134
	  StringBuffer sourceContent = new StringBuffer(operElement.getPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT_HEADER));
135
	  sourceContent.insert(0,DUMMY_WRAPPER_START_TAG).append(DUMMY_WRAPPER_END_TAG);
136
	  Element dummyWrapperElement = XMLUtils.stringToElement(sourceContent.toString());          
137
	  NodeList nl = dummyWrapperElement.getChildNodes();
138
	  for (int i = 0; i < nl.getLength(); i++)
139
	  {
140
	    if (nl.item(i) instanceof Element)
141
	      headerEntries.add(nl.item(i));
142
	  }
143
	  
144
	  return headerEntries;
145
  }
146
107
  /**
147
  /**
108
   * Generate a Vector of the elements inside the Soap Body.
148
   * Generate a Vector of the elements inside the Soap Body.
109
   * @param soapEnvelopeNamespaceTable - Hashtable containing a map of the namespace URIs to prefixes.
149
   * @param soapEnvelopeNamespaceTable - Hashtable containing a map of the namespace URIs to prefixes.
Lines 161-168 Link Here
161
  public final void writeSourceContent(OutputStream os)
201
  public final void writeSourceContent(OutputStream os)
162
  {
202
  {
163
    WSDLOperationElement operElement = (WSDLOperationElement)(getSelectedNavigatorNode().getTreeElement());
203
    WSDLOperationElement operElement = (WSDLOperationElement)(getSelectedNavigatorNode().getTreeElement());
164
    PrintWriter pw = new PrintWriter(os); 
204
    PrintWriter pw = new PrintWriter(os);
165
    pw.println(operElement.getPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT));
205
    if (isHeader_)
206
      pw.println(operElement.getPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT_HEADER));
207
    else
208
   	  pw.println(operElement.getPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT));
166
    pw.close();
209
    pw.close();
167
  }
210
  }
168
}
211
}
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/actions/InvokeWSDLSOAPOperationAction.java (-3 / +64 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004 IBM Corporation and others.
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions;
14
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions;
12
15
Lines 46-51 Link Here
46
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.transport.HTTPTransport;
49
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.transport.HTTPTransport;
47
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.util.SoapHelper;
50
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.util.SoapHelper;
48
import org.eclipse.wst.ws.internal.parser.discovery.NetUtils;
51
import org.eclipse.wst.ws.internal.parser.discovery.NetUtils;
52
import org.eclipse.wst.wsdl.binding.soap.SOAPHeader;
49
import org.w3c.dom.Document;
53
import org.w3c.dom.Document;
50
import org.w3c.dom.Element;
54
import org.w3c.dom.Element;
51
55
Lines 116-121 Link Here
116
  }
120
  }
117
121
118
  /**
122
  /**
123
   * Generate a Vector of the elements inside the Soap Header.
124
   * @param soapEnvelopeNamespaceTable - Hashtable containing a map of the namespace URIs to prefixes.
125
   * @param operElement - WSDLOperationElement encapsulating the WSDL operation.
126
   */
127
  protected Vector getHeaderEntries(Hashtable soapEnvelopeNamespaceTable,WSDLOperationElement operElement) throws ParserConfigurationException,Exception
128
  {
129
    Vector headerEntries = new Vector();
130
    
131
    Iterator it = operElement.getSOAPHeaders().iterator();
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
  }
164
  
165
  /**
119
   * Generate a Vector of the elements inside the Soap Body.
166
   * Generate a Vector of the elements inside the Soap Body.
120
   * @param soapEnvelopeNamespaceTable - Hashtable containing a map of the namespace URIs to prefixes.
167
   * @param soapEnvelopeNamespaceTable - Hashtable containing a map of the namespace URIs to prefixes.
121
   * @param operElement - WSDLOperationElement encapsulating the WSDL operation.
168
   * @param operElement - WSDLOperationElement encapsulating the WSDL operation.
Lines 158-166 Link Here
158
205
159
  protected Element getSOAPEnvelope(Hashtable soapEnvelopeNamespaceTable, Vector bodyEntries) throws ParserConfigurationException
206
  protected Element getSOAPEnvelope(Hashtable soapEnvelopeNamespaceTable, Vector bodyEntries) throws ParserConfigurationException
160
  {
207
  {
208
	return getSOAPEnvelope(soapEnvelopeNamespaceTable, null, bodyEntries);
209
  }
210
  
211
  protected Element getSOAPEnvelope(Hashtable soapEnvelopeNamespaceTable, Vector headerEntries, Vector bodyEntries) throws ParserConfigurationException
212
  {
161
    DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
213
    DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
162
    Document doc = XMLUtils.createNewDocument(docBuilder);
214
    Document doc = XMLUtils.createNewDocument(docBuilder);
163
    Element soapEnvelopeElement = SoapHelper.createSoapEnvelopeElement(doc,soapEnvelopeNamespaceTable);
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
    
164
    Element soapBodyElement = SoapHelper.createSoapBodyElement(doc);
224
    Element soapBodyElement = SoapHelper.createSoapBodyElement(doc);
165
    for (int i=0;i<bodyEntries.size();i++)
225
    for (int i=0;i<bodyEntries.size();i++)
166
      soapBodyElement.appendChild(doc.importNode((Element)bodyEntries.elementAt(i),true));
226
      soapBodyElement.appendChild(doc.importNode((Element)bodyEntries.elementAt(i),true));
Lines 205-212 Link Here
205
      // ...
265
      // ...
206
      Hashtable soapEnvelopeNamespaceTable = new Hashtable();
266
      Hashtable soapEnvelopeNamespaceTable = new Hashtable();
207
      SoapHelper.addDefaultSoapEnvelopeNamespaces(soapEnvelopeNamespaceTable);
267
      SoapHelper.addDefaultSoapEnvelopeNamespaces(soapEnvelopeNamespaceTable);
268
      Vector headerEntries = getHeaderEntries(soapEnvelopeNamespaceTable, operElement);
208
      Vector bodyEntries = getBodyEntries(soapEnvelopeNamespaceTable,operElement,bindingElement,serviceElement);
269
      Vector bodyEntries = getBodyEntries(soapEnvelopeNamespaceTable,operElement,bindingElement,serviceElement);
209
      Element soapEnvelope = getSOAPEnvelope(soapEnvelopeNamespaceTable, bodyEntries);
270
      Element soapEnvelope = getSOAPEnvelope(soapEnvelopeNamespaceTable, headerEntries, bodyEntries);
210
      recordSoapRequest(wsdlPerspective.getSOAPRequestQueue(),soapEnvelopeNamespaceTable,soapEnvelope);
271
      recordSoapRequest(wsdlPerspective.getSOAPRequestQueue(),soapEnvelopeNamespaceTable,soapEnvelope);
211
272
212
      // Execute the SOAP operation.
273
      // Execute the SOAP operation.
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/actions/InvokeWSDLSOAPOperationFormAction.java (-3 / +25 lines)
Lines 1-16 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004 IBM Corporation and others.
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions;
14
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions;
12
15
13
import java.util.Iterator;
16
import java.util.Iterator;
17
import javax.wsdl.Message;
14
import javax.wsdl.Part;
18
import javax.wsdl.Part;
15
import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer;
19
import org.eclipse.wst.ws.internal.explorer.platform.engine.transformer.ITransformer;
16
import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller;
20
import org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller;
Lines 22-27 Link Here
22
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IFragment;
26
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IFragment;
23
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.WSDLPerspective;
27
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.WSDLPerspective;
24
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.transformer.FragmentTransformer;
28
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.transformer.FragmentTransformer;
29
import org.eclipse.wst.wsdl.binding.soap.SOAPHeader;
25
30
26
public class InvokeWSDLSOAPOperationFormAction extends InvokeWSDLSOAPOperationAction
31
public class InvokeWSDLSOAPOperationFormAction extends InvokeWSDLSOAPOperationAction
27
{
32
{
Lines 40-46 Link Here
40
      WSDLPerspective wsdlPerspective = controller_.getWSDLPerspective();
45
      WSDLPerspective wsdlPerspective = controller_.getWSDLPerspective();
41
      MessageQueue messageQueue = wsdlPerspective.getMessageQueue();
46
      MessageQueue messageQueue = wsdlPerspective.getMessageQueue();
42
      WSDLOperationElement operElement = (WSDLOperationElement) getSelectedNavigatorNode().getTreeElement();
47
      WSDLOperationElement operElement = (WSDLOperationElement) getSelectedNavigatorNode().getTreeElement();
43
      Iterator it = operElement.getOrderedBodyParts().iterator();
48
      
49
      // validate headers
50
      Iterator it = operElement.getSOAPHeaders().iterator();      
51
	  while (it.hasNext())
52
      {
53
        SOAPHeader soapHeader = (SOAPHeader) it.next();        
54
        IFragment frag = operElement.getHeaderFragment(soapHeader);
55
        if (!frag.processParameterValues(parser))
56
        {
57
          Message message = soapHeader.getMessage();
58
          Part part = soapHeader.getPart();        	
59
          messageQueue.addMessage(wsdlPerspective.getMessage("MSG_ERROR_VALIDATING_PARAMETER", message.getQName() + " " + part.getName()));
60
          resultsValid = false;
61
        }
62
      }
63
      
64
      // validate body
65
      it = operElement.getOrderedBodyParts().iterator();
44
      while (it.hasNext())
66
      while (it.hasNext())
45
      {
67
      {
46
        Part part = (Part) it.next();
68
        Part part = (Part) it.next();
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/actions/SynchronizeFragmentViewsAction.java (-10 / +95 lines)
Lines 1-15 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2004 IBM Corporation and others.
2
 * Copyright (c) 2004, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions;
14
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.actions;
12
15
16
import java.util.Hashtable;
13
import java.util.Iterator;
17
import java.util.Iterator;
14
import java.util.Vector;
18
import java.util.Vector;
15
import javax.wsdl.Part;
19
import javax.wsdl.Part;
Lines 22-28 Link Here
22
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.WSDLModelConstants;
26
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.WSDLModelConstants;
23
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.WSDLOperationElement;
27
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.WSDLOperationElement;
24
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment;
28
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment;
29
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.SOAPHeaderWrapperFragment;
25
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.InvokeWSDLOperationTool;
30
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.InvokeWSDLOperationTool;
31
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.util.SoapHelper;
32
import org.eclipse.wst.wsdl.binding.soap.SOAPHeader;
26
import org.w3c.dom.Element;
33
import org.w3c.dom.Element;
27
import org.w3c.dom.NodeList;
34
import org.w3c.dom.NodeList;
28
35
Lines 38-64 Link Here
38
    super.processParsedResults(parser);
45
    super.processParsedResults(parser);
39
    Node selectedNode = getSelectedNavigatorNode();
46
    Node selectedNode = getSelectedNavigatorNode();
40
    WSDLOperationElement operElement = (WSDLOperationElement)selectedNode.getTreeElement();
47
    WSDLOperationElement operElement = (WSDLOperationElement)selectedNode.getTreeElement();
41
    Iterator it = operElement.getOrderedBodyParts().iterator();
48
    
42
    InvokeWSDLOperationTool invokeWSDLOperationTool = (InvokeWSDLOperationTool)(selectedNode.getCurrentToolManager().getSelectedTool());
49
    InvokeWSDLOperationTool invokeWSDLOperationTool = (InvokeWSDLOperationTool)(selectedNode.getCurrentToolManager().getSelectedTool());
43
    String viewID = parser.getParameter(FragmentConstants.FRAGMENT_VIEW_ID);
50
    String viewID = parser.getParameter(FragmentConstants.FRAGMENT_VIEW_ID);
44
    propertyTable_.put(FragmentConstants.FRAGMENT_VIEW_ID, viewID);
51
    propertyTable_.put(FragmentConstants.FRAGMENT_VIEW_ID, viewID);
45
    if (viewID.equals(FragmentConstants.FRAGMENT_VIEW_SWITCH_FORM_TO_SOURCE))
52
    if (viewID.equals(FragmentConstants.FRAGMENT_VIEW_SWITCH_FORM_TO_SOURCE))
46
    {
53
    {
47
      invokeWSDLOperationTool.setFragmentViewID(FragmentConstants.FRAGMENT_VIEW_SWITCH_FORM_TO_SOURCE);
54
      invokeWSDLOperationTool.setFragmentViewID(FragmentConstants.FRAGMENT_VIEW_SWITCH_FORM_TO_SOURCE);
48
      return processFormViewParsedResults(parser, operElement, it);
55
      return processFormViewParsedResultsHeader(parser, operElement) &		// need to process both header and body 
56
             processFormViewParsedResults(parser, operElement);
49
    }
57
    }
50
    else
58
    else
51
    {
59
    {
52
      invokeWSDLOperationTool.setFragmentViewID(FragmentConstants.FRAGMENT_VIEW_SWITCH_SOURCE_TO_FORM);
60
      invokeWSDLOperationTool.setFragmentViewID(FragmentConstants.FRAGMENT_VIEW_SWITCH_SOURCE_TO_FORM);
53
      return processSourceViewParsedResults(parser, operElement, it);
61
      return processSourceViewParsedResultsHeader(parser, operElement) &	// need to process both header and body
62
      		 processSourceViewParsedResults(parser, operElement);
54
    }
63
    }
55
  }
64
  }
56
65
57
  private boolean processFormViewParsedResults(MultipartFormDataParser parser, WSDLOperationElement operElement, Iterator it) throws MultipartFormDataException
66
  private boolean processFormViewParsedResultsHeader(MultipartFormDataParser parser, WSDLOperationElement operElement) throws MultipartFormDataException
67
  { 
68
	operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT_HEADER, null);	
69
	boolean resultsValid = true;
70
	    
71
	Iterator it = operElement.getSOAPHeaders().iterator();
72
	while (it.hasNext())
73
	{
74
	  SOAPHeader soapHeader = (SOAPHeader) it.next();        
75
	  IXSDFragment frag = operElement.getHeaderFragment(soapHeader);
76
	  if (!frag.processParameterValues(parser))
77
        resultsValid = false;
78
	}
79
	if (resultsValid)
80
	  operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT_HEADER,null);
81
    return resultsValid;
82
  }
83
  
84
  private boolean processFormViewParsedResults(MultipartFormDataParser parser, WSDLOperationElement operElement) throws MultipartFormDataException
58
  {
85
  {
59
    operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT, null);
86
    operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT, null);
60
    operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT_NAMESPACE, null);
87
    operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT_NAMESPACE, null);
61
    boolean resultsValid = true;
88
    boolean resultsValid = true;
89
	
90
    Iterator it = operElement.getOrderedBodyParts().iterator();    
62
    while (it.hasNext())
91
    while (it.hasNext())
63
    {
92
    {
64
      Part part = (Part)it.next();
93
      Part part = (Part)it.next();
Lines 71-84 Link Here
71
    return resultsValid;
100
    return resultsValid;
72
  }
101
  }
73
102
74
  private boolean processSourceViewParsedResults(MultipartFormDataParser parser, WSDLOperationElement operElement, Iterator it) throws MultipartFormDataException
103
  private boolean processSourceViewParsedResultsHeader(MultipartFormDataParser parser, WSDLOperationElement operElement) throws MultipartFormDataException
104
  { 
105
    String sourceContent = parser.getParameter(FragmentConstants.SOURCE_CONTENT_HEADER);
106
    if (sourceContent != null)
107
      operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT_HEADER, sourceContent);    
108
    String[] nsDeclarations = parser.getParameterValues(FragmentConstants.SOURCE_CONTENT_NAMESPACE);    
109
    if (nsDeclarations != null)
110
      operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT_NAMESPACE,nsDeclarations);
111
    
112
    Iterator it = operElement.getSOAPHeaders().iterator();
113
    if (!it.hasNext())
114
      return true;
115
              
116
    Hashtable namespaceTable = new Hashtable();
117
    
118
    if (nsDeclarations != null) {
119
      for (int i = 0; i < nsDeclarations.length; i++)
120
      {
121
        String[] prefix_ns = SoapHelper.decodeNamespaceDeclaration(nsDeclarations[i]);
122
        if (!namespaceTable.contains(prefix_ns[1]))
123
          namespaceTable.put(prefix_ns[1], prefix_ns[0]);
124
      }
125
    }
126
    
127
    sourceContent = addRootElement(sourceContent);
128
    try
129
    {
130
      Element sourceElements = XMLUtils.stringToElement(sourceContent);
131
      NodeList nl = sourceElements.getChildNodes();
132
  
133
      Hashtable elements = new Hashtable();
134
      
135
      // work backwards so that if there are multiple nodes with the same name
136
      // the topmost one takes precedence
137
      for (int i = nl.getLength() - 1; i >= 0; i--) {
138
    	  org.w3c.dom.Node node = nl.item(i);
139
          if (node != null && node instanceof Element)
140
        	  elements.put(node.getNodeName(), node);
141
      }      
142
      
143
      boolean sourceElementsValid = true;
144
      while (it.hasNext())
145
      {
146
        SOAPHeader soapHeader = (SOAPHeader)it.next();
147
        SOAPHeaderWrapperFragment frag = (SOAPHeaderWrapperFragment) operElement.getHeaderFragment(soapHeader);
148
        if (!frag.setParameterValuesFromInstanceDocuments(elements, namespaceTable))
149
          sourceElementsValid = false;
150
      }
151
      return sourceElementsValid;
152
    }
153
    catch (Throwable t)
154
    {
155
      return false;
156
    }    
157
  }
158
  
159
  private boolean processSourceViewParsedResults(MultipartFormDataParser parser, WSDLOperationElement operElement) throws MultipartFormDataException
75
  {
160
  {
76
    String sourceContent = parser.getParameter(FragmentConstants.SOURCE_CONTENT);
161
    String sourceContent = parser.getParameter(FragmentConstants.SOURCE_CONTENT);
77
    if (sourceContent != null)
162
    if (sourceContent != null)
78
      operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT, sourceContent);
163
      operElement.setPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT, sourceContent);
79
    String[] nsDeclarations = parser.getParameterValues(FragmentConstants.SOURCE_CONTENT_NAMESPACE);
164
    
80
    if (nsDeclarations != null)
165
    Iterator it = operElement.getOrderedBodyParts().iterator();    
81
      operElement.setPropertyAsObject(WSDLModelConstants.PROP_SOURCE_CONTENT_NAMESPACE,nsDeclarations);
166
    
82
    sourceContent = addRootElement(sourceContent);
167
    sourceContent = addRootElement(sourceContent);
83
    try
168
    try
84
    {
169
    {
(-)wsexplorer/wsdl/fragment/XSDElementWFragmentJSP.jsp (-15 / +15 lines)
Lines 1-18 Link Here
1
<%
1
<%
2
/**
2
/*******************************************************************************
3
* <copyright>
3
 * Copyright (c) 2002, 2007 IBM Corporation and others.
4
*
4
 * All rights reserved. This program and the accompanying materials
5
* Licensed Material - Property of IBM
5
 * are made available under the terms of the Eclipse Public License v1.0
6
* (C) Copyright IBM Corp. 2002 - All Rights Reserved.
6
 * which accompanies this distribution, and is available at
7
* US Government Users Restricted Rights - Use, duplication or disclosure
7
 * http://www.eclipse.org/legal/epl-v10.html
8
* restricted by GSA ADP Schedule Contract with IBM Corp.
8
 * 
9
*
9
 * Contributors:
10
* </copyright>
10
 * IBM Corporation - initial API and implementation
11
*
11
 * yyyymmdd bug      Email and other contact information
12
* File plugins/com.ibm.etools.webservice.explorer/wsexplorer/wsdl/fragment/XSDDelegationWFragmentJSP.jsp, wsa.etools.ws.explorer, lunar-5.1.2, 20031231a 1
12
 * -------- -------- -----------------------------------------------------------
13
* Version 1.1 03/02/28 15:34:04
13
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
14
*/
14
 *******************************************************************************/
15
%>
15
 %>
16
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
16
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
17
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.*,
17
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.*,
18
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.*,
18
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.*,
Lines 38-44 Link Here
38
38
39
 
39
 
40
40
41
<table  cellpadding=0 cellspacing=0 class="<%=("innerfixfragtable")%>">
41
<table  cellpadding=0 cellspacing=0 class="<%=(xsdConfig.getIsWSDLPart() ? "fixfragtable" : "innerfixfragtable")%>">
42
  <tr>
42
  <tr>
43
    <td>
43
    <td>
44
      <jsp:include page="<%=delegationFragment.getWriteFragment()%>" flush="true"/>
44
      <jsp:include page="<%=delegationFragment.getWriteFragment()%>" flush="true"/>
(-)wsexplorer/wsdl/forms/FragmentsFormView.jsp (-3 / +68 lines)
Lines 1-13 Link Here
1
<%
1
<%
2
/*******************************************************************************
2
/*******************************************************************************
3
 * Copyright (c) 2001, 2004 IBM Corporation and others.
3
 * Copyright (c) 2001, 2007 IBM Corporation and others.
4
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
8
 * 
9
 * Contributors:
9
 * Contributors:
10
 *     IBM Corporation - initial API and implementation
10
 * IBM Corporation - initial API and implementation
11
 * yyyymmdd bug      Email and other contact information
12
 * -------- -------- -----------------------------------------------------------
13
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
11
 *******************************************************************************/
14
 *******************************************************************************/
12
%>
15
%>
13
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
16
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
Lines 16-21 Link Here
16
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.*,
19
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.*,
17
                                                        org.eclipse.wst.ws.internal.explorer.platform.constants.*,
20
                                                        org.eclipse.wst.ws.internal.explorer.platform.constants.*,
18
                                                        org.eclipse.wst.ws.internal.explorer.platform.perspective.*,
21
                                                        org.eclipse.wst.ws.internal.explorer.platform.perspective.*,
22
                                                        org.eclipse.wst.wsdl.binding.soap.SOAPHeader,
19
                                                        javax.wsdl.*,
23
                                                        javax.wsdl.*,
20
                                                        java.util.*" %>
24
                                                        java.util.*" %>
21
25
Lines 30-36 Link Here
30
nodeID.append(selectedNode.getNodeId());
34
nodeID.append(selectedNode.getNodeId());
31
InvokeWSDLOperationTool invokeWSDLOperationTool = (InvokeWSDLOperationTool)(selectedNode.getCurrentToolManager().getSelectedTool());
35
InvokeWSDLOperationTool invokeWSDLOperationTool = (InvokeWSDLOperationTool)(selectedNode.getCurrentToolManager().getSelectedTool());
32
WSDLOperationElement operElement = (WSDLOperationElement)selectedNode.getTreeElement();
36
WSDLOperationElement operElement = (WSDLOperationElement)selectedNode.getTreeElement();
33
Iterator it = operElement.getOrderedBodyParts().iterator();
37
38
Iterator it = operElement.getSOAPHeaders().iterator();
39
40
if (it.hasNext()) {
41
	String headerDivId = "Header";
42
	String headerImgId = "xHeader";
43
    %>
44
	<table border=0 cellpadding=6 cellspacing=0>
45
	  <tr>
46
	    <td height=20 valign="bottom" align="left" nowrap width=11><a href="javascript:twist('<%=headerDivId%>','<%=headerImgId%>')"><img name="<%=headerImgId%>" src="<%=response.encodeURL(controller.getPathWithContext("images/twistopened.gif"))%>" alt="<%=controller.getMessage("ALT_TWIST_OPENED")%>" class="twist"></a></td>
47
	    <td height=20 valign="bottom" align="left" nowrap class="labels"><strong><%=wsdlPerspective.getMessage("FORM_LABEL_HEADER")%></strong></td>
48
	  </tr>
49
	</table>
50
	
51
	<table width="95%" border=0 cellpadding=0 cellspacing=0>
52
	  <tr>
53
	    <td valign="top" height=10><img src="<%=response.encodeURL(controller.getPathWithContext("images/keyline.gif"))%>" height=2 width="100%"></td>
54
	  </tr>
55
	</table>
56
	
57
	<div id="<%=headerDivId%>">
58
	<%
59
	while (it.hasNext()) {
60
	  SOAPHeader soapHeader = (SOAPHeader) it.next();
61
	  IXSDFragment frag = operElement.getHeaderFragment(soapHeader);	   
62
	  fragID.delete(0, fragID.length());
63
	  fragID.append(frag.getID());
64
	  %>
65
	  <jsp:include page="<%=frag.getWriteFragment()%>" flush="true"/>
66
	  <%  
67
	}
68
	%>
69
	</div>
70
    <%    
71
}
72
73
boolean hasInput = Boolean.parseBoolean(request.getParameter("hasInput"));
74
String bodyDivId = "Body";
75
76
if (hasInput) {
77
	String bodyImgId = "xBody";
78
    %>
79
	<table border=0 cellpadding=6 cellspacing=0>
80
	  <tr>
81
	    <td height=20 valign="bottom" align="left" nowrap width=11><a href="javascript:twist('<%=bodyDivId%>','<%=bodyImgId%>')"><img name="<%=bodyImgId%>" src="<%=response.encodeURL(controller.getPathWithContext("images/twistopened.gif"))%>" alt="<%=controller.getMessage("ALT_TWIST_OPENED")%>" class="twist"></a></td>
82
	    <td height=20 valign="bottom" align="left" nowrap class="labels"><strong><%=wsdlPerspective.getMessage("FORM_LABEL_BODY")%></strong></td>
83
	  </tr>
84
	</table> 
85
	
86
	<table width="95%" border=0 cellpadding=0 cellspacing=0>
87
	  <tr>
88
	    <td valign="top" height=10><img src="<%=response.encodeURL(controller.getPathWithContext("images/keyline.gif"))%>" height=2 width="100%"></td>
89
	  </tr>
90
	</table>
91
    <%
92
}
93
%>
94
95
<div id="<%=bodyDivId%>" class="fragarea">
96
<%
97
it = operElement.getOrderedBodyParts().iterator();
34
while (it.hasNext()) {
98
while (it.hasNext()) {
35
  Part part = (Part)it.next();
99
  Part part = (Part)it.next();
36
  IXSDFragment frag = operElement.getFragment(part);
100
  IXSDFragment frag = operElement.getFragment(part);
Lines 41-43 Link Here
41
  <%
105
  <%
42
}
106
}
43
%>
107
%>
108
</div>
(-)wsexplorer/wsdl/forms/FragmentsSoapView.jsp (-7 / +122 lines)
Lines 1-6 Link Here
1
<%
1
<%
2
/*******************************************************************************
2
/*******************************************************************************
3
 * Copyright (c) 2001, 2004 IBM Corporation and others.
3
 * Copyright (c) 2001, 2007 IBM Corporation and others.
4
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
6
 * which accompanies this distribution, and is available at
Lines 12-17 Link Here
12
 * -------- -------- -----------------------------------------------------------
12
 * -------- -------- -----------------------------------------------------------
13
 * 20060222   127443 jesper@selskabet.org - Jesper S Moller
13
 * 20060222   127443 jesper@selskabet.org - Jesper S Moller
14
 * 20060726   144824 mahutch@ca.ibm.com - Mark Hutchinson
14
 * 20060726   144824 mahutch@ca.ibm.com - Mark Hutchinson
15
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
15
 *******************************************************************************/
16
 *******************************************************************************/
16
%>
17
%>
17
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
18
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
Lines 21-26 Link Here
21
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.util.*,
22
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.util.*,
22
                                                        org.eclipse.wst.ws.internal.explorer.platform.constants.*,
23
                                                        org.eclipse.wst.ws.internal.explorer.platform.constants.*,
23
                                                        org.eclipse.wst.ws.internal.explorer.platform.util.*,
24
                                                        org.eclipse.wst.ws.internal.explorer.platform.util.*,
25
                                                        org.eclipse.wst.wsdl.binding.soap.SOAPHeader,
24
                                                        org.w3c.dom.*,
26
                                                        org.w3c.dom.*,
25
                                                        javax.wsdl.*,
27
                                                        javax.wsdl.*,
26
                                                        javax.wsdl.extensions.ExtensibilityElement,
28
                                                        javax.wsdl.extensions.ExtensibilityElement,
Lines 33-43 Link Here
33
   WSDLPerspective wsdlPerspective = controller.getWSDLPerspective();
35
   WSDLPerspective wsdlPerspective = controller.getWSDLPerspective();
34
   WSDLOperationElement operElement = (WSDLOperationElement)(wsdlPerspective.getNodeManager().getSelectedNode().getTreeElement());
36
   WSDLOperationElement operElement = (WSDLOperationElement)(wsdlPerspective.getNodeManager().getSelectedNode().getTreeElement());
35
   Operation oper = operElement.getOperation();
37
   Operation oper = operElement.getOperation();
36
   Iterator it = operElement.getOrderedBodyParts().iterator();
37
   StringBuffer sourceContent = new StringBuffer();
38
   String cachedSourceContent = operElement.getPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT);
39
   Hashtable soapEnvelopeNamespaceTable = new Hashtable();
38
   Hashtable soapEnvelopeNamespaceTable = new Hashtable();
40
   SoapHelper.addDefaultSoapEnvelopeNamespaces(soapEnvelopeNamespaceTable);
39
   SoapHelper.addDefaultSoapEnvelopeNamespaces(soapEnvelopeNamespaceTable);
40
   
41
   Iterator it = operElement.getSOAPHeaders().iterator();
42
   StringBuffer sourceContentHeader = new StringBuffer();
43
   String cachedSourceContent = operElement.getPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT_HEADER);
44
   if (cachedSourceContent != null)   
45
     sourceContentHeader.append(cachedSourceContent);        
46
   else
47
   {
48
     while (it.hasNext())
49
     {
50
       SOAPHeader soapHeader = (SOAPHeader)it.next();
51
       IXSDFragment frag = operElement.getHeaderFragment(soapHeader);
52
       Element[] instanceDocuments = frag.genInstanceDocumentsFromParameterValues(!operElement.isUseLiteral(), soapEnvelopeNamespaceTable, XMLUtils.createNewDocument(null));
53
       for (int i = 0; i < instanceDocuments.length; i++)
54
       {
55
    	 String serializedFragment = XMLUtils.serialize(instanceDocuments[i], true);
56
		 if (serializedFragment == null)
57
		 {
58
			 // On Some JRE's (Sun java 5) elements with an attribute with the xsi
59
			 // prefix do not serialize properly because the namespace can not
60
			 // be found so the string returned comes back as null. To workaround
61
			 // this problem try adding in the namespace declaration attribute
62
			 // and retry the serialization (bug 144824)			 
63
			 instanceDocuments[i].setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");
64
			 serializedFragment = XMLUtils.serialize(instanceDocuments[i], true);
65
		 }
66
    	 
67
    	 sourceContentHeader.append(serializedFragment);
68
         sourceContentHeader.append(HTMLUtils.LINE_SEPARATOR);
69
       }     
70
     }
71
   }
72
   
73
   it = operElement.getOrderedBodyParts().iterator();
74
   StringBuffer sourceContent = new StringBuffer();
75
   cachedSourceContent = operElement.getPropertyAsString(WSDLModelConstants.PROP_SOURCE_CONTENT);
41
   if (cachedSourceContent != null)
76
   if (cachedSourceContent != null)
42
   {
77
   {
43
     sourceContent.append(cachedSourceContent);
78
     sourceContent.append(cachedSourceContent);
Lines 129-134 Link Here
129
<%
164
<%
130
    }
165
    }
131
166
167
    Element soapHeaderElement = SoapHelper.createSoapHeaderElement(doc);
168
    header.setLength(0);
169
    header.append('<').append(soapHeaderElement.getTagName());
170
    attributes = soapHeaderElement.getAttributes();
171
    numberOfAttributes = attributes.getLength();
172
    if (numberOfAttributes == 0)
173
      header.append('>');
174
%>
175
<table width="95%" border=0 cellpadding=0 cellspacing=0>
176
  <tr>
177
    <td width=8>
178
      <img width=8 height=16 src="<%=response.encodeURL(controller.getPathWithContext("images/space.gif"))%>">
179
    </td>
180
    <td valign="bottom" class="labels">
181
      <%=HTMLUtils.charactersToHTMLEntities(header.toString())%>
182
    </td>
183
  </tr>
184
</table>
185
<%
186
    for (int i=0;i<numberOfAttributes;i++)
187
    {
188
      header.setLength(0);
189
      Node attrNode = attributes.item(i);
190
      header.append(attrNode.getNodeName()).append("=\"").append(attrNode.getNodeValue()).append('\"');
191
      if (i == numberOfAttributes-1)
192
        header.append('>');
193
%>
194
<table width="95%" border=0 cellpadding=0 cellspacing=0>
195
  <tr>
196
    <td width=16>
197
      <img width=16 height=16 src="<%=response.encodeURL(controller.getPathWithContext("images/space.gif"))%>">
198
    </td>
199
    <td valign="bottom" class="labels">
200
      <%=HTMLUtils.charactersToHTMLEntities(header.toString())%>
201
    </td>
202
  </tr>
203
</table>
204
<%
205
    }
206
%>
207
<table border=0 cellpadding=3 cellspacing=3>
208
  <tr>
209
    <td width="16">
210
      <img width="16" height=16 src="<%=response.encodeURL(controller.getPathWithContext("images/space.gif"))%>">
211
    </td>    
212
    <td valign="center" align="left" nowrap>
213
      <input type="file" name="<%=WSDLActionInputs.SELECTED_FILE_HEADER%>" title="<%=wsdlPerspective.getMessage("FORM_CONTROL_TITLE_SOAP_FILE")%>">
214
    </td>
215
    <td valign="center" align="left" class="labels" nowrap>
216
      <a href="javascript:doAction('<%=WSDLActionInputs.SUBMISSION_ACTION_BROWSE_FILE_HEADER%>')"><%=wsdlPerspective.getMessage("BUTTON_LABEL_LOAD")%></a>
217
    </td>
218
    <td valign="center" align="left" class="labels" nowrap>
219
      <a href="javascript:doAction('<%=WSDLActionInputs.SUBMISSION_ACTION_SAVE_AS_HEADER%>')"><%=wsdlPerspective.getMessage("BUTTON_LABEL_SAVE_AS")%></a>
220
    </td>
221
  </tr>
222
</table>
223
<table width="95%" border=0 cellpadding=3 cellspacing=3>
224
  <tr>
225
    <td width="16">
226
      <img width="16" height="16" src="<%=response.encodeURL(controller.getPathWithContext("images/space.gif"))%>">
227
    </td>
228
    <td width="100%">
229
      <textarea id="soap_header_content" name="<%=FragmentConstants.SOURCE_CONTENT_HEADER%>" class="textareaenter"><%=HTMLUtils.charactersToHTMLEntitiesStrict(sourceContentHeader.toString())%></textarea>
230
    </td>
231
  </tr>
232
</table>
233
<%
234
    header.setLength(0);
235
    header.append("</").append(soapHeaderElement.getTagName()).append('>');
236
%>
237
<table width="95%" cellpadding=1 cellspacing=0>
238
  <tr>
239
    <td width=8>
240
      <img width=8 height=16 src="<%=response.encodeURL(controller.getPathWithContext("images/space.gif"))%>">
241
    </td>
242
    <td valign="bottom" class="labels">
243
      <%=HTMLUtils.charactersToHTMLEntities(header.toString())%>
244
    </td>
245
  </tr>
246
</table>
247
<%
132
    Element soapBodyElement = SoapHelper.createSoapBodyElement(doc);
248
    Element soapBodyElement = SoapHelper.createSoapBodyElement(doc);
133
    header.setLength(0);
249
    header.setLength(0);
134
    header.append('<').append(soapBodyElement.getTagName());
250
    header.append('<').append(soapBodyElement.getTagName());
Lines 166-172 Link Here
166
    </td>
282
    </td>
167
  </tr>
283
  </tr>
168
</table>
284
</table>
169
<table>
170
<%
285
<%
171
    }
286
    }
172
287
Lines 270-279 Link Here
270
      <input type="file" name="<%=WSDLActionInputs.SELECTED_FILE%>" title="<%=wsdlPerspective.getMessage("FORM_CONTROL_TITLE_SOAP_FILE")%>">
385
      <input type="file" name="<%=WSDLActionInputs.SELECTED_FILE%>" title="<%=wsdlPerspective.getMessage("FORM_CONTROL_TITLE_SOAP_FILE")%>">
271
    </td>
386
    </td>
272
    <td valign="center" align="left" class="labels" nowrap>
387
    <td valign="center" align="left" class="labels" nowrap>
273
      <a href="javascript:showNewFileContents()"><%=wsdlPerspective.getMessage("BUTTON_LABEL_LOAD")%></a>
388
      <a href="javascript:doAction('<%=WSDLActionInputs.SUBMISSION_ACTION_BROWSE_FILE%>')"><%=wsdlPerspective.getMessage("BUTTON_LABEL_LOAD")%></a>
274
    </td>
389
    </td>
275
    <td valign="center" align="left" class="labels" nowrap>
390
    <td valign="center" align="left" class="labels" nowrap>
276
      <a href="javascript:saveSourceContent()"><%=wsdlPerspective.getMessage("BUTTON_LABEL_SAVE_AS")%></a>
391
      <a href="javascript:doAction('<%=WSDLActionInputs.SUBMISSION_ACTION_SAVE_AS%>')"><%=wsdlPerspective.getMessage("BUTTON_LABEL_SAVE_AS")%></a>
277
    </td>
392
    </td>
278
  </tr>
393
  </tr>
279
</table>
394
</table>
(-)wsexplorer/wsdl/forms/InvokeWSDLOperationForm.jsp (-17 / +8 lines)
Lines 1-6 Link Here
1
<%
1
<%
2
/*******************************************************************************
2
/*******************************************************************************
3
 * Copyright (c) 2001, 2006 IBM Corporation and others.
3
 * Copyright (c) 2001, 2007 IBM Corporation and others.
4
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
6
 * which accompanies this distribution, and is available at
Lines 11-16 Link Here
11
 * yyyymmdd bug      Email and other contact information
11
 * yyyymmdd bug      Email and other contact information
12
 * -------- -------- -----------------------------------------------------------
12
 * -------- -------- -----------------------------------------------------------
13
 * 20060512   121210 mahutch@ca.ibm.com - Mark Hutchinson
13
 * 20060512   121210 mahutch@ca.ibm.com - Mark Hutchinson
14
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers 
14
 *******************************************************************************/
15
 *******************************************************************************/
15
%>
16
%>
16
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
17
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
Lines 43-66 Link Here
43
<jsp:include page="/wsdl/scripts/fragmenttables.jsp" flush="true"/>
44
<jsp:include page="/wsdl/scripts/fragmenttables.jsp" flush="true"/>
44
<jsp:include page="/wsdl/scripts/wsdlpanes.jsp" flush="true"/>
45
<jsp:include page="/wsdl/scripts/wsdlpanes.jsp" flush="true"/>
45
<script language="javascript">
46
<script language="javascript">
46
  function showNewFileContents()
47
  function doAction(action)
47
  {
48
  {
48
    var form = document.forms[0];
49
    var form = document.forms[0];
49
    if (handleSubmit(form))
50
    if (handleSubmit(form))
50
    {
51
    {
51
      form.<%=WSDLActionInputs.SUBMISSION_ACTION%>.value = "<%=WSDLActionInputs.SUBMISSION_ACTION_BROWSE_FILE%>";
52
      form.<%=WSDLActionInputs.SUBMISSION_ACTION%>.value = action;
52
      form.submit();
53
      form.<%=WSDLActionInputs.SUBMISSION_ACTION%>.value = "<%=invokeWSDLOperationURL%>";
54
      resetSubmission();
55
    }
56
  }
57
58
  function saveSourceContent()
59
  {
60
    var form = document.forms[0];
61
    if (handleSubmit(form))
62
    {
63
      form.<%=WSDLActionInputs.SUBMISSION_ACTION%>.value = "<%=WSDLActionInputs.SUBMISSION_ACTION_SAVE_AS%>";
64
      form.submit();
53
      form.submit();
65
      form.<%=WSDLActionInputs.SUBMISSION_ACTION%>.value = "<%=invokeWSDLOperationURL%>";
54
      form.<%=WSDLActionInputs.SUBMISSION_ACTION%>.value = "<%=invokeWSDLOperationURL%>";
66
      resetSubmission();
55
      resetSubmission();
Lines 153-159 Link Here
153
				}
142
				}
154
			} 
143
			} 
155
      	}
144
      	}
156
		if (hasInput)
145
		if (hasInput || !operElement.getSOAPHeaders().isEmpty())
157
		{
146
		{
158
			out.print(wsdlPerspective.getMessage("FORM_LABEL_INVOKE_WSDL_OPERATION_DESC"));
147
			out.print(wsdlPerspective.getMessage("FORM_LABEL_INVOKE_WSDL_OPERATION_DESC"));
159
		}
148
		}
Lines 206-212 Link Here
206
    else
195
    else
207
    {
196
    {
208
    %>
197
    %>
209
<jsp:include page="/wsdl/forms/FragmentsFormView.jsp" flush="true"/>
198
<jsp:include page="/wsdl/forms/FragmentsFormView.jsp" flush="true">
199
	<jsp:param name="hasInput" value="<%=hasInput%>"/>
200
</jsp:include>
210
    <%
201
    <%
211
    }
202
    }
212
    %>
203
    %>
(-)wsexplorer/wsdl/forms/ReadOnlyFragmentsFormView.jsp (-27 / +144 lines)
Lines 1-13 Link Here
1
<%
1
<%
2
/*******************************************************************************
2
/*******************************************************************************
3
 * Copyright (c) 2001, 2004 IBM Corporation and others.
3
 * Copyright (c) 2001, 2007 IBM Corporation and others.
4
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
8
 * 
9
 * Contributors:
9
 * Contributors:
10
 *     IBM Corporation - initial API and implementation
10
 * IBM Corporation - initial API and implementation
11
 * yyyymmdd bug      Email and other contact information
12
 * -------- -------- -----------------------------------------------------------
13
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
11
 *******************************************************************************/
14
 *******************************************************************************/
12
%>
15
%>
13
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
16
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
Lines 20-25 Link Here
20
                                                        org.eclipse.wst.ws.internal.explorer.platform.perspective.Node,
23
                                                        org.eclipse.wst.ws.internal.explorer.platform.perspective.Node,
21
                                                        org.eclipse.wst.ws.internal.explorer.platform.perspective.*,
24
                                                        org.eclipse.wst.ws.internal.explorer.platform.perspective.*,
22
                                                        org.eclipse.wst.ws.internal.explorer.platform.util.*,
25
                                                        org.eclipse.wst.ws.internal.explorer.platform.util.*,
26
                                                        org.eclipse.wst.wsdl.binding.soap.SOAPHeader,
23
                                                        org.w3c.dom.*,
27
                                                        org.w3c.dom.*,
24
                                                        javax.wsdl.*,
28
                                                        javax.wsdl.*,
25
                                                        javax.xml.parsers.*,
29
                                                        javax.xml.parsers.*,
Lines 31-36 Link Here
31
35
32
<%!
36
<%!
33
private Element soapResponse_ = null;
37
private Element soapResponse_ = null;
38
private boolean hasSOAPHeaders = false;
39
40
private void checkSOAPHeaders() {
41
	
42
	NodeList nl = soapResponse_.getElementsByTagNameNS(FragmentConstants.URI_SOAP_ENV, FragmentConstants.QNAME_LOCAL_NAME_HEADER);    
43
	if (nl.getLength() == 0)
44
		return;
45
	
46
	Element soapHeader = (Element) nl.item(0);
47
	NodeList nodes = soapHeader.getChildNodes();
48
	
49
	for (int i = 0; i < nodes.getLength(); i++) {
50
	    if (nodes.item(i) instanceof Element) {
51
	    	hasSOAPHeaders = true;
52
	    	return;
53
	    }
54
	}
55
}
34
56
35
private Element[] parseSOAPResponse(SOAPMessageQueue soapMessageQueue, WSDLOperationElement operElement)
57
private Element[] parseSOAPResponse(SOAPMessageQueue soapMessageQueue, WSDLOperationElement operElement)
36
{
58
{
Lines 38-43 Link Here
38
  try
60
  try
39
  {
61
  {
40
    soapResponse_ = XMLUtils.stringToElement(messages, true);
62
    soapResponse_ = XMLUtils.stringToElement(messages, true);
63
    checkSOAPHeaders();
41
    NodeList nl = soapResponse_.getElementsByTagNameNS(FragmentConstants.URI_SOAP_ENV, FragmentConstants.QNAME_LOCAL_NAME_BODY);
64
    NodeList nl = soapResponse_.getElementsByTagNameNS(FragmentConstants.URI_SOAP_ENV, FragmentConstants.QNAME_LOCAL_NAME_BODY);
42
    if (nl.getLength() > 0)
65
    if (nl.getLength() > 0)
43
    {
66
    {
Lines 168-174 Link Here
168
    SOAPMessageQueue soapMessageQueue = wsdlPerspective.getSOAPResponseQueue();
191
    SOAPMessageQueue soapMessageQueue = wsdlPerspective.getSOAPResponseQueue();
169
    instanceDocuments = parseSOAPResponse(soapMessageQueue, operElement);
192
    instanceDocuments = parseSOAPResponse(soapMessageQueue, operElement);
170
  }
193
  }
171
  if (!cached && instanceDocuments == null)
194
  if (!cached && !hasSOAPHeaders && instanceDocuments == null)
172
  {
195
  {
173
  %>
196
  %>
174
    <table width="95%" border=0 cellpadding=6 cellspacing=0>
197
    <table width="95%" border=0 cellpadding=6 cellspacing=0>
Lines 180-186 Link Here
180
    </table>
203
    </table>
181
  <%
204
  <%
182
  }
205
  }
183
  else if (!cached && instanceDocuments.length <= 0)
206
  else if (!cached && !hasSOAPHeaders && instanceDocuments.length <= 0)
184
  {
207
  {
185
  %>
208
  %>
186
    <table width="95%" border=0 cellpadding=6 cellspacing=0>
209
    <table width="95%" border=0 cellpadding=6 cellspacing=0>
Lines 194-222 Link Here
194
  }
217
  }
195
  else
218
  else
196
  {
219
  {
197
    Map partsMap = oper.getOutput().getMessage().getParts();
220
	String headerDivId = "Header";
198
    Iterator it = partsMap.values().iterator();
221
	String headerImgId = "xHeader";
199
    Hashtable uriReferences = null;
222
	String bodyDivId = "Body";
200
    while (it.hasNext())
223
	String bodyImgId = "xBody";	  
201
    {
224
    %>
202
      IXSDFragment fragment = operElement.getFragment((Part)it.next(), false);
225
    <table border=0 cellpadding=6 cellspacing=0>
203
      if (!cached)
226
	  <tr>
204
      {
227
	    <td height=20 valign="bottom" align="left" nowrap width=11><a href="javascript:twist('<%=headerDivId%>','<%=headerImgId%>')"><img name="<%=headerImgId%>" src="<%=response.encodeURL(controller.getPathWithContext("images/twistopened.gif"))%>" alt="<%=controller.getMessage("ALT_TWIST_OPENED")%>" class="twist"></a></td>
205
        if (!operElement.isUseLiteral() && (fragment instanceof ISOAPEncodingWrapperFragment))
228
	    <td height=20 valign="bottom" align="left" nowrap class="labels"><strong><%=wsdlPerspective.getMessage("FORM_LABEL_HEADER")%></strong></td>
206
        {
229
	  </tr>
207
          if (uriReferences == null)
230
	</table>
208
            uriReferences = SOAPEncodingWrapperFragment.parseURIReferences(soapResponse_, true);
231
	
209
          ((ISOAPEncodingWrapperFragment)fragment).setURIReferences(uriReferences);
232
	<table width="95%" border=0 cellpadding=0 cellspacing=0>
210
        }
233
	  <tr>
211
        fragment.setParameterValuesFromInstanceDocuments(instanceDocuments);
234
	    <td valign="top" height=10><img src="<%=response.encodeURL(controller.getPathWithContext("images/keyline.gif"))%>" height=2 width="100%"></td>
212
      }
235
	  </tr>
213
      fragID.delete(0, fragID.length());
236
	</table>
214
      fragID.append(fragment.getID());
237
	
215
      %>
238
	<div id="<%=headerDivId%>" class="fragarea">
216
      <jsp:include page="<%=fragment.getReadFragment()%>" flush="true"/>
239
	<%
217
      <%
240
	if (cached || hasSOAPHeaders) {
218
    }
241
		hasSOAPHeaders = false;
219
    operElement.setPropertyAsObject(WSDLActionInputs.SOAP_RESPONSE_CACHED, new Boolean(true));
242
		Iterator it = operElement.getSOAPHeaders(false).iterator();
243
		while (it.hasNext()) {
244
			SOAPHeader soapHeader = (SOAPHeader) it.next();			
245
			String ns = soapHeader.getPart().getElementDeclaration().getTargetNamespace();
246
			IXSDFragment frag = operElement.getHeaderFragment(soapHeader, false);
247
			
248
			if (!cached) {
249
				NodeList nl = soapResponse_.getElementsByTagNameNS(ns, frag.getName());
250
				if (nl.getLength() == 0)
251
					continue;
252
				
253
				Element element = (Element) nl.item(0);				
254
				if (!frag.setParameterValuesFromInstanceDocuments(new Element[] { element }))
255
					continue;
256
			}
257
			else if (!frag.validateAllParameterValues())
258
				continue;
259
			
260
			hasSOAPHeaders = true;				
261
			fragID.delete(0, fragID.length());
262
			fragID.append(frag.getID());
263
			%>
264
			<jsp:include page="<%=frag.getReadFragment()%>" flush="true"/>
265
			<%  
266
		}		
267
	}
268
	if (!hasSOAPHeaders) {
269
		%>
270
		<table width="95%" border=0 cellpadding=6 cellspacing=0>
271
	      <tr>
272
	        <td height=20 valign="bottom" align="left" class="labels">
273
	          <%=wsdlPerspective.getMessage("FORM_LABEL_NOTHING_TO_DISPLAY_IN_FORM_VIEW")%>
274
	        </td>
275
	      </tr>
276
	    </table>
277
		<%
278
	}
279
	%>	
280
	</div>	
281
	
282
	<table border=0 cellpadding=6 cellspacing=0>
283
	  <tr>
284
	    <td height=20 valign="bottom" align="left" nowrap width=11><a href="javascript:twist('<%=bodyDivId%>','<%=bodyImgId%>')"><img name="<%=bodyImgId%>" src="<%=response.encodeURL(controller.getPathWithContext("images/twistopened.gif"))%>" alt="<%=controller.getMessage("ALT_TWIST_OPENED")%>" class="twist"></a></td>
285
	    <td height=20 valign="bottom" align="left" nowrap class="labels"><strong><%=wsdlPerspective.getMessage("FORM_LABEL_BODY")%></strong></td>
286
	  </tr>
287
	</table> 
288
	
289
	<table width="95%" border=0 cellpadding=0 cellspacing=0>
290
	  <tr>
291
	    <td valign="top" height=10><img src="<%=response.encodeURL(controller.getPathWithContext("images/keyline.gif"))%>" height=2 width="100%"></td>
292
	  </tr>
293
	</table>
294
	
295
	<div id="<%=bodyDivId%>" class="fragarea">
296
	<%	
297
	if (cached || (instanceDocuments != null && instanceDocuments.length > 0)) {
298
			
299
	    Map partsMap = oper.getOutput().getMessage().getParts();
300
	    Iterator it = partsMap.values().iterator();
301
	    Hashtable uriReferences = null;
302
	    while (it.hasNext())
303
	    {
304
	      IXSDFragment fragment = operElement.getFragment((Part)it.next(), false);
305
	      if (!cached)
306
	      {
307
	        if (!operElement.isUseLiteral() && (fragment instanceof ISOAPEncodingWrapperFragment))
308
	        {
309
	          if (uriReferences == null)
310
	            uriReferences = SOAPEncodingWrapperFragment.parseURIReferences(soapResponse_, true);
311
	          ((ISOAPEncodingWrapperFragment)fragment).setURIReferences(uriReferences);
312
	        }
313
	        fragment.setParameterValuesFromInstanceDocuments(instanceDocuments);
314
	      }
315
	      fragID.delete(0, fragID.length());
316
	      fragID.append(fragment.getID());
317
	      %>
318
	      <jsp:include page="<%=fragment.getReadFragment()%>" flush="true"/>
319
	      <%
320
	    }
321
	    operElement.setPropertyAsObject(WSDLActionInputs.SOAP_RESPONSE_CACHED, new Boolean(true));
322
	}
323
	else {
324
		%>
325
		<table width="95%" border=0 cellpadding=6 cellspacing=0>
326
	      <tr>
327
	        <td height=20 valign="bottom" align="left" class="labels">
328
	          <%=wsdlPerspective.getMessage("FORM_LABEL_NOTHING_TO_DISPLAY_IN_FORM_VIEW")%>
329
	        </td>
330
	      </tr>
331
	    </table>
332
		<%
333
	} 
334
    %>
335
    </div>
336
    <%
220
  }
337
  }
221
}
338
}
222
%>
339
%>
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/datamodel/WSDLOperationElement.java (-2 / +82 lines)
Lines 1-17 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2004 IBM Corporation and others.
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel;
14
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel;
12
15
16
import java.util.Hashtable;
13
import java.util.Iterator;
17
import java.util.Iterator;
14
import java.util.List;
18
import java.util.List;
19
import java.util.Map;
15
import java.util.Vector;
20
import java.util.Vector;
16
import javax.wsdl.Binding;
21
import javax.wsdl.Binding;
17
import javax.wsdl.BindingInput;
22
import javax.wsdl.BindingInput;
Lines 29-35 Link Here
29
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment;
34
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment;
30
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration;
35
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentConfiguration;
31
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController;
36
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.XSDToFragmentController;
37
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.SOAPHeaderWrapperFragment;
32
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper;
38
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.xsd.WSDLPartsToXSDTypeMapper;
39
import org.eclipse.wst.wsdl.binding.soap.SOAPHeader;
33
import org.eclipse.xsd.XSDNamedComponent;
40
import org.eclipse.xsd.XSDNamedComponent;
34
41
35
public class WSDLOperationElement extends WSDLCommonElement
42
public class WSDLOperationElement extends WSDLCommonElement
Lines 48-53 Link Here
48
  private String encodingStyle_;
55
  private String encodingStyle_;
49
  private String encodingNamespace_;
56
  private String encodingNamespace_;
50
57
58
  private Map headerCache = new Hashtable();
59
  
51
  private final void gatherSoapInformation(WSDLBindingElement bindingElement,SOAPBinding soapBinding)
60
  private final void gatherSoapInformation(WSDLBindingElement bindingElement,SOAPBinding soapBinding)
52
  {
61
  {
53
    // Initialize defaults.
62
    // Initialize defaults.
Lines 151-156 Link Here
151
    return bindingOperation;
160
    return bindingOperation;
152
  }
161
  }
153
162
163
  /**
164
   * Return a list of input headers.
165
   * 
166
   * @return A List
167
   */
168
  public List getSOAPHeaders() {
169
	  return getSOAPHeaders(true);
170
  }
171
	  
172
  /**
173
   * Return a list of headers.
174
   * 
175
   * @param isInput If true, returns the input headers.  If false, returns the output headers.
176
   * @return A List
177
   */
178
  public List getSOAPHeaders(boolean isInput) {
179
	  List headers = new Vector();
180
	
181
      BindingOperation bindingOperation = getBindingOperation();
182
	  List extensibilityElements = isInput ?
183
			bindingOperation.getBindingInput().getExtensibilityElements() : 
184
			bindingOperation.getBindingOutput().getExtensibilityElements();	  	  
185
	  
186
	  for (Iterator it = extensibilityElements.iterator(); it.hasNext();) {
187
	      
188
		  ExtensibilityElement e = (ExtensibilityElement) it.next();
189
	      
190
	      if (e instanceof SOAPHeader && !headers.contains(e))	    	 
191
    		  headers.add(e);
192
	  }   
193
	  
194
	  return headers;
195
  }  
196
  
154
  public List getOrderedBodyParts()
197
  public List getOrderedBodyParts()
155
  {
198
  {
156
    List parts = new Vector(operation_.getInput().getMessage().getOrderedParts(operation_.getParameterOrdering()));
199
    List parts = new Vector(operation_.getInput().getMessage().getOrderedParts(operation_.getParameterOrdering()));
Lines 200-205 Link Here
200
    return wsdlPartsToXsdTypeMapper_.getXSDType(part, id);
243
    return wsdlPartsToXsdTypeMapper_.getXSDType(part, id);
201
  }
244
  }
202
245
246
  public IXSDFragment getHeaderFragment(SOAPHeader soapHeader) {
247
	return getHeaderFragment(soapHeader, true);
248
  }
249
  
250
  public IXSDFragment getHeaderFragment(SOAPHeader soapHeader, boolean isInput) {
251
	StringBuffer id = new StringBuffer();
252
	Part part = soapHeader.getPart();
253
	if (isInput)
254
	  id.append(FragmentConstants.INPUT_ID).append(soapHeader.getMessage().getQName()).append(FragmentConstants.PART_TOKEN);
255
	else
256
	  id.append(FragmentConstants.OUTPUT_ID).append(soapHeader.getMessage().getQName()).append(FragmentConstants.PART_TOKEN);
257
	
258
	return getFragment(part, id, isInput); // only wrap input header fragments
259
  }
260
  
203
  public IXSDFragment getFragment(Part part) {
261
  public IXSDFragment getFragment(Part part) {
204
    return getFragment(part, true);
262
    return getFragment(part, true);
205
  }
263
  }
Lines 210-215 Link Here
210
      id.append(FragmentConstants.INPUT_ID);
268
      id.append(FragmentConstants.INPUT_ID);
211
    else
269
    else
212
      id.append(FragmentConstants.OUTPUT_ID);
270
      id.append(FragmentConstants.OUTPUT_ID);
271
272
	return getFragment(part, id, false);
273
  }
274
  
275
  private IXSDFragment getFragment(Part part, StringBuffer id, boolean useSOAPHeaderWrapper) {
213
    String partName = part.getName();
276
    String partName = part.getName();
214
    id.append(partName);
277
    id.append(partName);
215
    XSDToFragmentConfiguration config = new XSDToFragmentConfiguration();
278
    XSDToFragmentConfiguration config = new XSDToFragmentConfiguration();
Lines 228-233 Link Here
228
    else
291
    else
229
      config.setPartEncoding(FragmentConstants.ENCODING_URL);
292
      config.setPartEncoding(FragmentConstants.ENCODING_URL);
230
    IXSDFragment fragment = getXSDToFragmentController().getFragment(config, id.toString(), part.getName());
293
    IXSDFragment fragment = getXSDToFragmentController().getFragment(config, id.toString(), part.getName());
294
     
295
    // let's see if there's a corresponding wrapper for this fragment
296
    if (useSOAPHeaderWrapper && !(fragment instanceof SOAPHeaderWrapperFragment)) {
297
    	SOAPHeaderWrapperFragment wrapper = (SOAPHeaderWrapperFragment) headerCache.get(fragment.getID());
298
    	
299
    	// no wrapper, let's wrap it
300
    	if (wrapper == null) {
301
    		wrapper = new SOAPHeaderWrapperFragment(fragment);    		
302
    		headerCache.put(fragment.getID(), wrapper);
303
    		
304
    		// also put this wrapper fragment in the master cache
305
    		getXSDToFragmentController().addToCache(wrapper.getID(), wrapper);
306
    	}
307
    	
308
    	return wrapper;
309
    }
310
    
231
    return fragment;
311
    return fragment;
232
  }
312
  }
233
313
(-)wsexplorer-properties/wsdl.properties (+4 lines)
Lines 129-134 Link Here
129
FORM_LABEL_NOTHING_TO_DISPLAY_IN_FORM_VIEW=There is nothing to be displayed in the form view.  Please switch to the source view for the SOAP request and response.
129
FORM_LABEL_NOTHING_TO_DISPLAY_IN_FORM_VIEW=There is nothing to be displayed in the form view.  Please switch to the source view for the SOAP request and response.
130
FORM_LABEL_SOAP_RESPONSE_FAILED_VALIDATION_IN_FORM_VIEW=The SOAP response failed schema validation.  Please switch to the source view for the SOAP response in XML format.
130
FORM_LABEL_SOAP_RESPONSE_FAILED_VALIDATION_IN_FORM_VIEW=The SOAP response failed schema validation.  Please switch to the source view for the SOAP response in XML format.
131
FORM_LABEL_END_POINTS=Endpoints
131
FORM_LABEL_END_POINTS=Endpoints
132
FORM_LABEL_HEADER=Header
133
FORM_LABEL_BODY=Body
134
FORM_LABEL_MUSTUNDERSTAND=mustUnderstand
135
FORM_LABEL_ACTOR=actor
132
136
133
# Source/Form views
137
# Source/Form views
134
FORM_LINK_FORM=Form
138
FORM_LINK_FORM=Form
(-)wsexplorer/css/windows.css (+2 lines)
Lines 9-14 Link Here
9
9
10
/* fieldset+legend Styles */
10
/* fieldset+legend Styles */
11
.keylinefieldset { border-color:#8080FF; border-width:1px; border-style:solid; }
11
.keylinefieldset { border-color:#8080FF; border-width:1px; border-style:solid; }
12
.headerfieldset { -moz-border-radius: 7pt; padding: 3px; border:1px solid #C0C0C0; }
12
13
13
/* table Styles */
14
/* table Styles */
14
.tableborder {border-left:0px solid #B8B4A3; border-right:1px solid #B8B4A3; border-top:1px solid #B8B4A3; border-bottom:0px solid #B8B4A3; }
15
.tableborder {border-left:0px solid #B8B4A3; border-right:1px solid #B8B4A3; border-top:1px solid #B8B4A3; border-bottom:0px solid #B8B4A3; }
Lines 43-47 Link Here
43
.innerrangefragtable {width:100%; border-left:0px solid #B8B4A3; border-right:1px solid #B8B4A3; border-top:1px solid #B8B4A3; border-bottom:0px solid #B8B4A3;}
44
.innerrangefragtable {width:100%; border-left:0px solid #B8B4A3; border-right:1px solid #B8B4A3; border-top:1px solid #B8B4A3; border-bottom:0px solid #B8B4A3;}
44
.textareaenter {font: icon; font-size: 14px; color: Black; border-style:solid; border-width : 1px; border-color: #C7C5B2; width:100%; height:150px; }
45
.textareaenter {font: icon; font-size: 14px; color: Black; border-style:solid; border-width : 1px; border-color: #C7C5B2; width:100%; height:150px; }
45
.bigtextareaenter {font: icon; font-size: 14px; color: Black; border-style:solid; border-width : 1px; border-color: #C7C5B2; width:100%; height:300px; }
46
.bigtextareaenter {font: icon; font-size: 14px; color: Black; border-style:solid; border-width : 1px; border-color: #C7C5B2; width:100%; height:300px; }
47
.fragarea { padding-left: 3px; padding-bottom: 5px; }
46
48
47
iframe {border-width: 2px; border-style: inset; }
49
iframe {border-width: 2px; border-style: inset; }
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/XSDComplexFragment.java (-3 / +6 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2004 IBM Corporation and others.
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl;
14
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl;
12
15
Lines 310-316 Link Here
310
    xsdConfig.setPartEncoding(thisConfig.getPartEncoding());
313
    xsdConfig.setPartEncoding(thisConfig.getPartEncoding());
311
    xsdConfig.setWSDLPartName(thisConfig.getWSDLPartName());
314
    xsdConfig.setWSDLPartName(thisConfig.getWSDLPartName());
312
    String newID = genID();
315
    String newID = genID();
313
    addFragment(newID, getXSDToFragmentController().getFragment(xsdConfig, newID, newID));
316
    addFragment(newID, getXSDToFragmentController().getFragment(xsdConfig, newID, getName()));
314
    createAttributeFragments(newID);
317
    createAttributeFragments(newID);
315
    return newID;
318
    return newID;
316
  }
319
  }
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/util/SoapHelper.java (-2 / +10 lines)
Lines 1-12 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2002, 2004 IBM Corporation and others.
2
 * Copyright (c) 2002, 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 * 
7
 * 
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
10
 *******************************************************************************/
13
 *******************************************************************************/
11
14
12
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.util;
15
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.util;
Lines 65-70 Link Here
65
    return soapEnvelopeElement;
68
    return soapEnvelopeElement;
66
  }
69
  }
67
  
70
  
71
  public static final Element createSoapHeaderElement(Document doc)
72
  {
73
    return doc.createElement("soapenv:Header");
74
  }
75
  
68
  public static final Element createSoapBodyElement(Document doc)
76
  public static final Element createSoapBodyElement(Document doc)
69
  {
77
  {
70
    return doc.createElement("soapenv:Body");
78
    return doc.createElement("soapenv:Body");
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/util/BrowserDetect.java (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
13
 *******************************************************************************/
14
15
package org.eclipse.wst.ws.internal.explorer.platform.util;
16
17
import javax.servlet.http.HttpServletRequest;
18
19
/**
20
 * Helper class used to detect the type of browser used. 
21
 */
22
public class BrowserDetect {
23
	
24
	/**
25
	 * Determine if Microsoft Internet Explorer is used.
26
	 * 
27
	 * @param request The HTTP request.
28
	 * @return True if the client is a Microsoft Internet Explorer web browser, false otherwise.
29
	 */
30
	public static final boolean isMicrosoftInternetExplorer(HttpServletRequest request) {
31
		String userAgent = request.getHeader("User-Agent");
32
		
33
		if (userAgent != null && userAgent.toLowerCase().indexOf("msie") != -1)
34
			return true;
35
		
36
		return false;
37
	}
38
}
(-)wsexplorer-src/org/eclipse/wst/ws/internal/explorer/platform/wsdl/fragment/impl/SOAPHeaderWrapperFragment.java (+290 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2007 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 * IBM Corporation - initial API and implementation
10
 * yyyymmdd bug      Email and other contact information
11
 * -------- -------- -----------------------------------------------------------
12
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
13
 *******************************************************************************/
14
15
package org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl;
16
17
import java.net.URI;
18
import java.net.URISyntaxException;
19
import java.util.Hashtable;
20
import java.util.Vector;
21
22
import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataException;
23
import org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser;
24
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.constants.FragmentConstants;
25
import org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.IXSDFragment;
26
import org.w3c.dom.Document;
27
import org.w3c.dom.Element;
28
29
/**
30
 * A SOAP header fragment, which is a wrapper around the fragment that represents the SOAP header content.  
31
 */
32
public class SOAPHeaderWrapperFragment extends XSDDelegationFragment {
33
	
34
	private static final String MUST_UNDERSTAND = "mustUnderstand";
35
	private static final String ACTOR           = "actor";
36
	
37
	private boolean mustUnderstand = false;	 
38
	private String  actor          = "";
39
	private boolean validActor     = true;
40
	
41
	/**
42
	 * Constructor.
43
	 * 
44
	 * @param fragment The fragment that this SOAP header fragment wraps around.
45
	 */
46
	public SOAPHeaderWrapperFragment(IXSDFragment fragment) {
47
		super(fragment.genID(), fragment.getName(), null);	    
48
		setXSDDelegationFragment(fragment);
49
	}
50
	
51
	/*
52
	 * Retrieves the first element from a string array.
53
	 */
54
	private String getFirstElement(String[] stringArray) {
55
		if (stringArray == null || stringArray.length == 0)
56
			return null;
57
		return stringArray[0];		 
58
	}
59
	
60
	/*
61
	 * Retrieves the first element from a vector.
62
	 */
63
	private String getFirstElement(Vector vector) {
64
		if (vector == null || vector.isEmpty())
65
			return null;
66
		 
67
		Object obj = vector.firstElement();
68
		if (!(obj instanceof String))
69
			return null;
70
		 
71
		return (String) obj;
72
	}
73
	
74
	/*
75
	 * Sets the mustUnderstand value. Any non-empty string (except "0")
76
	 * translates to a mustUnderstand value of true.
77
	 */
78
	private void setMustUnderstand(String param) {
79
		mustUnderstand = (param != null && !param.equals("0"));
80
	}
81
	
82
	/*
83
	 * Sets the actor value.  Also sets the flag for validActor.
84
	 */
85
	private void setActor(String param) {
86
		if (param == null || param.length() == 0)
87
			actor = "";
88
		else {
89
			actor = param;
90
			try {
91
				new URI(actor);
92
			}
93
			catch (URISyntaxException e) {
94
				validActor = false;
95
				return;
96
			}
97
		}		 
98
		 
99
		validActor = true;
100
	}	 
101
	
102
    /* (non-Javadoc)
103
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#processParameterValues(org.eclipse.wst.ws.internal.explorer.platform.util.MultipartFormDataParser)
104
	 */
105
	public boolean processParameterValues(MultipartFormDataParser parser) throws MultipartFormDataException {
106
	
107
		setMustUnderstand(parser.getParameter(getMustUnderstandID()));
108
	    setActor(parser.getParameter(getActorID()));
109
110
		// mustUnderstand is either set or unset, no further validation necessary
111
		// only need to validate actor URI
112
		return super.processParameterValues(parser) && validateActor();			 		 
113
	}
114
		
115
	/* (non-Javadoc)
116
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#setParameterValues(java.lang.String, java.lang.String[])
117
	 */
118
	public void setParameterValues(String paramKey, String[] params) {
119
		if (getMustUnderstandID().equals(paramKey))
120
			setMustUnderstand(getFirstElement(params));
121
		else if (getActorID().equals(paramKey))
122
			setActor(getFirstElement(params));
123
		else
124
			super.setParameterValues(paramKey, params);		 
125
	}
126
	
127
	/* (non-Javadoc)
128
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#setParameterValues(java.lang.String, java.util.Vector)
129
	 */
130
	public void setParameterValues(String paramKey, Vector params) {
131
		if (getMustUnderstandID().equals(paramKey))
132
			setMustUnderstand(getFirstElement(params));
133
		else if (getActorID().equals(paramKey))
134
			setActor(getFirstElement(params));
135
		else
136
			super.setParameterValues(paramKey, params);
137
	}
138
	
139
	/* (non-Javadoc)
140
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#getParameterValues(java.lang.String)
141
	 */
142
	public String[] getParameterValues(String paramKey) {
143
		if (getMustUnderstandID().equals(paramKey))
144
			return new String[] { mustUnderstand ? "1" : "0" };
145
		else if (getActorID().equals(paramKey))
146
			return new String[] { actor };
147
		else
148
			return super.getParameterValues(paramKey);		 
149
	}
150
	
151
	/* (non-Javadoc)
152
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#getParameterValue(java.lang.String, int)
153
	 */
154
	public String getParameterValue(String paramKey, int paramIndex) {
155
		return getParameterValues(paramKey)[paramIndex];
156
	}	 
157
	
158
	/* (non-Javadoc)
159
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#validateAllParameterValues()
160
	 */
161
	public boolean validateAllParameterValues() {
162
		return super.validateAllParameterValues() && validateActor();
163
	}
164
	
165
	/* (non-Javadoc)
166
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#validateParameterValues(java.lang.String)
167
	 */
168
	public boolean validateParameterValues(String paramKey) {
169
		if (getMustUnderstandID().equals(paramKey))
170
			return true;
171
		else if (getActorID().equals(paramKey))
172
			return validateActor();
173
		else
174
			return super.validateParameterValues(paramKey);
175
	}
176
	
177
	/* (non-Javadoc)
178
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#validateParameterValue(java.lang.String, int)
179
	 */
180
	public boolean validateParameterValue(String paramKey, int paramIndex) {
181
		if (getMustUnderstandID().equals(paramKey))
182
			return true;
183
		else if (getActorID().equals(paramKey))
184
			return validateActor();
185
		else
186
			return super.validateParameterValue(paramKey, paramIndex);
187
	}
188
	
189
	/**
190
	 * Sets the values for this SOAP header given a hashtable of instance documents and a namespace table.
191
	 * 
192
	 * @param instanceDocuments The hashtable of instance documents.  The key is the document's name with namespace prefix.
193
	 * @param namespaceTable The namespace table.
194
	 * 
195
	 * @return True if all values extracted from the instance document are valid.
196
	 */
197
	public boolean setParameterValuesFromInstanceDocuments(Hashtable instanceDocuments, Hashtable namespaceTable) {
198
		String tagName = ((XSDFragment) getXSDDelegationFragment()).getInstanceDocumentTagName(namespaceTable);
199
		Element instanceDocument = (Element) instanceDocuments.get(tagName);
200
		 
201
		if (instanceDocument == null)
202
			return false;
203
		 
204
		boolean valid = setParameterValuesFromInstanceDocuments(new Element[] { instanceDocument });		
205
		 
206
		String prefix = getPrefixFromNamespaceURI(FragmentConstants.NS_URI_SOAP_ENV, namespaceTable) + FragmentConstants.COLON;
207
		 
208
		String mustUnderstandValue = instanceDocument.getAttribute(prefix + MUST_UNDERSTAND);
209
		if ("".equals(mustUnderstandValue))
210
			mustUnderstand = false;
211
		else if ("0".equals(mustUnderstandValue) || "1".equals(mustUnderstandValue))
212
			setMustUnderstand(mustUnderstandValue);
213
		else
214
			valid = false;
215
		 
216
		setActor(instanceDocument.getAttribute(prefix + ACTOR));
217
		 
218
		return valid && validateActor();
219
	}
220
	
221
	/* (non-Javadoc)
222
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#genInstanceDocumentsFromParameterValues(boolean, java.util.Hashtable, org.w3c.dom.Document)
223
	 */
224
	public Element[] genInstanceDocumentsFromParameterValues(boolean genXSIType, Hashtable namespaceTable, Document doc) {
225
		Element[] elements = super.genInstanceDocumentsFromParameterValues(genXSIType, namespaceTable, doc);
226
		 
227
		if (elements.length == 0)
228
			return elements;
229
		 
230
		String prefix = getPrefixFromNamespaceURI(FragmentConstants.NS_URI_SOAP_ENV, namespaceTable) + FragmentConstants.COLON;
231
		 
232
		for (int i = 0; i < elements.length; i++) {			 			 				 
233
			
234
			if (mustUnderstand)
235
				elements[i].setAttribute(prefix + MUST_UNDERSTAND, "1");
236
237
			if (actor.length() > 0)
238
				elements[i].setAttribute(prefix + ACTOR, actor);
239
		}
240
		 
241
		return elements;
242
	}
243
	 
244
	/**
245
	 * Convenience method for getting for the mustUnderstand value
246
	 * @return The mustUnderstand value, true if mustUnderstand="1", false otherwise.
247
	 */
248
	public boolean isMustUnderstand() {
249
		return mustUnderstand;
250
	}
251
	 
252
	/**
253
	 * Convenience method for getting the actor value
254
	 * @return The actor value
255
	 */
256
	public String getActor() {
257
		return actor;
258
	}
259
	
260
	/**
261
	 * Determines if the actor value is a valid URI.
262
	 * @return True if the actor value is valid, false otherwise.
263
	 */
264
	public boolean validateActor() {		 
265
		return validActor;
266
	}
267
	
268
	/**
269
	 * Returns the ID of the mustUnderstand input element
270
	 * @return The ID of the mustUnderstand input element
271
	 */
272
	public String getMustUnderstandID() {
273
		return getID() + FragmentConstants.ID_SEPERATOR + MUST_UNDERSTAND;
274
	}
275
	
276
	/**
277
	 * Returns the ID of the actor input element
278
	 * @return The ID of the actor input element
279
	 */
280
	public String getActorID() {
281
		return getID() + FragmentConstants.ID_SEPERATOR + ACTOR;
282
	}
283
	 
284
	/* (non-Javadoc)
285
	 * @see org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.XSDDelegationFragment#getWriteFragment()
286
	 */
287
	public String getWriteFragment() {
288
		return "/wsdl/fragment/SOAPHeaderWrapperWFragmentJSP.jsp";
289
	}		 
290
}
(-)wsexplorer/wsdl/fragment/SOAPHeaderWrapperWFragmentJSP.jsp (+86 lines)
Added Link Here
1
<%
2
/*******************************************************************************
3
 * Copyright (c) 2007 IBM Corporation and others.
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
9
 * Contributors:
10
 * IBM Corporation - initial API and implementation
11
 * yyyymmdd bug      Email and other contact information
12
 * -------- -------- -----------------------------------------------------------
13
 * 20070305   117034 makandre@ca.ibm.com - Andrew Mak, Web Services Explorer should support SOAP Headers
14
 *******************************************************************************/
15
%>
16
<%@ page contentType="text/html; charset=UTF-8" import="org.eclipse.wst.ws.internal.explorer.platform.wsdl.perspective.*,
17
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.datamodel.*,
18
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.*,
19
                                                        org.eclipse.wst.ws.internal.explorer.platform.wsdl.fragment.impl.SOAPHeaderWrapperFragment,
20
                                                        org.eclipse.wst.ws.internal.explorer.platform.perspective.*,
21
                                                        org.eclipse.wst.ws.internal.explorer.platform.util.*" %>
22
23
<jsp:useBean id="controller" class="org.eclipse.wst.ws.internal.explorer.platform.perspective.Controller" scope="session"/>
24
<jsp:useBean id="fragID" class="java.lang.StringBuffer" scope="request"/>
25
<jsp:useBean id="nodeID" class="java.lang.StringBuffer" scope="request"/>
26
27
<%
28
WSDLPerspective wsdlPerspective = controller.getWSDLPerspective();
29
Node selectedNode = wsdlPerspective.getNodeManager().getNode(Integer.parseInt(nodeID.toString()));
30
WSDLOperationElement operElement = (WSDLOperationElement)selectedNode.getTreeElement();
31
SOAPHeaderWrapperFragment wrapperFragment = (SOAPHeaderWrapperFragment)operElement.getFragmentByID(fragID.toString());
32
IXSDFragment delegationFragment = wrapperFragment.getXSDDelegationFragment();
33
fragID.delete(0, fragID.length());
34
fragID.append(delegationFragment.getID());
35
36
String mustUnderstandID = wrapperFragment.getMustUnderstandID();
37
String actorID = wrapperFragment.getActorID();
38
39
String fieldsetClass =  BrowserDetect.isMicrosoftInternetExplorer(request) ? "" : "headerfieldset";
40
%>
41
<table cellpadding="0" cellspacing="0" class="fixfragtable">
42
  <tr>
43
    <td>
44
	  <fieldset class="<%=fieldsetClass%>">
45
		<jsp:include page="<%=delegationFragment.getWriteFragment()%>" flush="true"/>	      	  
46
		<table cellpadding="3" cellspacing="0" class="fixfragtable">
47
		  <tr>
48
		    <td height="3"><!-- spacer --></td>
49
		  </tr>
50
		  <tr>
51
		    <td>
52
		      <% if (wrapperFragment.isMustUnderstand()) { %>    	
53
		        <input type="checkbox" id="<%=mustUnderstandID%>" name="<%=mustUnderstandID%>" checked/>
54
		      <% } else { %>
55
		        <input type="checkbox" id="<%=mustUnderstandID%>" name="<%=mustUnderstandID%>"/>
56
		      <% } %>      	
57
		    </td>
58
		    <td class="label">
59
		      <label for="<%=mustUnderstandID%>"><%=wsdlPerspective.getMessage("FORM_LABEL_MUSTUNDERSTAND")%></label>
60
		    </td>
61
		    <td>|</td>
62
		    <td class="label">
63
		      <label for="<%=actorID%>"><%=wsdlPerspective.getMessage("FORM_LABEL_ACTOR")%></label>
64
		    </td>
65
		    <td>
66
		      <div style="width: 5px">
67
      		    <% if (!wrapperFragment.validateActor()) { %>
68
      		      <%=HTMLUtils.redAsterisk()%>
69
                <% } %>
70
              </div>
71
    		</td>    	
72
		    <td width="100%">    	
73
		      <input type="text" id="<%=actorID%>" name="<%=actorID%>" value="<%=wrapperFragment.getActor()%>" class="tabletextenter"/>
74
		    </td>
75
		  </tr>
76
		  <tr>
77
		    <td height="3"><!-- spacer --></td>
78
		  </tr>    
79
		</table>
80
	  </fieldset>
81
	</td>
82
  </tr>
83
  <tr>
84
	<td height="5"><!-- spacer --></td>
85
  </tr>
86
</table>

Return to bug 117034