use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class DispatchTest method testNoContentType.
/*
* Check for service's response code. It shouldn't be 202 since service
* sets a http status code even for oneway
*/
public void testNoContentType() throws Exception {
BindingProvider bp = (BindingProvider) new Hello_Service().getHelloPort();
String address = (String) bp.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
Service service = Service.create(new QName("", ""));
service.addPort(new QName("", ""), HTTPBinding.HTTP_BINDING, address);
Dispatch<DataSource> d = service.createDispatch(new QName("", ""), DataSource.class, Service.Mode.MESSAGE);
// Set HTTP operation to PUT
Map<String, Object> requestContext = d.getRequestContext();
requestContext.put(MessageContext.HTTP_REQUEST_METHOD, "PUT");
d.invoke(new DataSource() {
public InputStream getInputStream() throws IOException {
return null;
}
public OutputStream getOutputStream() throws IOException {
return null;
}
public String getContentType() {
return null;
}
public String getName() {
return null;
}
});
}
use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class DispatchTest method testNoContentType.
/*
* Service sends status code 200+no envelope
*/
public void testNoContentType() throws Exception {
BindingProvider bp = (BindingProvider) new Hello_Service().getHelloPort();
String address = (String) bp.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
Service service = Service.create(new QName("", ""));
service.addPort(new QName("", ""), SOAPBinding.SOAP11HTTP_BINDING, address);
Dispatch<SOAPMessage> d = service.createDispatch(new QName("", ""), SOAPMessage.class, Service.Mode.MESSAGE);
String str = "<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'><S:Body/></S:Envelope>";
MessageFactory fact = MessageFactory.newInstance();
MimeHeaders headers = new MimeHeaders();
SOAPMessage req = fact.createMessage(headers, new ByteArrayInputStream(str.getBytes("UTF-8")));
d.invokeOneWay(req);
}
use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class HelloLiteralTest method testDataSource.
public void testDataSource() throws Exception {
Service service = Service.create(serviceQName);
service.addPort(portQName, HTTPBinding.HTTP_BINDING, endpointAddress);
Dispatch<DataSource> dispatch = service.createDispatch(portQName, DataSource.class, Service.Mode.MESSAGE);
final SOAPMessage message = getSOAPMessage();
DataSource ds = new DataSource() {
public InputStream getInputStream() {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
message.writeTo(bos);
bos.close();
return new ByteArrayInputStream(bos.toByteArray());
} catch (Exception ioe) {
throw new RuntimeException(ioe);
}
}
public OutputStream getOutputStream() {
return null;
}
public String getContentType() {
return message.getMimeHeaders().getHeader("Content-Type")[0];
}
public String getName() {
return "";
}
};
DataSource result = dispatch.invoke(ds);
}
use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class HelloLiteralTest method createDispatch.
private Dispatch createDispatch() throws Exception {
Service service = createService();
service.addPort(portQName, HTTPBinding.HTTP_BINDING, setTransport(endpointAddress));
Dispatch<Object> dispatch = service.createDispatch(portQName, createJAXBContext(), Service.Mode.PAYLOAD);
return dispatch;
}
use of jakarta.xml.ws.Service in project metro-jax-ws by eclipse-ee4j.
the class ClientEprTest 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