use of jakarta.xml.ws.wsaddressing.W3CEndpointReferenceBuilder in project metro-jax-ws by eclipse-ee4j.
the class HelloLiteralTest method testEchoArray.
// Tests epr overriding
// epr(1 reference parameter) passed as argument overrides epr in wsdl(2 reference parameters)
public void testEchoArray() throws Exception {
try {
String xmlParam1 = "<myns:MyParam1 xmlns:myns=\"http://cptestservice.org/wsdl\">Hello</myns:MyParam1>";
Node n1 = DOMUtil.createDOMNode(new ByteArrayInputStream(xmlParam1.getBytes()));
String endpointAddress = (String) ((BindingProvider) stub).getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
W3CEndpointReferenceBuilder eprBuilder = new W3CEndpointReferenceBuilder();
eprBuilder.address(endpointAddress);
eprBuilder.referenceParameter((Element) n1.getFirstChild());
W3CEndpointReference epr = eprBuilder.build();
Hello_Service service = new Hello_Service();
Hello newStub = service.getPort(epr, Hello.class);
String[] in = { "JAXRPC 1.0", "JAXRPC 1.1", "JAXRPC 1.1.2", "JAXRPC 2.0" };
NameType nt = new NameType();
nt.getName().add(in[0]);
nt.getName().add(in[1]);
nt.getName().add(in[2]);
nt.getName().add(in[3]);
jakarta.xml.ws.Holder<NameType> req = new jakarta.xml.ws.Holder<NameType>(nt);
newStub.echoArray(req);
assertTrue(req.value == null);
} catch (Exception e) {
e.printStackTrace();
assertTrue(false);
}
}
Aggregations