use of org.apache.hello_world_xml_http.bare.types.MyComplexStructType in project cxf by apache.
the class XMLMessageOutInterceptorTest method testBareOutMultiWithRoot.
@Test
public void testBareOutMultiWithRoot() throws Exception {
MyComplexStructType myComplexStruct = new MyComplexStructType();
myComplexStruct.setElem1("elem1");
myComplexStruct.setElem2("elem2");
myComplexStruct.setElem3(45);
params.add("tli");
params.add(myComplexStruct);
common("/wsdl/hello_world_xml_bare.wsdl", new QName(bareNs, "XMLPort"), MyComplexStructType.class);
BindingInfo bi = super.serviceInfo.getBinding(new QName(bareNs, "Greeter_XMLBinding"));
BindingOperationInfo boi = bi.getOperation(new QName(bareNs, "testMultiParamPart"));
xmlMessage.getExchange().put(BindingOperationInfo.class, boi);
out.handleMessage(xmlMessage);
XMLStreamReader reader = getXMLReader();
DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
StaxUtils.nextEvent(dxr);
StaxUtils.toNextElement(dxr);
assertEquals(bareNs, dxr.getNamespaceURI());
assertEquals("multiParamRootReq", dxr.getLocalName());
StaxUtils.nextEvent(dxr);
StaxUtils.toNextElement(dxr);
assertEquals(bareRequestTypeQName, dxr.getName());
StaxUtils.nextEvent(dxr);
if (StaxUtils.toNextText(dxr)) {
assertEquals("tli", dxr.getText());
}
boolean foundRequest = false;
while (true) {
StaxUtils.nextEvent(dxr);
StaxUtils.toNextElement(dxr);
QName requestType = new QName(dxr.getNamespaceURI(), dxr.getLocalName());
if (requestType.equals(bareMyComplexStructQName)) {
foundRequest = true;
break;
}
}
assertEquals("found request type", true, foundRequest);
}
use of org.apache.hello_world_xml_http.bare.types.MyComplexStructType in project cxf by apache.
the class XMLMessageOutInterceptorTest method testBareOutSingle.
@Test
public void testBareOutSingle() throws Exception {
MyComplexStructType myComplexStruct = new MyComplexStructType();
myComplexStruct.setElem1("elem1");
myComplexStruct.setElem2("elem2");
myComplexStruct.setElem3(45);
params.add(myComplexStruct);
common("/wsdl/hello_world_xml_bare.wsdl", new QName(bareNs, "XMLPort"), MyComplexStructType.class);
BindingInfo bi = super.serviceInfo.getBinding(new QName(bareNs, "Greeter_XMLBinding"));
BindingOperationInfo boi = bi.getOperation(new QName(bareNs, "sendReceiveData"));
xmlMessage.getExchange().put(BindingOperationInfo.class, boi);
out.handleMessage(xmlMessage);
XMLStreamReader reader = getXMLReader();
DepthXMLStreamReader dxr = new DepthXMLStreamReader(reader);
StaxUtils.nextEvent(dxr);
StaxUtils.toNextElement(dxr);
assertEquals(bareMyComplexStructTypeQName.getLocalPart(), dxr.getLocalName());
StaxUtils.toNextElement(dxr);
StaxUtils.toNextText(dxr);
assertEquals(myComplexStruct.getElem1(), dxr.getText());
}
use of org.apache.hello_world_xml_http.bare.types.MyComplexStructType in project cxf by apache.
the class ClientServerXMLTest method testBareBasicConnection.
@Test
public void testBareBasicConnection() throws Exception {
XMLService service = new XMLService();
assertNotNull(service);
String response1 = "Hello ";
String response2 = "Bonjour";
try {
Greeter greeter = service.getPort(barePortName, Greeter.class);
updateAddressPort(greeter, REG_PORT);
String username = System.getProperty("user.name");
String reply = greeter.greetMe(username);
assertNotNull("no response received from service", reply);
assertEquals(response1 + username, reply);
reply = greeter.sayHi();
assertNotNull("no response received from service", reply);
assertEquals(response2, reply);
MyComplexStructType argument = new MyComplexStructType();
MyComplexStructType retVal = null;
String str1 = "this is element 1";
String str2 = "this is element 2";
int int1 = 42;
argument.setElem1(str1);
argument.setElem2(str2);
argument.setElem3(int1);
retVal = greeter.sendReceiveData(argument);
assertEquals(str1, retVal.getElem1());
assertEquals(str2, retVal.getElem2());
assertEquals(int1, retVal.getElem3());
} catch (UndeclaredThrowableException ex) {
throw (Exception) ex.getCause();
}
}
use of org.apache.hello_world_xml_http.bare.types.MyComplexStructType in project cxf by apache.
the class XMLMessageInInterceptorTest method testHandleMessageOnBareMultiParam.
@Test
public void testHandleMessageOnBareMultiParam() throws Exception {
String ns = "http://apache.org/hello_world_xml_http/bare";
prepareMessage("/message-bare-multi-param.xml");
common("/wsdl/hello_world_xml_bare.wsdl", new QName(ns, "XMLPort"), MyComplexStructType.class);
OperationInfo op = serviceInfo.getInterface().getOperation(new QName(ns, "testMultiParamPart"));
op.getInput().getMessagePartByIndex(0).setTypeClass(String.class);
op.getInput().getMessagePartByIndex(1).setTypeClass(MyComplexStructType.class);
in.handleMessage(xmlMessage);
docLitIn.handleMessage(xmlMessage);
List<?> list = xmlMessage.getContent(List.class);
assertNotNull(list);
assertEquals("expect 2 param", 2, list.size());
assertEquals("method input in2 is MyComplexStructType", true, list.get(1) instanceof MyComplexStructType);
assertEquals("method input in1 is String tli", true, ((String) list.get(0)).indexOf("tli") >= 0);
}
Aggregations