use of jakarta.xml.ws.soap.SOAPFaultException in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersClient method testEPRGetPortVIIIII.
public void testEPRGetPortVIIIII() throws Exception {
if (ClientServerTestUtil.useLocal()) {
System.out.println("HTTP Transport Only Exiting");
return;
}
AddNumbersPortType proxy = createStub();
EndpointReference epr = ((BindingProvider) proxy).getEndpointReference(MemberSubmissionEndpointReference.class);
RespectBindingFeature feature = new RespectBindingFeature(true);
MemberSubmissionAddressingFeature addr = new MemberSubmissionAddressingFeature(true, true);
WebServiceFeature[] features = new WebServiceFeature[] { feature, addr };
AddNumbersPortType port = epr.getPort(AddNumbersPortType.class, features);
assertTrue(port != null);
try {
System.out.println("Adding numbers 2 and 4");
int result = port.addNumbers(2, 4);
assertFalse(result == 6);
} catch (Exception ex) {
assertTrue(ex instanceof SOAPFaultException);
System.out.println(((SOAPFaultException) ex).getFault().getFaultString());
}
}
use of jakarta.xml.ws.soap.SOAPFaultException in project metro-jax-ws by eclipse-ee4j.
the class DispatchHeaderTest method testEchoSource.
public void testEchoSource() throws Exception {
init(endpointAddress, portQName, serviceQName, null);
Source source = makeStreamSource(echoRequest);
Dispatch dispatch = getDispatchSource();
try {
System.err.println("************Expected EXCEPTION***************");
Object result = dispatch.invoke(source);
assertTrue(result == null);
} catch (Exception sfe) {
System.err.println("************End Expected EXCEPTION***************");
assertTrue(sfe instanceof SOAPFaultException);
}
}
use of jakarta.xml.ws.soap.SOAPFaultException in project metro-jax-ws by eclipse-ee4j.
the class DispatchHelloClientTest method testNoParamHelloRequestResponseJAXBNegative.
// should send empty SOAPBody here - no argument returned or perhaps server side exception
// nillable allowed message
public void testNoParamHelloRequestResponseJAXBNegative() throws Throwable {
JAXBContext jc = null;
HelloRequest hello = null;
HelloResponse helloResult = null;
try {
jc = createJAXBContext();
} catch (Exception jbe) {
fail("Problem creating jaxb context");
}
try {
// no hello args
Dispatch dispatch = getDispatchJAXB();
Object result = dispatch.invoke(null);
assertTrue(result == null);
} catch (Exception e) {
assertTrue(e instanceof SOAPFaultException);
System.out.println("NoParamHelloRequestResponseJAXBNegative PASSED");
}
}
use of jakarta.xml.ws.soap.SOAPFaultException in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testNoParamHelloRequestResponseJAXB.
// todo:investigate failed assertion bad JAXB message should fail after invocation RemoteException?
/* public void testHelloResponseBadRequestResponseJAXB() throws Throwable {
JAXBContext jc = null;
NameType hello = null;
HelloResponse helloResult = null;
jc = createJAXBContext();
hello = new NameType();
helloResult = new HelloResponse();
try {
//no remote method
hello.getName().add("foo");
Dispatch dispatch = getDispatchJAXB();
Object result = dispatch.invoke(hello);
System.out.println(" testHelloResponseBadRequestResponseJAXB FAILED");
} catch (Exception e) {
try {
assertTrue(e instanceof SOAPFaultException);
//assertTrue(e.getCause() instanceof SOAPFaultException);
System.out.println(" testHelloResponseBadRequestResponseJAXB PASSED");
} catch (Exception ex){
System.out.println(" testHelloResponseBadRequestResponseJAXB FAILED");
}
}
}
*/
// todo:Investigate failed assertion invoking Result not request - expect remoteException w/SOAPFailtEx
/* public void testHelloResponseBad2RequestResponseJAXB() throws Throwable {
JAXBContext jc = null;
HelloResponse helloResult = null;
try {
jc = createJAXBContext();
helloResult = new HelloResponse();
} catch (Exception jbe) {
jbe.printStackTrace();
}
try {
helloResult.setExtra("Test ");
helloResult.setArgument("Dispatch ");
Dispatch dispatch = getDispatchJAXB();
Object result = dispatch.invoke(helloResult);
System.out.println(" testHelloResponseBadRequestResponseJAXB FAILED");
} catch (Exception e) {
try {
assertTrue(e instanceof SOAPFaultException);
//assertTrue(e.getCause() instanceof SOAPFaultException);
System.out.println(" testHelloResponseBad3RequestResponseJAXB PASSED");
} catch (Exception ex){
System.out.println(" testHelloResponseBadRequestResponseJAXB FAILED");
}
}
}
*/
public void testNoParamHelloRequestResponseJAXB() throws Throwable {
JAXBContext jc = null;
Hello_Type hello = null;
HelloResponse helloResult = null;
try {
jc = createJAXBContext();
hello = new Hello_Type();
helloResult = new HelloResponse();
} catch (Exception jbe) {
assertTrue(jbe instanceof JAXBException);
}
try {
// no hello args
Dispatch dispatch = getDispatchJAXB();
Object result = dispatch.invoke(null);
assertTrue(result == null);
// System.out.println("NoParamHelloRequestResponseJAXB FAILED");
} catch (Exception e) {
assertTrue(e instanceof SOAPFaultException);
System.out.println("no param result is " + e.getClass().getName());
// assertTrue(e instanceof WebServiceException);
System.out.println("NoParamHelloRequestResponseJAXB PASSED");
}
}
use of jakarta.xml.ws.soap.SOAPFaultException in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testBad3HelloRequestResponseXML.
// bad namespace- expect remote exception
public void testBad3HelloRequestResponseXML() {
Dispatch dispatch = getDispatchSource();
Source source = makeStreamSource(bad3helloMsg);
Source response = makeStreamSource(helloResponse);
try {
Object result = dispatch.invoke(source);
assertTrue(result == null);
System.out.println("B3HelloRR invoke succeded");
} catch (Exception e) {
assertTrue(e instanceof SOAPFaultException);
System.out.println("testBad3HelloRequestResponseXML Passed");
}
}
Aggregations