use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class OnewayTester method getHttpStatus.
private int getHttpStatus(String address) throws Exception {
QName portName = new QName(NS, "OnewayEndpointPort");
QName serviceName = new QName(NS, "OnewayEndpointService");
Service service = Service.create(new URL(address + "?wsdl"), serviceName);
Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
String body = "<ns0:echoInteger xmlns:ns0='" + NS + "'><arg0>12345</arg0></ns0:echoInteger>";
d.invokeOneWay(new StreamSource(new StringReader(body)));
Map<String, Object> rc = ((BindingProvider) d).getResponseContext();
return (Integer) rc.get(MessageContext.HTTP_RESPONSE_CODE);
}
use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class OnewayTester method verify.
private String verify(String address) throws Exception {
QName portName = new QName(NS, "OnewayEndpointPort");
QName serviceName = new QName(NS, "OnewayEndpointService");
Service service = Service.create(new URL(address + "?wsdl"), serviceName);
Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
String body = "<ns0:verifyInteger xmlns:ns0='" + NS + "'/>";
Source response = d.invoke(new StreamSource(new StringReader(body)));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
transformer.transform(response, new StreamResult(bos));
bos.close();
return new String(bos.toByteArray());
}
use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class MetadataTester method testDispatchWithMultiplePort.
public void testDispatchWithMultiplePort() throws IOException, SAXException, XMLStreamException {
Service service = Service.create(JAXWSUtils.getFileOrURL(stsWSDL), new QName("http://tempuri.org/", "SecurityTokenService"));
Dispatch disp = service.createDispatch(new QName("http://tempuri.org/", "WSHttpBinding_ISecurityTokenService"), (JAXBContext) null, Service.Mode.PAYLOAD);
assertTrue(disp != null);
disp = service.createDispatch(new QName("http://tempuri.org/", "WSHttpBinding_ISecurityTokenService1"), (JAXBContext) null, Service.Mode.PAYLOAD);
assertTrue(disp != null);
disp = service.createDispatch(new QName("http://tempuri.org/", "CustomBinding_ISecurityTokenService1"), (JAXBContext) null, Service.Mode.PAYLOAD);
assertTrue(disp != null);
disp = service.createDispatch(new QName("http://tempuri.org/", "CustomBinding_ISecurityTokenService"), (JAXBContext) null, Service.Mode.PAYLOAD);
assertTrue(disp != null);
}
use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class WhitespaceTester method invoke.
private Source invoke(String address) throws Exception {
QName portName = new QName(NS, "RpcLitPort");
QName serviceName = new QName(NS, "RpcLitEndpoint");
Service service = Service.create(new URL(address + "?wsdl"), serviceName);
Dispatch<Source> d = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
String body = "<ns:add xmlns:ns='" + NS + "'> <arg0> 10 </arg0> <arg1> 20 </arg1> </ns:add>";
return d.invoke(new StreamSource(new StringReader(body)));
}
use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class ClientEpr method msEprGettertest.
private void msEprGettertest(BindingProvider bp, boolean hasWSDL) throws Exception {
Service service = Service.create(serviceName);
service.addPort(portName, jakarta.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
// validate ms epr
MemberSubmissionEndpointReference msEpr = bp.getEndpointReference(MemberSubmissionEndpointReference.class);
// printEPR(msEpr);
assertTrue(EprUtil.validateEPR(msEpr, endpointAddress, serviceName, portName, portTypeName, hasWSDL));
W3CEndpointReference w3cEpr = bp.getEndpointReference(W3CEndpointReference.class);
// printEPR(w3cEpr);
// assertTrue(EprUtil.validateEPR(w3cEpr,endpointAddress, serviceName, portName, portTypeName, hasWSDL));
assertTrue(EprUtil.validateEPR(w3cEpr, endpointAddress, null, null, null, false));
}
Aggregations