Search in sources :

Example 1 with SoapFaultClientException

use of org.springframework.ws.soap.client.SoapFaultClientException in project camel by apache.

the class AbstractConsumerTests method onlyCustomOutputSpecified4fault.

@Test
public void onlyCustomOutputSpecified4fault() throws Exception {
    ActionCallback requestCallback = channelIn("http://uriOutputOnly-fault.com/");
    try {
        webServiceTemplate.sendSourceAndReceiveToResult(source, requestCallback, result);
    } catch (SoapFaultClientException e) {
    // ok - cause fault response
    }
    Assertions.assertThat(channelOut().getAction()).isEqualTo(getDefaultResponseAction());
}
Also used : ActionCallback(org.springframework.ws.soap.addressing.client.ActionCallback) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) Test(org.junit.Test)

Example 2 with SoapFaultClientException

use of org.springframework.ws.soap.client.SoapFaultClientException in project camel by apache.

the class AbstractConsumerTests method onlyCustomFaultSpecified4fault.

@Test
public void onlyCustomFaultSpecified4fault() throws Exception {
    ActionCallback requestCallback = channelIn("http://uriFaultOnly-fault.com/");
    try {
        webServiceTemplate.sendSourceAndReceiveToResult(source, requestCallback, result);
    } catch (SoapFaultClientException e) {
    // ok - cause fault response
    }
    Assertions.assertThat(channelOut().getAction()).isEqualTo(new URI("http://customURIFaultAction"));
}
Also used : ActionCallback(org.springframework.ws.soap.addressing.client.ActionCallback) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) URI(java.net.URI) Test(org.junit.Test)

Example 3 with SoapFaultClientException

use of org.springframework.ws.soap.client.SoapFaultClientException in project camel by apache.

the class AbstractConsumerTests method overrideHeaderAction4fault.

@Test
@Ignore(value = "Not implemented yet")
public void overrideHeaderAction4fault() throws Exception {
    ActionCallback requestCallback = channelIn("http://override-fault.com");
    try {
        webServiceTemplate.sendSourceAndReceiveToResult(source, requestCallback, result);
    } catch (SoapFaultClientException e) {
    // ok - cause fault response
    }
    Assertions.assertThat(channelOut().getAction()).isEqualTo(new URI("http://faultHeader.com"));
}
Also used : ActionCallback(org.springframework.ws.soap.addressing.client.ActionCallback) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) URI(java.net.URI) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 4 with SoapFaultClientException

use of org.springframework.ws.soap.client.SoapFaultClientException in project camel by apache.

the class AbstractConsumerTests method customAction4fault.

@Test
public void customAction4fault() throws Exception {
    ActionCallback requestCallback = channelIn("http://uri-fault.com");
    try {
        webServiceTemplate.sendSourceAndReceiveToResult(source, requestCallback, result);
    } catch (SoapFaultClientException e) {
    // ok - cause fault response
    }
    Assertions.assertThat(channelOut().getAction()).isEqualTo(new URI("http://customURIFaultAction"));
}
Also used : ActionCallback(org.springframework.ws.soap.addressing.client.ActionCallback) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException) URI(java.net.URI) Test(org.junit.Test)

Example 5 with SoapFaultClientException

use of org.springframework.ws.soap.client.SoapFaultClientException in project webservices-axiom by apache.

the class BrokerScenarioTest method runTest.

@Override
protected void runTest() throws Throwable {
    BrokerClient client = context.getBean(BrokerClient.class);
    Order order = new Order();
    order.setCustomer(47892);
    Order.Item item1 = new Order.Item();
    item1.setStock("GOOG");
    item1.setCount(100);
    Order.Item item2 = new Order.Item();
    item2.setStock("MSFT");
    item2.setCount(10);
    order.setItems(new Order.Item[] { item1, item2 });
    OrderStatus status = client.order(order);
    assertNotNull(status.getReceived());
    Order receivedOrder = client.receiveNextOrder();
    assertNotNull(receivedOrder);
    assertEquals(order.getCustomer(), receivedOrder.getCustomer());
    assertEquals(order.getItems().length, receivedOrder.getItems().length);
    assertEquals(order.getItems()[0].getStock(), receivedOrder.getItems()[0].getStock());
    assertEquals(order.getItems()[0].getCount(), receivedOrder.getItems()[0].getCount());
    order.setCustomer(23629);
    // SOAP 1.2 fault processing is locale dependent
    Locale oldLocale = Locale.getDefault();
    Locale.setDefault(Locale.ENGLISH);
    try {
        client.order(order);
        fail("Expected SoapFaultClientException");
    } catch (SoapFaultClientException ex) {
        assertEquals(spec.getSenderFaultCode(), ex.getFaultCode());
        assertEquals("Customer 23629 unknown", ex.getMessage());
    } finally {
        Locale.setDefault(oldLocale);
    }
}
Also used : Locale(java.util.Locale) SoapFaultClientException(org.springframework.ws.soap.client.SoapFaultClientException)

Aggregations

SoapFaultClientException (org.springframework.ws.soap.client.SoapFaultClientException)7 Test (org.junit.Test)6 ActionCallback (org.springframework.ws.soap.addressing.client.ActionCallback)6 URI (java.net.URI)4 Ignore (org.junit.Ignore)2 Locale (java.util.Locale)1