use of org.apache.hello_world_xml_http.wrapped.types.GreetMe in project cxf by apache.
the class XMLMessageOutInterceptorTest method testWrapOut.
@Test
public void testWrapOut() throws Exception {
GreetMe greetMe = new GreetMe();
greetMe.setRequestType("tli");
params.add(greetMe);
common("/wsdl/hello_world_xml_wrapped.wsdl", new QName(wrapNs, "XMLPort"), GreetMe.class);
BindingInfo bi = super.serviceInfo.getBinding(new QName(wrapNs, "Greeter_XMLBinding"));
BindingOperationInfo boi = bi.getOperation(new QName(wrapNs, "greetMe"));
xmlMessage.getExchange().put(BindingOperationInfo.class, boi);
out.handleMessage(xmlMessage);
XMLStreamReader reader = getXMLReader();
DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
StaxUtils.nextEvent(dxr);
StaxUtils.toNextElement(dxr);
assertEquals(wrapGreetMeQName.getNamespaceURI(), dxr.getNamespaceURI());
assertEquals(wrapGreetMeQName.getLocalPart(), dxr.getLocalName());
StaxUtils.toNextElement(dxr);
StaxUtils.toNextText(dxr);
assertEquals(greetMe.getRequestType(), dxr.getText());
}
use of org.apache.hello_world_xml_http.wrapped.types.GreetMe in project cxf by apache.
the class DispatchXMLClientServerTest method testJAXBMESSAGE.
@Test
public void testJAXBMESSAGE() throws Exception {
Service service = Service.create(SERVICE_NAME);
assertNotNull(service);
service.addPort(PORT_NAME, "http://cxf.apache.org/bindings/xformat", "http://localhost:" + port + "/XMLService/XMLDispatchPort");
GreetMe gm = new GreetMe();
gm.setRequestType("CXF");
JAXBContext ctx = JAXBContext.newInstance(ObjectFactory.class);
Dispatch<Object> disp = service.createDispatch(PORT_NAME, ctx, Service.Mode.MESSAGE);
GreetMeResponse resp = (GreetMeResponse) disp.invoke(gm);
assertNotNull(resp);
assertEquals("Hello CXF", resp.getResponseType());
try {
disp.invoke(null);
fail("Should have thrown a fault");
} catch (WebServiceException ex) {
// expected
}
}
use of org.apache.hello_world_xml_http.wrapped.types.GreetMe in project cxf by apache.
the class XMLMessageInInterceptorTest method testHandleMessageWrapped.
@Test
public void testHandleMessageWrapped() throws Exception {
String ns = "http://apache.org/hello_world_xml_http/wrapped";
prepareMessage("/message-wrap.xml");
common("/wsdl/hello_world_xml_wrapped.wsdl", new QName(ns, "XMLPort"), GreetMe.class);
OperationInfo op = serviceInfo.getInterface().getOperation(new QName(ns, "greetMe"));
op.getInput().getMessagePartByIndex(0).setTypeClass(GreetMe.class);
in.handleMessage(xmlMessage);
docLitIn.handleMessage(xmlMessage);
List<?> list = xmlMessage.getContent(List.class);
assertNotNull(list);
assertEquals("expect 1 param", 1, list.size());
assertEquals("method input me is String tli", true, list.get(0) instanceof GreetMe);
}
Aggregations