Search in sources :

Example 1 with UnknownPersonFault

use of org.apache.camel.non_wrapper.UnknownPersonFault in project camel by apache.

the class CxfNonWrapperTest method testInvokingServiceFromCXFClient.

@Test
public void testInvokingServiceFromCXFClient() throws Exception {
    URL wsdlURL = getClass().getClassLoader().getResource("person-non-wrapper.wsdl");
    PersonService ss = new PersonService(wsdlURL, new QName("http://camel.apache.org/non-wrapper", "PersonService"));
    Person client = ss.getSoap();
    ((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + port1 + "/CxfNonWrapperTest/PersonService/");
    GetPerson request = new GetPerson();
    request.setPersonId("hello");
    GetPersonResponse response = client.getPerson(request);
    assertEquals("we should get the right answer from router", "Bonjour", response.getName());
    request.setPersonId("");
    try {
        client.getPerson(request);
        fail("We expect to get the UnknowPersonFault here");
    } catch (UnknownPersonFault fault) {
    // We expect to get fault here
    }
}
Also used : GetPersonResponse(org.apache.camel.non_wrapper.types.GetPersonResponse) UnknownPersonFault(org.apache.camel.non_wrapper.UnknownPersonFault) QName(javax.xml.namespace.QName) PersonService(org.apache.camel.non_wrapper.PersonService) GetPerson(org.apache.camel.non_wrapper.types.GetPerson) GetPerson(org.apache.camel.non_wrapper.types.GetPerson) Person(org.apache.camel.non_wrapper.Person) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)1 QName (javax.xml.namespace.QName)1 Person (org.apache.camel.non_wrapper.Person)1 PersonService (org.apache.camel.non_wrapper.PersonService)1 UnknownPersonFault (org.apache.camel.non_wrapper.UnknownPersonFault)1 GetPerson (org.apache.camel.non_wrapper.types.GetPerson)1 GetPersonResponse (org.apache.camel.non_wrapper.types.GetPersonResponse)1 Test (org.junit.Test)1