當前位置: 首頁>>代碼示例>>Java>>正文


Java SOAPBinding.setMTOMEnabled方法代碼示例

本文整理匯總了Java中javax.xml.ws.soap.SOAPBinding.setMTOMEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java SOAPBinding.setMTOMEnabled方法的具體用法?Java SOAPBinding.setMTOMEnabled怎麽用?Java SOAPBinding.setMTOMEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.xml.ws.soap.SOAPBinding的用法示例。


在下文中一共展示了SOAPBinding.setMTOMEnabled方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testInvokingServiceFromCXFClient

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Test
public void testInvokingServiceFromCXFClient() throws Exception {        
    if (MtomTestHelper.isAwtHeadless(logger, null)) {
        return;
    }

    Holder<byte[]> photo = new Holder<byte[]>(MtomTestHelper.REQ_PHOTO_DATA);
    Holder<Image> image = new Holder<Image>(getImage("/java.jpg"));

    Hello port = getPort();

    SOAPBinding binding = (SOAPBinding) ((BindingProvider)port).getBinding();
    binding.setMTOMEnabled(true);

    port.detail(photo, image);
    
    MtomTestHelper.assertEquals(MtomTestHelper.RESP_PHOTO_DATA,  photo.value);      
    Assert.assertNotNull(image.value);
    if (image.value instanceof BufferedImage) {
        Assert.assertEquals(560, ((BufferedImage)image.value).getWidth());
        Assert.assertEquals(300, ((BufferedImage)image.value).getHeight());            
    }
    
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:25,代碼來源:CxfMtomRouterPayloadModeTest.java

示例2: testInvokingService

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Test
public void testInvokingService() throws Exception {        
    if (MtomTestHelper.isAwtHeadless(null, log)) {
        return;
    }

    Holder<byte[]> photo = new Holder<byte[]>("RequestFromCXF".getBytes("UTF-8"));
    Holder<Image> image = new Holder<Image>(getImage("/java.jpg"));

    Hello port = getPort();

    SOAPBinding binding = (SOAPBinding) ((BindingProvider)port).getBinding();
    binding.setMTOMEnabled(true);

    port.detail(photo, image);

    assertEquals("ResponseFromCamel", new String(photo.value, "UTF-8"));
    assertNotNull(image.value);
    
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:21,代碼來源:CxfMtomConsumerTest.java

示例3: testFileTransfer

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testFileTransfer() throws Exception
{
   URL wsdlURL = new URL(baseURL + "/jaxws-jbws2000/FileTransfer?wsdl");
   QName serviceName = new QName("http://service.mtom.test.net/", "FileTransferServiceImplService");
   Service service = Service.create(wsdlURL, serviceName);
   FileTransferService port = service.getPort(FileTransferService.class);

   SOAPBinding binding = (SOAPBinding)((BindingProvider)port).getBinding();
   binding.setMTOMEnabled(true);
   
   GeneratorDataSource source = new GeneratorDataSource(1024 * 1204 * 8); //avoid going beyond Undertow default max post size
   DataHandler dh = new DataHandler(source);

   boolean success = port.transferFile("JBWS2000.data", dh);
   assertTrue("Failed to transfer file", success);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:19,代碼來源:JBWS2000TestCase.java

示例4: testMtomSawpFile

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testMtomSawpFile() throws Exception
{
   URL wsdlURL = new URL(baseURL + "?wsdl");
   QName serviceName = new QName("http://ws.jboss.org/jbws3250", "TestEndpointService");
   Endpoint port = Service.create(wsdlURL, serviceName).getPort(Endpoint.class);
   SOAPBinding binding =(SOAPBinding)((BindingProvider)port).getBinding();
   binding.setMTOMEnabled(true);
   URL url = JBossWSTestHelper.getResourceURL("jaxws/jbws3250/wsf.png");
   URLDataSource urlDatasource = new URLDataSource(url);
   javax.activation.DataHandler dh = new DataHandler(urlDatasource);
   MTOMRequest request = new MTOMRequest();
   request.setContent(dh);
   request.setId("largeSize_mtom_request");
   MTOMResponse mtomResponse = port.echo(request);
   Assert.assertEquals("Response for requestID:largeSize_mtom_request", mtomResponse.getResponse());
   byte[] responseBytes = IOUtils.convertToBytes(mtomResponse.getContent());
   Assert.assertTrue(responseBytes.length > 65536);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:21,代碼來源:JBWS3250TestCase.java

示例5: testParameterAnnotation

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testParameterAnnotation() throws Exception
{
   QName serviceName = new QName("http://doclit.xop.samples.jaxws.ws.test.jboss.org/", "WrappedService");
   URL wsdlURL = new URL(baseURL + "wrapped?wsdl");

   Service service = Service.create(wsdlURL, serviceName);
   WrappedEndpoint port = service.getPort(WrappedEndpoint.class);

   SOAPBinding binding = (SOAPBinding)((BindingProvider)port).getBinding();
   binding.setMTOMEnabled(true);
   
   DataHandler request = new DataHandler("Client data", "text/plain");
   DataHandler response = port.parameterAnnotation(request);

   assertNotNull(response);
   Object content = getContent(response);
   String contentType = response.getContentType();

   assertEquals("Server data", content);
   assertEquals("text/plain", contentType);      
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:24,代碼來源:XOPWrappedTestCase.java

示例6: storeContent

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
/**
 * Sends the test content file to the WebService
 */
public void storeContent() throws Exception {
    ContentStoreHttpPortService contentStoreService = new ContentStoreHttpPortService();
    ContentStoreHttpPort contentStorePort = contentStoreService.getContentStoreHttpPortSoap11();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) contentStorePort).getBinding();
    binding.setMTOMEnabled(true);

    StoreContentRequest request = objectFactory.createStoreContentRequest();
    request.setName(ClientUtil.TEST_CONTENT_NAME);
    
    DataHandler dataHandler = new DataHandler(new URLDataSource(ClientUtil.TEST_CONTENT_URL));
    request.setContent(dataHandler);
    
    StopWatch stopWatch = new StopWatch(this.getClass().getSimpleName());

    stopWatch.start("store");
    StoreContentResponse response = contentStorePort.storeContent(request);
    stopWatch.stop();
    
    System.out.println(stopWatch.prettyPrint());
}
 
開發者ID:vanioinformatika,項目名稱:spring-ws-mtom-example,代碼行數:24,代碼來源:JaxWsClient.java

示例7: loadContent

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
/**
 * Loads the test content from the WebService
 * @throws IOException If an IO error occurs
 */
public void loadContent() throws IOException {
    ContentStoreHttpPortService service = new ContentStoreHttpPortService();
    ContentStoreHttpPort loadContentPort = service.getContentStoreHttpPortSoap11();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) loadContentPort).getBinding();
    binding.setMTOMEnabled(true);

    LoadContentRequest request = objectFactory.createLoadContentRequest();
    request.setName(ClientUtil.TEST_CONTENT_NAME);
    StopWatch stopWatch = new StopWatch();

    stopWatch.start("load");
    LoadContentResponse response = loadContentPort.loadContent(request);
    stopWatch.stop();

    DataHandler content = response.getContent();
    File outFile = new File(System.getProperty("java.io.tmpdir"), "spring_mtom_jaxws_tmp.bin");

    stopWatch.start("loadAttachmentContent");
    long size = ClientUtil.saveContentToFile(content, outFile);
    
    System.out.println("Received file size [kB]: " + (size / 1024));
    stopWatch.stop();
    System.out.println(stopWatch.prettyPrint());

}
 
開發者ID:vanioinformatika,項目名稱:spring-ws-mtom-example,代碼行數:30,代碼來源:JaxWsClient.java

示例8: storeContent

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
/**
 * Sends the specified content file to the WebService
 * 
 * @param name The name of the content to be stored
 * @param content The content to be stored
 * @return The message that tthe server sent back
 */
public String storeContent(String name, DataHandler content) {
    ContentStoreHttpPortService service = new ContentStoreHttpPortService();
    
    service.setHandlerResolver(new HandlerResolver() {
        @Override
        public List<Handler> getHandlerChain(PortInfo portInfo) {
            List<Handler> handlerList = new ArrayList<>();
            handlerList.add(wsSecurityHandler);
            return handlerList;
        }
    });
    
    ContentStoreHttpPort contentStorePort = service.getContentStoreHttpPortSoap11();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) contentStorePort).getBinding();
    binding.setMTOMEnabled(true);

    StoreContentRequest request = objectFactory.createStoreContentRequest();
    request.setName(name);
    request.setContent(content);
    
    StoreContentResponse response = contentStorePort.storeContent(request);
    return response.getMessage();
}
 
開發者ID:vanioinformatika,項目名稱:spring-boot-integration-example,代碼行數:31,代碼來源:JaxWsClient.java

示例9: loadContent

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
/**
 * Loads the content with the specified name from the WebService
 * 
 * @param name The name of the content
 * @return The loaded content
 * @throws IOException If an IO error occurs
 */
public DataHandler loadContent(String name) throws IOException {
    ContentStoreHttpPortService service = new ContentStoreHttpPortService();
    
    service.setHandlerResolver(new HandlerResolver() {
        @Override
        public List<Handler> getHandlerChain(PortInfo portInfo) {
            List<Handler> handlerList = new ArrayList<>();
            handlerList.add(wsSecurityHandler);
            return handlerList;
        }
    });
    
    ContentStoreHttpPort loadContentPort = service.getContentStoreHttpPortSoap11();
    SOAPBinding binding = (SOAPBinding) ((BindingProvider) loadContentPort).getBinding();
    binding.setMTOMEnabled(true);

    LoadContentRequest request = objectFactory.createLoadContentRequest();
    request.setName(name);
    LoadContentResponse response = loadContentPort.loadContent(request);
    DataHandler content = response.getContent();
    return content;
}
 
開發者ID:vanioinformatika,項目名稱:spring-boot-integration-example,代碼行數:30,代碼來源:JaxWsClient.java

示例10: setupService

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
private void setupService(BindingProvider bp, String serviceName,
    String url, Boolean enableMTOM, String proxyHost, int proxyPort,
    String proxyUser, String proxyPassword) {
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
	url + "services/" + serviceName + WS_VERSION);
if (proxyHost != null) {
    if (proxyHost.startsWith(HTTP_PREFIX)) {
	bp.getRequestContext().put(HTTP_PROXY_HOST, proxyHost);
	bp.getRequestContext().put(HTTP_PROXY_PORT, proxyPort);
	if (proxyUser != null && proxyUser.trim().length() > 0) {
	    bp.getRequestContext().put(HTTP_PROXY_USER, proxyUser);
	    bp.getRequestContext().put(HTTP_PROXY_PASSWORD,
		    proxyPassword);
	}
    } else if (proxyHost.startsWith(HTTPS_PREFIX)) {
	bp.getRequestContext().put(HTTPS_PROXY_HOST, proxyHost);
	bp.getRequestContext().put(HTTPS_PROXY_PORT, proxyPort);
	if (proxyUser != null && proxyUser.trim().length() > 0) {
	    bp.getRequestContext().put(HTTPS_PROXY_USER, proxyUser);
	    bp.getRequestContext().put(HTTPS_PROXY_PASSWORD,
		    proxyPassword);
	}
    }
}
SOAPBinding binding = (SOAPBinding) bp.getBinding();
binding.setMTOMEnabled(enableMTOM);

   }
 
開發者ID:translations-com,項目名稱:globallink-connect-api-java,代碼行數:29,代碼來源:ServiceLocator.java

示例11: createPort

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
private DocumentRepositoryPortTypeProxy createPort() {
	final DocumentRepositoryPortTypeProxy port = new DocumentRepositoryService(wsdlURL, serviceName).getDocumentRepositoryPortSoap12();
	if (StringUtils.hasText(this.endpointAddress)) {
		final BindingProvider bp = port;
		bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
		
		SOAPBinding binding = (SOAPBinding) bp.getBinding();
		binding.setMTOMEnabled(true);
	}
	
	return port;
}
 
開發者ID:bhits,項目名稱:common-libraries,代碼行數:13,代碼來源:XDSRepositorybClientTest.java

示例12: setUp

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    endpoint = Endpoint.publish("http://localhost:" + port + "/" + getClass().getSimpleName() 
                                + "/jaxws-mtom/hello", getServiceImpl());
    SOAPBinding binding = (SOAPBinding)endpoint.getBinding();
    binding.setMTOMEnabled(isMtomEnabled());
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:8,代碼來源:CxfMtomProducerPayloadModeTest.java

示例13: setUp

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    endpoint = Endpoint.publish("http://localhost:" + port2 + "/" 
        + getClass().getSimpleName() + "/jaxws-mtom/hello", getImpl());
    SOAPBinding binding = (SOAPBinding)endpoint.getBinding();
    binding.setMTOMEnabled(true);
    
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:9,代碼來源:CxfMtomRouterPayloadModeTest.java

示例14: setUp

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    endpoint = Endpoint.publish("http://localhost:" + port + "/CxfMtomPOJOProducerTest/jaxws-mtom/hello", getImpl());
    SOAPBinding binding = (SOAPBinding)endpoint.getBinding();
    binding.setMTOMEnabled(true);
    
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:8,代碼來源:CxfMtomPOJOProducerTest.java

示例15: testCall

import javax.xml.ws.soap.SOAPBinding; //導入方法依賴的package包/類
@Test
@RunAsClient
public void testCall() throws Exception
{
   URL wsdlURL = new URL(baseURL + "?wsdl");
   QName serviceName = new QName("http://ws.jboss.org/jbws2259", "EndpointService");

   Service service = Service.create(wsdlURL, serviceName);
   Endpoint port = service.getPort(Endpoint.class);

   BindingProvider bindingProvider = (BindingProvider)port;
   SOAPBinding soapBinding = (SOAPBinding)bindingProvider.getBinding();
   soapBinding.setMTOMEnabled(true);
   
   File sharkFile = getResourceFile("jaxws/jbws2259/attach.jpeg");
   DataSource ds = new FileDataSource(sharkFile);
   DataHandler handler = new DataHandler(ds);

   String expectedContentType = "image/jpeg";

   Photo p = new Photo();
   p.setCaption("JBWS2259 Smile :-)");
   p.setExpectedContentType(expectedContentType);
   p.setImage(handler);

   Photo reponse = port.echo(p);
   DataHandler dhResponse = reponse.getImage();

   String contentType = dhResponse.getContentType();
   assertEquals("content-type", expectedContentType, contentType);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:32,代碼來源:JBWS2259TestCase.java


注:本文中的javax.xml.ws.soap.SOAPBinding.setMTOMEnabled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。