fluid-ws-java-client/src/main/java/com/fluidbpm/ws/client/v1/ABaseClientWS.java
protected String executeTxtReceiveTxt(
			HttpMethod httpMethodParam,
			List<HeaderNameValue> headerNameValuesParam,
			boolean checkConnectionValidParam,
			String stringParam,
			ContentType contentTypeParam,
			String postfixUrlParam
	) {
		if(stringParam == null || stringParam.isEmpty()) {
			throw new FluidClientException("No JSON body to post.",
					FluidClientException.ErrorCode.FIELD_VALIDATE);
		}

		//Check connection...
		if(checkConnectionValidParam && !this.isConnectionValid()) {
			throw new FluidClientException(
					"Unable to reach service at '"+
							this.endpointUrl.concat(postfixUrlParam)+"'.",
					FluidClientException.ErrorCode.CONNECT_ERROR);
		}

		CloseableHttpClient httpclient = this.getClient();

		String responseBody = null;

		try {
			HttpUriRequest uriRequest = null;

			//POST...
			if(httpMethodParam == HttpMethod.POST) {
				//When its html Form Data...
				if(contentTypeParam == ContentType.APPLICATION_FORM_URLENCODED) {
					RequestBuilder builder = RequestBuilder.post().setUri(
							this.endpointUrl.concat(postfixUrlParam));

					builder = this.addParamsToBuildFromString(builder,stringParam);
					uriRequest = builder.build();
				} else {
					//JSON or any other...
					uriRequest = new HttpPost(this.endpointUrl.concat(postfixUrlParam));
				}

				uriRequest.setHeader(CONTENT_TYPE_HEADER, contentTypeParam.toString());
			} else if(httpMethodParam == HttpMethod.PUT) {
				//PUT...
				if(contentTypeParam == ContentType.APPLICATION_FORM_URLENCODED) {
					RequestBuilder builder = RequestBuilder.put().setUri(
							this.endpointUrl.concat(postfixUrlParam));

					builder = this.addParamsToBuildFromString(builder, stringParam);
					uriRequest = builder.build();
				} else {
					uriRequest = new HttpPut(this.endpointUrl.concat(postfixUrlParam));
					uriRequest.setHeader(CONTENT_TYPE_HEADER, contentTypeParam.toString());
				}
			} else if(httpMethodParam == HttpMethod.DELETE) {
				//DELETE...
				uriRequest = new HttpDelete(this.endpointUrl.concat(postfixUrlParam));
				uriRequest.setHeader(CONTENT_TYPE_HEADER, contentTypeParam.toString());
			}

			//Check that the URI request is set.
			if(uriRequest == null) {
				throw new FluidClientException(
						"URI Request is not set for HTTP Method '"+httpMethodParam+"'.",
						FluidClientException.ErrorCode.ILLEGAL_STATE_ERROR);
			}

			//Set additional headers...
			if(headerNameValuesParam != null && !headerNameValuesParam.isEmpty()) {

				for(HeaderNameValue headerNameVal : headerNameValuesParam) {
					if(headerNameVal.getName() == null || headerNameVal.getName().trim().isEmpty()) {
						continue;
					}

					if(headerNameVal.getValue() == null) {
						continue;
					}

					uriRequest.setHeader(headerNameVal.getName(), headerNameVal.getValue());
				}
			}

			//When HttpEntity Enclosing Request Base...
			if(uriRequest instanceof HttpEntityEnclosingRequestBase) {
				HttpEntity httpEntity = new StringEntity(stringParam, contentTypeParam);
				((HttpEntityEnclosingRequestBase)uriRequest).setEntity(httpEntity);
			}

			// Create a custom response handler
			ResponseHandler<String> responseHandler = this.getJsonResponseHandler(
					this.endpointUrl.concat(postfixUrlParam));

			responseBody = this.executeHttp(httpclient, uriRequest,
					responseHandler, postfixUrlParam);

			if(responseBody == null || responseBody.trim().isEmpty()) {
				throw new FluidClientException(
						"No response data from '"+
								this.endpointUrl.concat(postfixUrlParam)+"'.",
						FluidClientException.ErrorCode.IO_ERROR);
			}

			return responseBody;
		} catch (FluidClientException fluidClientExcept) {
			//Fluid Client Exception...
			throw fluidClientExcept;
		} catch (Exception otherExcept) {
			//Other Exceptions...
			throw new FluidClientException(otherExcept.getMessage(),
					otherExcept, FluidClientException.ErrorCode.ILLEGAL_STATE_ERROR);
		}
	}
protected String executeTxtReceiveTxt(
			HttpMethod httpMethodParam,
			List<HeaderNameValue> headerNameValuesParam,
			boolean checkConnectionValidParam,
			String stringParam,
			ContentType contentTypeParam,
			String postfixUrlParam
	) {
		if(stringParam == null || stringParam.isEmpty()) {
			throw new FluidClientException("No JSON body to post.",
					FluidClientException.ErrorCode.FIELD_VALIDATE);
		}

		//Check connection...
		if(checkConnectionValidParam && !this.isConnectionValid()) {
			throw new FluidClientException(
					"Unable to reach service at '"+
							this.endpointUrl.concat(postfixUrlParam)+"'.",
					FluidClientException.ErrorCode.CONNECT_ERROR);
		}

		CloseableHttpClient httpclient = this.getClient();

		String responseBody = null;

		try {
			HttpUriRequest uriRequest = null;

			//POST...
			if(httpMethodParam == HttpMethod.POST) {
				//When its html Form Data...
				if(contentTypeParam == ContentType.APPLICATION_FORM_URLENCODED) {
					RequestBuilder builder = RequestBuilder.post().setUri(
							this.endpointUrl.concat(postfixUrlParam));

					builder = this.addParamsToBuildFromString(builder,stringParam);
					uriRequest = builder.build();
				} else {
					//JSON or any other...
					uriRequest = new HttpPost(this.endpointUrl.concat(postfixUrlParam));
				}

				uriRequest.setHeader(CONTENT_TYPE_HEADER, contentTypeParam.toString());
			} else if(httpMethodParam == HttpMethod.PUT) {
				//PUT...
				if(contentTypeParam == ContentType.APPLICATION_FORM_URLENCODED) {
					RequestBuilder builder = RequestBuilder.put().setUri(
							this.endpointUrl.concat(postfixUrlParam));

					builder = this.addParamsToBuildFromString(builder, stringParam);
					uriRequest = builder.build();
				} else {
					uriRequest = new HttpPut(this.endpointUrl.concat(postfixUrlParam));
					uriRequest.setHeader(CONTENT_TYPE_HEADER, contentTypeParam.toString());
				}
			} else if(httpMethodParam == HttpMethod.DELETE) {
				//DELETE...
				uriRequest = new HttpDelete(this.endpointUrl.concat(postfixUrlParam));
				uriRequest.setHeader(CONTENT_TYPE_HEADER, contentTypeParam.toString());
			}

			//Check that the URI request is set.
			if(uriRequest == null) {
				throw new FluidClientException(
						"URI Request is not set for HTTP Method '"+httpMethodParam+"'.",
						FluidClientException.ErrorCode.ILLEGAL_STATE_ERROR);
			}

			//Set additional headers...
			if(headerNameValuesParam != null && !headerNameValuesParam.isEmpty()) {

				for(HeaderNameValue headerNameVal : headerNameValuesParam) {
					if(headerNameVal.getName() == null || headerNameVal.getName().trim().isEmpty()) {
						continue;
					}

					if(headerNameVal.getValue() == null) {
						continue;
					}

					uriRequest.setHeader(headerNameVal.getName(), headerNameVal.getValue());
				}
			}

			//When HttpEntity Enclosing Request Base...
			if(uriRequest instanceof HttpEntityEnclosingRequestBase) {
				HttpEntity httpEntity = new StringEntity(stringParam, contentTypeParam);
				((HttpEntityEnclosingRequestBase)uriRequest).setEntity(httpEntity);
			}

			// Create a custom response handler
			ResponseHandler<String> responseHandler = this.getJsonResponseHandler(
					this.endpointUrl.concat(postfixUrlParam));

			responseBody = this.executeHttp(httpclient, uriRequest,
					responseHandler, postfixUrlParam);

			if(responseBody == null || responseBody.trim().isEmpty()) {
				throw new FluidClientException(
						"No response data from '"+
								this.endpointUrl.concat(postfixUrlParam)+"'.",
						FluidClientException.ErrorCode.IO_ERROR);
			}

			return responseBody;
		} catch (FluidClientException fluidClientExcept) {
			//Fluid Client Exception...
			throw fluidClientExcept;
		} catch (Exception otherExcept) {
			//Other Exceptions...
			throw new FluidClientException(otherExcept.getMessage(),
					otherExcept, FluidClientException.ErrorCode.ILLEGAL_STATE_ERROR);
		}
	}
protected String executeTxtReceiveTxt ( HttpMethod httpMethodParam , List < HeaderNameValue > headerNameValuesParam , boolean checkConnectionValidParam , String stringParam , ContentType contentTypeParam , String postfixUrlParam ) { if ( stringParam == null || stringParam . isEmpty ( ) ) { throw new FluidClientException ( "No JSON body to post." , FluidClientException . ErrorCode . FIELD_VALIDATE ) ; } //Check connection... if ( checkConnectionValidParam && ! this . isConnectionValid ( ) ) { throw new FluidClientException ( "Unable to reach service at '" + this . endpointUrl . concat ( postfixUrlParam ) + "'." , FluidClientException . ErrorCode . CONNECT_ERROR ) ; } CloseableHttpClient httpclient = this . getClient ( ) ; String responseBody = null ; try { HttpUriRequest uriRequest = null ; //POST... if ( httpMethodParam == HttpMethod . POST ) { //When its html Form Data... if ( contentTypeParam == ContentType . APPLICATION_FORM_URLENCODED ) { RequestBuilder builder = RequestBuilder . post ( ) . setUri ( this . endpointUrl . concat ( postfixUrlParam ) ) ; builder = this . addParamsToBuildFromString ( builder , stringParam ) ; uriRequest = builder . build ( ) ; } else { //JSON or any other... uriRequest = new HttpPost ( this . endpointUrl . concat ( postfixUrlParam ) ) ; } uriRequest . setHeader ( CONTENT_TYPE_HEADER , contentTypeParam . toString ( ) ) ; } else if ( httpMethodParam == HttpMethod . PUT ) { //PUT... if ( contentTypeParam == ContentType . APPLICATION_FORM_URLENCODED ) { RequestBuilder builder = RequestBuilder . put ( ) . setUri ( this . endpointUrl . concat ( postfixUrlParam ) ) ; builder = this . addParamsToBuildFromString ( builder , stringParam ) ; uriRequest = builder . build ( ) ; } else { uriRequest = new HttpPut ( this . endpointUrl . concat ( postfixUrlParam ) ) ; uriRequest . setHeader ( CONTENT_TYPE_HEADER , contentTypeParam . toString ( ) ) ; } } else if ( httpMethodParam == HttpMethod . DELETE ) { //DELETE... uriRequest = new HttpDelete ( this . endpointUrl . concat ( postfixUrlParam ) ) ; uriRequest . setHeader ( CONTENT_TYPE_HEADER , contentTypeParam . toString ( ) ) ; } //Check that the URI request is set. if ( uriRequest == null ) { throw new FluidClientException ( "URI Request is not set for HTTP Method '" + httpMethodParam + "'." , FluidClientException . ErrorCode . ILLEGAL_STATE_ERROR ) ; } //Set additional headers... if ( headerNameValuesParam != null && ! headerNameValuesParam . isEmpty ( ) ) { for ( HeaderNameValue headerNameVal : headerNameValuesParam ) { if ( headerNameVal . getName ( ) == null || headerNameVal . getName ( ) . trim ( ) . isEmpty ( ) ) { continue ; } if ( headerNameVal . getValue ( ) == null ) { continue ; } uriRequest . setHeader ( headerNameVal . getName ( ) , headerNameVal . getValue ( ) ) ; } } //When HttpEntity Enclosing Request Base... if ( uriRequest instanceof HttpEntityEnclosingRequestBase ) { HttpEntity httpEntity = new StringEntity ( stringParam , contentTypeParam ) ; ( ( HttpEntityEnclosingRequestBase ) uriRequest ) . setEntity ( httpEntity ) ; } // Create a custom response handler ResponseHandler < String > responseHandler = this . getJsonResponseHandler ( this . endpointUrl . concat ( postfixUrlParam ) ) ; responseBody = this . executeHttp ( httpclient , uriRequest , responseHandler , postfixUrlParam ) ; if ( responseBody == null || responseBody . trim ( ) . isEmpty ( ) ) { throw new FluidClientException ( "No response data from '" + this . endpointUrl . concat ( postfixUrlParam ) + "'." , FluidClientException . ErrorCode . IO_ERROR ) ; } return responseBody ; } catch ( FluidClientException fluidClientExcept ) { //Fluid Client Exception... throw fluidClientExcept ; } catch ( Exception otherExcept ) { //Other Exceptions... throw new FluidClientException ( otherExcept . getMessage ( ) , otherExcept , FluidClientException . ErrorCode . ILLEGAL_STATE_ERROR ) ; } }
Submit the {@code stringParam} as HTTP request body with JSON as a response.

@param httpMethodParam The HTTP method to use.
@param headerNameValuesParam The additional HTTP headers.
@param checkConnectionValidParam Check if connection to base endpoint is valid.
@param stringParam The Text to submit.
@param contentTypeParam The Mime / Content type to submit as.
@param postfixUrlParam URL mapping after the Base endpoint.

@return Return body as JSON.

@see HttpMethod
@see JSONObject
@see ContentType
@see ABaseFluidJSONObject
Submit the { @code stringParam } as HTTP request body with JSON as a response .