use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method kkktestBad3HelloRequestResponseXML.
// bad namespace- expect SFE
public void kkktestBad3HelloRequestResponseXML() {
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) {
try {
assertTrue(e instanceof SOAPFaultException);
System.out.println("testBad3HelloRequestResponseXML Passed");
} catch (Exception ex) {
System.err.println("Expected SOAPFAULTException - got " + ex.getClass().getName());
System.out.println("testBad3HelloRequestResponseXML FAILED");
fail("testBad3HelloRequestResponseXML FAILED");
}
}
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testHelloRequestResponseSOAPMessageSource.
public void testHelloRequestResponseSOAPMessageSource() throws Exception {
Dispatch dispatch = getDispatchSOAPMessageSource();
Source source = makeStreamSource(helloSM);
Object result = dispatch.invoke(source);
System.out.println("Result class is " + result.getClass().getName());
// todo: need to check contents
assertTrue(result instanceof Source);
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testHelloRequestResponseSOAPMessage.
public void testHelloRequestResponseSOAPMessage() throws Exception {
Dispatch dispatch = getDispatchSOAPMessage();
assertTrue(dispatch != null);
assertTrue(dispatch instanceof com.sun.xml.ws.client.dispatch.SOAPMessageDispatch);
byte[] bytes = helloSM.getBytes();
ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
Source source = makeStreamSource(helloSM);
SOAPMessage message = getSOAPMessage(source);
Object result = dispatch.invoke(message);
// todo:need to check contents
assertTrue(result instanceof SOAPMessage);
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testHelloRequestResponseXML.
public void testHelloRequestResponseXML() throws Exception {
Dispatch dispatch = getDispatchSource();
assertTrue(dispatch != null);
/* Source request = makeStreamSource(helloMsg);
Object result = dispatch.invoke(request);
assertTrue(result instanceof Source);
String xmlResult = sourceToXMLString((Source) result);
System.out.println("Got result : " + xmlResult);
*/
/*
Does not work with out source types-ie DomSource, saxSource
*/
Collection<Source> sourceList = makeMsgSource(helloMsg);
Collection<Source> responseList = makeMsgSource(helloResponse);
try {
for (Iterator iter = sourceList.iterator(); iter.hasNext(); ) {
Object sourceObject = iter.next();
Object result = dispatch.invoke(sourceObject);
assertTrue(result instanceof Source);
String xmlResult = sourceToXMLString((Source) result);
System.out.println("Got result : " + xmlResult);
}
} catch (Exception ex) {
ex.printStackTrace();
fail("testHelloRequestResponseXML FAILED");
}
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method kktestHelloRequestResponseHelloMsgBadFooXML.
// needs to be looked at
public void kktestHelloRequestResponseHelloMsgBadFooXML() {
// test for bug6323952
Dispatch dispatch = getDispatchSource();
Source source = makeStreamSource(helloMsgBadFoo);
Source response = makeStreamSource(helloResponse);
try {
Source result = (Source) dispatch.invoke(source);
// assertTrue(result == null);
// printout result
// in actuality a soapFaultMessage need to be returned.
String xmlResult = sourceToXMLString(result);
System.out.println("Got result : " + xmlResult);
} catch (Exception e) {
try {
assertTrue(e instanceof SOAPFaultException);
SOAPFaultException sfe = (SOAPFaultException) e;
if (sfe.getMessage() != null)
System.out.println("sfe message " + sfe.getMessage());
System.out.println("e class " + e.getClass().getName());
if (e.getCause() != null)
System.out.println("Cause is " + e.getCause().getClass().getName());
// assertTrue(e instanceof SOAPFaultException);
System.out.println("testHelloRequestBadFooResponseXML Passed");
} catch (Exception ex) {
System.err.println("Expected SOAPFAULTException - got " + ex.getClass().getName());
System.out.println("testHelloRequestBadFooResponseXML FAILED");
fail("testHelloRequestBadFooResponseXML FAILED");
}
}
}
Aggregations