use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testNoParamHelloRequestResponseJAXB.
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 WebServiceException);
System.out.println("NoParamHelloRequestResponseJAXB PASSED");
}
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testSQETestXML.
public void testSQETestXML() throws WebServiceException, Exception {
// System.err.println("----------------Expected Message ----------------------");
Dispatch dispatch = getDispatchSource();
Source source = null;
Source response = null;
try {
source = makeStreamSource(sqeTest);
} catch (Exception e) {
System.out.println("Error making msg source exiting");
}
try {
Object result = dispatch.invoke(source);
String xmlResult = sourceToXMLString((Source) result);
System.out.println("Got result : " + xmlResult);
assertTrue(result == null);
System.out.println("sqeXML Passed");
} catch (Exception ex) {
assertTrue(ex instanceof SOAPFaultException);
}
// System.err.println("----------------END Expected Message ----------------------");
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testDispatchPropertySoapUseAction.
public void testDispatchPropertySoapUseAction() {
try {
Dispatch dispatch = getDispatchSource();
Source source = makeStreamSource(helloMsg);
List<Handler> handlerchain = new ArrayList<Handler>();
handlerchain.add(new MyHandler());
dispatch.getBinding().setHandlerChain(handlerchain);
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "urn:test:hello_mod");
Object result = dispatch.invoke(source);
assertTrue(result instanceof Source);
String xmlResult = sourceToXMLString((Source) result);
System.out.println("Got result : " + xmlResult);
// tbd update assertion
} catch (Exception ex) {
fail("SOAPAction test fails");
}
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHello method testHelloRequestResponseJAXB.
public void testHelloRequestResponseJAXB() throws Exception {
JAXBContext jc = null;
HelloResponse helloResult = null;
Hello_Type hello = new Hello_Type();
jc = createJAXBContext();
try {
hello.setArgument("foo");
hello.setExtra("Test ");
Dispatch dispatch = getDispatchJAXB();
Object result = dispatch.invoke(hello);
assertEquals(((HelloResponse) result).getExtra(), hello.getExtra());
assertEquals(((HelloResponse) result).getArgument(), hello.getArgument());
} catch (WebServiceException jex) {
jex.printStackTrace();
fail("testHelloRequestResponseJAXB FAILED");
}
}
use of jakarta.xml.ws.Dispatch in project metro-jax-ws by eclipse-ee4j.
the class DispatchHelloLiteralTest method testHelloAsyncPollSOAPMessage.
public void testHelloAsyncPollSOAPMessage() throws Exception {
Dispatch dispatch = getDispatchSOAPMessage();
SOAPMessage msg = getSOAPMessage(makeStreamSource(helloSM));
try {
Response<SOAPMessage> result = dispatch.invokeAsync(msg);
assertTrue(result != null);
SOAPMessage resultmsg = result.get();
assertTrue(resultmsg != null);
System.out.println("-----------------------------------------");
System.out.println("SOAPMessage Result = ");
resultmsg.writeTo(System.out);
System.out.println("-----------------------------------------");
} catch (Exception e) {
e.printStackTrace();
fail("Test fails");
}
}
Aggregations