Skip to content

Commit

Permalink
feat(rest-to-soap): Add a SOAPAction parameter (#2)
Browse files Browse the repository at this point in the history
Also use codemirror for XML envelope in UI

Closes gravitee-io/issues#177
  • Loading branch information
brasseld authored and NicolasGeraud committed Jul 28, 2016
1 parent 7831709 commit 77f1bfb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class RestToSoapTransformerPolicy {
*/
private final static Logger LOGGER = LoggerFactory.getLogger(RestToSoapTransformerPolicy.class);

private final static String SOAP_ACTION_HEADER = "SOAPAction";

/**
* SOAP transformer configuration
*/
Expand All @@ -66,6 +68,12 @@ public void onRequest(Request request, Response response, ExecutionContext execu
request.headers().set(HttpHeaders.CONTENT_TYPE, MediaType.TEXT_XML);
request.headers().set(HttpHeaders.TRANSFER_ENCODING, HttpHeadersValues.TRANSFER_ENCODING_CHUNKED);

if (soapTransformerPolicyConfiguration.getSoapAction() != null &&
!soapTransformerPolicyConfiguration.getSoapAction().trim().isEmpty()) {
LOGGER.debug("Add a SOAPAction header to invoke SOAP WS: {}", soapTransformerPolicyConfiguration.getSoapAction());
request.headers().set(SOAP_ACTION_HEADER, soapTransformerPolicyConfiguration.getSoapAction());
}

policyChain.doNext(request, response);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,21 @@ public class SoapTransformerPolicyConfiguration implements PolicyConfiguration {

private String envelope;

private String soapAction;

public String getEnvelope() {
return envelope;
}

public void setEnvelope(String envelope) {
this.envelope = envelope;
}

public String getSoapAction() {
return soapAction;
}

public void setSoapAction(String soapAction) {
this.soapAction = soapAction;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@
"id" : "urn:jsonschema:io:gravitee:policy:rest2soap:configuration:SoapTransformerPolicyConfiguration",
"properties" : {
"envelope" : {
"title": "SOAP envelope",
"title": "SOAP Envelope",
"description": "SOAP envelope used to invoke WS (support EL)",
"type" : "string",
"x-schema-form": {
"type": "textarea",
"placeholder": "Place your SOAP envelope here"
"type": "codemirror",
"codemirrorOptions": {
"placeholder": "Place your SOAP envelope here",
"lineWrapping": true,
"lineNumbers": true,
"allowDropFileTypes": true,
"autoCloseTags": true,
"mode": "xml"
}
}
},
"soapAction": {
"title": "SOAP Action",
"description": "'SOAPAction' HTTP header send when invoking WS",
"type": "string"
}
},
"required": [
Expand Down

0 comments on commit 77f1bfb

Please sign in to comment.