use of javax.xml.ws.soap.SOAPBinding in project pentaho-platform by pentaho.
the class DefaultUnifiedRepositoryJaxwsWebServiceIT method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
IRepositoryVersionManager mockRepositoryVersionManager = mock(IRepositoryVersionManager.class);
when(mockRepositoryVersionManager.isVersioningEnabled(anyString())).thenReturn(true);
when(mockRepositoryVersionManager.isVersionCommentEnabled(anyString())).thenReturn(false);
JcrRepositoryFileUtils.setRepositoryVersionManager(mockRepositoryVersionManager);
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);
String address = "http://localhost:9000/repo";
try {
Endpoint.publish(address, new DefaultUnifiedRepositoryJaxwsWebService(repo));
} catch (Throwable th) {
// ignore
}
Service service = Service.create(new URL("http://localhost:9000/repo?wsdl"), new QName("http://www.pentaho.org/ws/1.0", "unifiedRepository"));
IUnifiedRepositoryJaxwsWebService repoWebService = service.getPort(IUnifiedRepositoryJaxwsWebService.class);
// accept cookies to maintain session on server
((BindingProvider) repoWebService).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, true);
// support streaming binary data
((BindingProvider) repoWebService).getRequestContext().put(JAXWSProperties.HTTP_CLIENT_STREAMING_CHUNK_SIZE, 8192);
SOAPBinding binding = (SOAPBinding) ((BindingProvider) repoWebService).getBinding();
binding.setMTOMEnabled(true);
repo = new UnifiedRepositoryToWebServiceAdapter(repoWebService);
}
use of javax.xml.ws.soap.SOAPBinding in project Java-Tutorial by gpcodervn.
the class DocumentClientUpload method main.
public static void main(String[] args) throws Exception {
// Create URL of .wsdl file
URL url = new URL(DocumentPublisher.WS_URL + "?wsdl");
// Create a QName using targetNamespace and name
QName qname = new QName("http://document.ws.gpcoder.com/", "DocumentServiceImplService");
// Creates a Service instance with the specified WSDL document location and
// service qualified name
Service service = Service.create(url, qname);
// We need to pass interface and model beans to client
DocumentService imageServer = service.getPort(DocumentService.class);
// Enable MTOM in client
BindingProvider bp = (BindingProvider) imageServer;
SOAPBinding binding = (SOAPBinding) bp.getBinding();
binding.setMTOMEnabled(true);
// Prepare document for upload
DataHandler dataHandler = DocumentUtils.getFileAsDataHandler("data/test.docx");
// Perform upload document
String status = imageServer.upload(dataHandler);
System.out.println("upload() : " + status);
}
Aggregations