You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2006/03/10 19:36:34 UTC

svn commit: r384887 - in /jakarta/jmeter/branches/rel-2-1: src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java xdocs/changes.xml

Author: sebb
Date: Fri Mar 10 10:36:32 2006
New Revision: 384887

URL: http://svn.apache.org/viewcvs?rev=384887&view=rev
Log:
Bug 38901 - Add optional SOAPAction header

Modified:
    jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java
    jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java
    jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml

Modified: jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java?rev=384887&r1=384886&r2=384887&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/SoapSamplerGui.java Fri Mar 10 10:36:32 2006
@@ -1,6 +1,5 @@
-// $Header$
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +19,12 @@
 
 import java.awt.BorderLayout;
 import java.awt.Dimension;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 
+import javax.swing.JCheckBox;
 import javax.swing.JPanel;
 
 import org.apache.jmeter.protocol.http.sampler.SoapSampler;
@@ -35,7 +39,8 @@
  */
 public class SoapSamplerGui extends AbstractSamplerGui {
 	private JLabeledTextField urlField;
-
+	private JLabeledTextField soapAction;
+    private JCheckBox sendSoapAction;
 	private JLabeledTextArea soapXml;
 
 	public SoapSamplerGui() {
@@ -68,6 +73,8 @@
 			SoapSampler sampler = (SoapSampler) s;
 			sampler.setURLData(urlField.getText());
 			sampler.setXmlData(soapXml.getText());
+			sampler.setSOAPAction(soapAction.getText());
+			sampler.setSendSOAPAction(sendSoapAction.isSelected());
 		}
 	}
 
@@ -79,11 +86,37 @@
 
 		urlField = new JLabeledTextField(JMeterUtils.getResString("url"), 10);
 		soapXml = new JLabeledTextArea(JMeterUtils.getResString("soap_data_title"), null);
+		soapAction = new JLabeledTextField("", 10);
+		sendSoapAction = new JCheckBox("Send SOAPAction: ", true);
 
 		JPanel mainPanel = new JPanel(new BorderLayout());
-		mainPanel.add(urlField, BorderLayout.NORTH);
+	    JPanel soapActionPanel = new JPanel();
+	    soapActionPanel.setLayout(new GridBagLayout());
+	    GridBagConstraints c = new GridBagConstraints();
+	    c.fill = GridBagConstraints.HORIZONTAL;
+	    c.gridwidth = 2;
+	    c.gridx = 0;
+	    c.gridy = 0;
+	    c.weightx = 1;
+	    soapActionPanel.add(urlField, c);
+	    c.fill = GridBagConstraints.NONE;
+	    c.gridwidth = 1;
+	    c.gridy = 1;
+	    c.weightx = 0;
+	    soapActionPanel.add(sendSoapAction, c);
+	    c.gridx = 1;
+	    c.fill = GridBagConstraints.HORIZONTAL;
+	    c.weightx = 1;
+		soapActionPanel.add(soapAction, c);
+		mainPanel.add(soapActionPanel, BorderLayout.NORTH);
 		mainPanel.add(soapXml, BorderLayout.CENTER);
 
+        sendSoapAction.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+		        soapAction.setEnabled(sendSoapAction.isSelected());
+		    }
+            });
+
 		add(mainPanel, BorderLayout.CENTER);
 	}
 
@@ -91,6 +124,8 @@
 		super.configure(el);
 		SoapSampler sampler = (SoapSampler) el;
 		urlField.setText(sampler.getURLData());
+		sendSoapAction.setSelected(sampler.getSendSOAPAction());
+		soapAction.setText(sampler.getSOAPAction());
 		soapXml.setText(sampler.getXmlData());
 	}
 

Modified: jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java?rev=384887&r1=384886&r2=384887&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/SoapSampler.java Fri Mar 10 10:36:32 2006
@@ -1,6 +1,5 @@
-// $Header$
 /*
- * Copyright 2001-2004 The Apache Software Foundation.
+ * Copyright 2001-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,6 +44,10 @@
 
 	public static final String URL_DATA = "SoapSampler.URL_DATA";
 
+	public static final String SOAP_ACTION = "SoapSampler.SOAP_ACTION";
+
+	public static final String SEND_SOAP_ACTION = "SoapSampler.SEND_SOAP_ACTION";
+
 	public void setXmlData(String data) {
 		setProperty(XML_DATA, data);
 	}
@@ -61,6 +64,22 @@
 		setProperty(URL_DATA, url);
 	}
 
+	public String getSOAPAction() {
+		return getPropertyAsString(SOAP_ACTION);
+	}
+
+	public void setSOAPAction(String action) {
+		setProperty(SOAP_ACTION, action);
+	}
+
+	public boolean getSendSOAPAction() {
+		return getPropertyAsBoolean(SEND_SOAP_ACTION);
+	}
+
+	public void setSendSOAPAction(boolean action) {
+		setProperty(SEND_SOAP_ACTION, String.valueOf(action));
+	}
+
 	/**
 	 * Set the HTTP request headers in preparation to open the connection and
 	 * sending the POST data.
@@ -90,6 +109,7 @@
 		} else {
 			// otherwise we use "text/xml" as the default
 			connection.setRequestProperty("Content-Type", "text/xml");
+			if(getSendSOAPAction()) connection.setRequestProperty("SOAPAction", "\"" + getSOAPAction() + "\"");
 		}
 		connection.setDoOutput(true);
 	}

Modified: jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml?rev=384887&r1=384886&r2=384887&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml (original)
+++ jakarta/jmeter/branches/rel-2-1/xdocs/changes.xml Fri Mar 10 10:36:32 2006
@@ -51,6 +51,7 @@
 <li>includecontroller.prefix property added</li>
 <li>Regular Expression Extractor sets group count</li>
 <li>Can now save entire screen as an image, not just the right-hand pane</li>
+<li>Bug 38901 - Add optional SOAPAction header to SOAP Sampler</li>
 </ul>
 
 <h4>Bug fixes:</h4>
@@ -82,6 +83,7 @@
 <li>Bug 36430 - Counter now uses long rather than int to increase the range</li>
 <li>Bug 38302 - fix XPath function</li>
 <li>Bug 38748 - JDBC DataSourceElement fails with remote testing</li>
+<li>Bug 38902 - sometimes -1 seems to be returned unnecessarily for response code</li>
 </ul>	
 	
 <h4>Other changes</h4>



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org