View | Details | Raw Unified | Return to bug 51605
Collapse All | Expand All

(-)src/protocol/http/org/apache/jmeter/protocol/http/control/gui/WebServiceSamplerGui.java (-8 / +17 lines)
Lines 24-48 Link Here
24
24
25
import javax.swing.JButton;
25
import javax.swing.JButton;
26
import javax.swing.JCheckBox;
26
import javax.swing.JCheckBox;
27
import javax.swing.JOptionPane;
28
import javax.swing.JLabel;
27
import javax.swing.JLabel;
28
import javax.swing.JOptionPane;
29
import javax.swing.JPanel;
29
import javax.swing.JPanel;
30
import javax.swing.border.Border;
30
import javax.swing.border.Border;
31
import javax.swing.border.EmptyBorder;
31
import javax.swing.border.EmptyBorder;
32
32
33
import org.apache.commons.lang.ArrayUtils;
33
import org.apache.commons.lang.ArrayUtils;
34
import org.apache.jmeter.gui.UnsharedComponent;
35
import org.apache.jmeter.gui.util.FilePanel;
36
import org.apache.jmeter.protocol.http.control.AuthManager;
34
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
37
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
35
import org.apache.jmeter.protocol.http.sampler.WebServiceSampler;
38
import org.apache.jmeter.protocol.http.sampler.WebServiceSampler;
39
import org.apache.jmeter.protocol.http.util.WSDLHelper;
36
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
40
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
37
import org.apache.jmeter.testelement.TestElement;
41
import org.apache.jmeter.testelement.TestElement;
38
import org.apache.jmeter.util.JMeterUtils;
42
import org.apache.jmeter.util.JMeterUtils;
39
import org.apache.jmeter.gui.util.FilePanel;
40
import org.apache.jorphan.gui.JLabeledChoice;
43
import org.apache.jorphan.gui.JLabeledChoice;
41
import org.apache.jorphan.gui.JLabeledTextArea;
44
import org.apache.jorphan.gui.JLabeledTextArea;
42
import org.apache.jorphan.gui.JLabeledTextField;
45
import org.apache.jorphan.gui.JLabeledTextField;
43
import org.apache.jorphan.gui.layout.VerticalLayout;
46
import org.apache.jorphan.gui.layout.VerticalLayout;
44
import org.apache.jmeter.protocol.http.util.WSDLHelper;
45
import org.apache.jmeter.protocol.http.control.AuthManager;
46
47
47
/**
48
/**
48
 * This is the GUI for the webservice samplers. It extends AbstractSamplerGui
49
 * This is the GUI for the webservice samplers. It extends AbstractSamplerGui
Lines 68-74 Link Here
68
69
69
    private final JLabeledTextArea soapXml = new JLabeledTextArea(JMeterUtils.getResString("soap_data_title")); // $NON-NLS-1$
70
    private final JLabeledTextArea soapXml = new JLabeledTextArea(JMeterUtils.getResString("soap_data_title")); // $NON-NLS-1$
70
71
71
    private final JLabeledTextField wsdlField = new JLabeledTextField(JMeterUtils.getResString("wsdl_url")); // $NON-NLS-1$
72
    private final JLabeledTextField wsdlField = new JLabeledTextField(JMeterUtils.getResString("wsdl_url"), 30); // $NON-NLS-1$
72
73
73
    private final JButton wsdlButton = new JButton(JMeterUtils.getResString("load_wsdl")); // $NON-NLS-1$
74
    private final JButton wsdlButton = new JButton(JMeterUtils.getResString("load_wsdl")); // $NON-NLS-1$
74
75
Lines 264-270 Link Here
264
        wsdlField.setText(sampler.getWsdlURL());
265
        wsdlField.setText(sampler.getWsdlURL());
265
        final String wsdlText = wsdlField.getText();
266
        final String wsdlText = wsdlField.getText();
266
        if (wsdlText != null && wsdlText.length() > 0) {
267
        if (wsdlText != null && wsdlText.length() > 0) {
267
            fillWsdlMethods(wsdlField.getText());
268
            fillWsdlMethods(wsdlField.getText(), sampler.getSoapAction());
268
        }
269
        }
269
        protocol.setText(sampler.getProtocol());
270
        protocol.setText(sampler.getProtocol());
270
        domain.setText(sampler.getDomain());
271
        domain.setText(sampler.getDomain());
Lines 365-371 Link Here
365
        } else if (eventSource == wsdlButton){
366
        } else if (eventSource == wsdlButton){
366
            final String wsdlText = wsdlField.getText();
367
            final String wsdlText = wsdlField.getText();
367
            if (wsdlText != null && wsdlText.length() > 0) {
368
            if (wsdlText != null && wsdlText.length() > 0) {
368
                fillWsdlMethods(wsdlText);
369
                fillWsdlMethods(wsdlText, null);
369
            } else {
370
            } else {
370
                JOptionPane.showConfirmDialog(this,
371
                JOptionPane.showConfirmDialog(this,
371
                        JMeterUtils.getResString("wsdl_url_error"), // $NON-NLS-1$
372
                        JMeterUtils.getResString("wsdl_url_error"), // $NON-NLS-1$
Lines 377-387 Link Here
377
378
378
    /**
379
    /**
379
     * @param wsdlText
380
     * @param wsdlText
381
     * @param soapAction 
380
     */
382
     */
381
    private void fillWsdlMethods(final String wsdlText) {
383
    private void fillWsdlMethods(final String wsdlText, String soapAction) {
382
        String[] wsdlData = browseWSDL(wsdlText);
384
        String[] wsdlData = browseWSDL(wsdlText);
383
        if (wsdlData != null) {
385
        if (wsdlData != null) {
384
            wsdlMethods.setValues(wsdlData);
386
            wsdlMethods.setValues(wsdlData);
387
            if (HELPER != null && soapAction != null) {
388
                String selected = HELPER.getSoapActionName(soapAction);
389
                if (selected != null) {
390
                    wsdlMethods.setText(selected);
391
                }
392
            }
393
385
            wsdlMethods.repaint();
394
            wsdlMethods.repaint();
386
        }
395
        }
387
    }
396
    }
(-)src/protocol/http/org/apache/jmeter/protocol/http/util/WSDLHelper.java (+15 lines)
Lines 371-376 Link Here
371
    }
371
    }
372
372
373
    /**
373
    /**
374
     * return the "wsdl method name" from a soap action
375
     * @param soapAction the soap action
376
     * @return the associated "wsdl method name" or null if not found
377
     */
378
    public String getSoapActionName(String soapAction) {
379
        for (Map.Entry<String, String> entry : ACTIONS.entrySet()) {
380
            if (entry.getValue().equals(soapAction)) {
381
                return entry.getKey();
382
            }
383
        }
384
        return null;
385
    }
386
    
387
    /**
374
     * Simple test for the class uses bidbuy.wsdl from Apache's soap driver
388
     * Simple test for the class uses bidbuy.wsdl from Apache's soap driver
375
     * examples.
389
     * examples.
376
     *
390
     *
Lines 398-401 Link Here
398
            exception.printStackTrace();
412
            exception.printStackTrace();
399
        }
413
        }
400
    }
414
    }
415
401
}
416
}

Return to bug 51605