Create the Port
We create a JAX-WS port object form the client with the following extensions:
• MTOMFeature
• StreamingAttachmentFeature
Streaming attachments directs JAX-WS RI to handle attachments as streams (as opposed to byte arrays) and MTOM enables XOP binary attachments. We also specify the chunk size for HTTP entity streaming.
private static EntityAPIService getPort() throws MalformedURLException {
EntityAPIService_Service service = new EntityAPIService_Service(new URL(WSDL_LOCATION), new QName("http://datasolutions.pervasive.com/api/service", "EntityAPIService"));
final StreamingAttachmentFeature streamingAttachmentFeature = new StreamingAttachmentFeature(null, false, 4000000L);
final MTOMFeature mTOMFeature = new MTOMFeature();
EntityAPIService servicePort = service.getEntityAPIPort(streamingAttachmentFeature, mTOMFeature);
Map context = ((BindingProvider) port).getRequestContext();
context.put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);
return servicePort;
}
Last modified date: 12/17/2021