Skip to content

Commit

Permalink
Add HTTP Headers to Web Service Listener
Browse files Browse the repository at this point in the history
Fixes nextgenhealthcare#6337

Add functionality to display HTTP Headers in Web Service Listener connector.

* **WebServiceListener.java**:
  - Add `httpHeadersField` to display HTTP Headers.
  - Update `initComponents` to initialize `httpHeadersField`.
  - Update `initLayout` to add `httpHeadersField` to the layout.
  - Update `setProperties` and `getProperties` methods to handle HTTP Headers.

* **IWebServiceReceiver.java**:
  - Add `getHttpHeaders` method to the interface.

* **WebServiceConfiguration.java**:
  - Add `configureHttpHeaders` method to handle HTTP Headers.

* **WebServiceReceiver.java**:
  - Add `httpHeaders` field to store HTTP Headers.
  - Implement `getHttpHeaders` method to return HTTP Headers.
  - Update `createAuthenticator` method to store HTTP Headers from `HttpExchange`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/nextgenhealthcare/connect/issues/6337?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
nkzarrabi committed Nov 4, 2024
1 parent be90435 commit 645aa38
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 428 deletions.
12 changes: 12 additions & 0 deletions client/src/com/mirth/connect/connectors/ws/WebServiceListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public ConnectorProperties getProperties() {
properties.setClassName(classNameField.getText());
properties.setServiceName(serviceNameField.getText());
properties.setSoapBinding(Binding.fromDisplayName((String) versionComboBox.getSelectedItem()));
properties.setHttpHeaders(httpHeadersField.getText());

return properties;
}
Expand All @@ -71,6 +72,7 @@ public void setProperties(ConnectorProperties properties) {
updateClassNameRadio();

serviceNameField.setText(props.getServiceName());
httpHeadersField.setText(props.getHttpHeaders());

updateWSDL();
}
Expand Down Expand Up @@ -149,6 +151,7 @@ private void initComponents() {
methodLabel = new JLabel("Method:");
webServiceLabel = new JLabel("Web Service:");
classNameLabel = new JLabel("Service Class Name:");
httpHeadersLabel = new JLabel("HTTP Headers:");

serviceNameField = new MirthTextField();
serviceNameField.setToolTipText("The name to give to the web service.");
Expand Down Expand Up @@ -205,6 +208,9 @@ public void actionPerformed(ActionEvent evt) {

classNameField = new MirthTextField();
classNameField.setToolTipText("<html>The fully qualified class name of the web service that should be hosted.<br>If this is a custom class, it should be added in a custom jar so it is loaded with Mirth Connect.</html>");

httpHeadersField = new MirthTextField();
httpHeadersField.setToolTipText("Displays the HTTP Headers of incoming calls.");
}

private void initLayout() {
Expand All @@ -230,6 +236,9 @@ private void initLayout() {

add(methodLabel);
add(methodField, "w 250!, wrap");

add(httpHeadersLabel);
add(httpHeadersField, "w 250!, wrap");
}

private void serviceNameFieldKeyReleased(KeyEvent evt) {
Expand Down Expand Up @@ -269,4 +278,7 @@ private void classNameCustomRadioActionPerformed() {

private JLabel methodLabel;
private JTextField methodField;

private JLabel httpHeadersLabel;
private MirthTextField httpHeadersField;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ public interface IWebServiceReceiver extends ISourceConnector {

public void setServer(HttpServer server);

public Map<String, List<String>> getHttpHeaders();
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ public interface WebServiceConfiguration {
public void configureReceiver(IWebServiceReceiver connector) throws Exception;

public void configureDispatcher(IWebServiceDispatcher connector, ConnectorProperties connectorProperties, Map<String, Object> requestContext) throws Exception;
}

public void configureHttpHeaders(IWebServiceReceiver connector) throws Exception;
}
Loading

0 comments on commit 645aa38

Please sign in to comment.