How to use SoapMessage method of com.consol.citrus.dsl.builder.SoapServerFaultResponseActionBuilder class

Best Citrus code snippet using com.consol.citrus.dsl.builder.SoapServerFaultResponseActionBuilder.SoapMessage

Source:SoapServerFaultResponseActionBuilder.java Github

copy

Full Screen

...31 * @since 2.632 */33public class SoapServerFaultResponseActionBuilder extends SendMessageBuilder<SendSoapFaultAction, SoapServerFaultResponseActionBuilder> {34 /** Soap message to send or receive */35 private SoapMessage soapMessage = new SoapMessage();36 /**37 * Default constructor using soap client endpoint.38 * @param delegate39 * @param soapServer40 */41 public SoapServerFaultResponseActionBuilder(DelegatingTestAction<TestAction> delegate, Endpoint soapServer) {42 super(delegate);43 delegate.setDelegate(new SendSoapFaultAction());44 getAction().setEndpoint(soapServer);45 message(soapMessage);46 }47 @Override48 protected void setPayload(String payload) {49 soapMessage.setPayload(payload);50 }51 /**52 * Sets the attachment with string content.53 * @param contentId54 * @param contentType55 * @param content56 * @return57 */58 public SoapServerFaultResponseActionBuilder attachment(String contentId, String contentType, String content) {59 SoapAttachment attachment = new SoapAttachment();60 attachment.setContentId(contentId);61 attachment.setContentType(contentType);62 attachment.setContent(content);63 getAction().getAttachments().add(attachment);64 return this;65 }66 /**67 * Sets the attachment with content resource.68 * @param contentId69 * @param contentType70 * @param contentResource71 * @return72 */73 public SoapServerFaultResponseActionBuilder attachment(String contentId, String contentType, Resource contentResource) {74 return attachment(contentId, contentType, contentResource, FileUtils.getDefaultCharset());75 }76 /**77 * Sets the attachment with content resource.78 * @param contentId79 * @param contentType80 * @param contentResource81 * @param charset82 * @return83 */84 public SoapServerFaultResponseActionBuilder attachment(String contentId, String contentType, Resource contentResource, Charset charset) {85 SoapAttachment attachment = new SoapAttachment();86 attachment.setContentId(contentId);87 attachment.setContentType(contentType);88 try {89 attachment.setContent(FileUtils.readToString(contentResource, charset));90 } catch (IOException e) {91 throw new CitrusRuntimeException("Failed to read attachment resource", e);92 }93 getAction().getAttachments().add(attachment);94 return this;95 }96 /**97 * Sets the charset name for this send action builder's attachment.98 * @param charsetName99 * @return100 */101 public SoapServerFaultResponseActionBuilder charset(String charsetName) {102 if (!getAction().getAttachments().isEmpty()) {103 getAction().getAttachments().get(getAction().getAttachments().size() - 1).setCharsetName(charsetName);104 }105 return this;106 }107 /**108 * Sets the attachment from Java object instance.109 * @param attachment110 * @return111 */112 public SoapServerFaultResponseActionBuilder attachment(SoapAttachment attachment) {113 soapMessage.addAttachment(attachment);114 return this;115 }116 /**117 * Sets the response status.118 * @param status119 * @return120 */121 public SoapServerFaultResponseActionBuilder status(HttpStatus status) {122 soapMessage.header(SoapMessageHeaders.HTTP_STATUS_CODE, status.value());123 return this;124 }125 /**126 * Sets the response status code.127 * @param statusCode128 * @return129 */130 public SoapServerFaultResponseActionBuilder statusCode(Integer statusCode) {131 soapMessage.header(SoapMessageHeaders.HTTP_STATUS_CODE, statusCode);132 return this;133 }134 /**135 * Sets the response content type header.136 * @param contentType137 * @return138 */139 public SoapServerFaultResponseActionBuilder contentType(String contentType) {140 soapMessage.header(SoapMessageHeaders.HTTP_CONTENT_TYPE, contentType);141 return this;142 }143 /**144 * Adds custom SOAP fault code.145 * @param code146 * @return147 */148 public SoapServerFaultResponseActionBuilder faultCode(String code) {149 getAction().setFaultCode(code);150 return this;151 }152 /**153 * Add custom fault string to SOAP fault message.154 * @param faultString...

Full Screen

Full Screen

SoapMessage

Using AI Code Generation

copy

Full Screen

1soapServer().fault(soapFaultBuilder -> soapFaultBuilder2 .faultString("Internal Server Error")3 .detail("detail", "detail message")4 .detail("detail2", "detail message 2"));5soapServer().fault(soapFaultBuilder -> soapFaultBuilder6 .faultString("Internal Server Error")7 .detail("detail", "detail message")8 .detail("detail2", "detail message 2"));9soapServer().fault(soapFaultBuilder -> soapFaultBuilder10 .faultString("Internal Server Error")11 .detail("detail", "detail message")12 .detail("detail2", "detail message 2"));13soapServer().fault(soapFaultBuilder -> soapFaultBuilder14 .faultString("Internal Server Error")15 .detail("detail", "detail message")16 .detail("detail2", "detail message 2"));17soapServer().fault(soapFaultBuilder -> soapFaultBuilder18 .faultString("Internal Server Error")19 .detail("detail", "detail message")20 .detail("detail2", "detail message 2"));21soapServer().fault(soapFaultBuilder

Full Screen

Full Screen

SoapMessage

Using AI Code Generation

copy

Full Screen

1public class SoapFaultBuilderTest {2 public void soapFaultBuilderTest() {3 variable("faultCode", "soap:Server");4 variable("faultString", "Internal Server Error");5 variable("faultDetail", "Error occurred while processing request");6 variable("faultCodeWithPrefix", "soap:Server");7 variable("faultStringWithPrefix", "Internal Server Error");8 variable("faultDetailWithPrefix", "Error occurred while processing request");9 variable("faultCodeWithNamespace", "soap:Server");10 variable("faultStringWithNamespace", "Internal Server Error");11 variable("faultDetailWithNamespace", "Error occurred while processing request");12 variable("faultCodeWithPrefixAndNamespace", "soap:Server");13 variable("faultStringWithPrefixAndNamespace", "Internal Server Error");14 variable("faultDetailWithPrefixAndNamespace", "Error occurred while processing request");15 variable("faultCodeWithNamespaceAndPrefix", "soap:Server");16 variable("faultStringWithNamespaceAndPrefix", "Internal Server Error");17 variable("faultDetailWithNamespaceAndPrefix", "Error occurred while processing request");18 http()19 .client("httpClient")20 .send()21 .post("/citrus/services/hello")22 .contentType("text/xml")

Full Screen

Full Screen

SoapMessage

Using AI Code Generation

copy

Full Screen

1new SoapServerFaultResponseActionBuilder()2 .faultString("Test error")3new SoapServerFaultResponseActionBuilder()4 .faultString("Test error")5 .faultReason("Test reason")6new SoapServerFaultResponseActionBuilder()7 .faultString("Test error")8 .faultReason("Test reason")9 .faultReasonText("Test reason text")10 .faultDetailText("Test detail text");11new SoapServerFaultResponseActionBuilder()12 .faultString("Test error")

Full Screen

Full Screen

SoapMessage

Using AI Code Generation

copy

Full Screen

1soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();2soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();3soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();4soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();5soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();6soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();7soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();8soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();9soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();10soap().fault().faultCode("Client").faultString("Invalid request").faultDetail("No valid request message received").build();

Full Screen

Full Screen

SoapMessage

Using AI Code Generation

copy

Full Screen

1 .faultString("Server fault occurred")2 .faultDetail("<faultDetail>Some detail information</faultDetail>")3 .faultDetailResource("<faultDetail>Some detail information</faultDetail>")4 .faultDetailResourcePath("classpath:com/consol/citrus/ws/faultDetail.xml")5 .faultDetailResourceUri("file:/home/citrus/faultDetail.xml")6 .faultDetailResourceData("Some detail information")7 .faultDetailResourceData("<faultDetail>Some detail information</faultDetail>".getBytes())8 .faultDetailResourceData("Some detail information".getBytes(), "UTF-8")9 .faultDetailResourceData("<faultDetail>Some detail information</faultDetail>".getBytes(), "UTF-8")10 .faultDetailResourceDataResource("<faultDetail>Some detail information</faultDetail>".getBytes())11 .faultDetailResourceDataResource("classpath:com/consol/citrus/ws/faultDetail.xml")12 .faultDetailResourceDataResource("file:/home/citrus/faultDetail.xml")13 .faultDetailResourceDataResourcePath("classpath:com/consol/citrus/ws/faultDetail.xml")14 .faultDetailResourceDataResourceUri("file:/home/citrus/faultDetail.xml")15 .faultDetailResourceDataResourceUri("file:/home/citrus/faultDetail.xml", "UTF-8")16 .faultDetailResourceDataResourcePath("classpath:com/consol/citrus/ws/faultDetail.xml", "UTF-8")17 .soapMessage("<faultDetail>Some detail information</faultDetail>");18 .faultString("Server fault occurred")19 .faultDetail("<faultDetail>Some detail information</faultDetail>")20 .faultDetailResource("<faultDetail>Some detail information</faultDetail>")21 .faultDetailResourcePath("classpath:com/consol/citrus/ws/faultDetail.xml")22 .faultDetailResourceUri("file:/home/cit

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Citrus automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful