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


Java SOAPBinding類代碼示例

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


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

示例1: configureHandlers

import javax.xml.ws.soap.SOAPBinding; //導入依賴的package包/類
void configureHandlers(WSPortInfo port, BindingImpl binding) {
    //Check in cache first
    HandlerAnnotationInfo chain = chainMap.get(port);

    if(chain==null) {
        logGetChain(port);
        // Put it in cache
        chain = handlerModel.getHandlersForPortInfo(port);
        chainMap.put(port,chain);
    }

    if (binding instanceof SOAPBinding) {
        ((SOAPBinding) binding).setRoles(chain.getRoles());
    }

    logSetChain(port,chain);
    binding.setHandlerChain(chain.getHandlers());
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:19,代碼來源:HandlerConfigurator.java

示例2: setHandlersAndRoles

import javax.xml.ws.soap.SOAPBinding; //導入依賴的package包/類
/**
 * Parses the handler and role information and sets it
 * on the {@link WSBinding}.
 *
 * @return true if <handler-chains> element present in DD
 *         false otherwise.
 */
protected boolean setHandlersAndRoles(WSBinding binding, XMLStreamReader reader, QName serviceName, QName portName) {

    if (reader.getEventType() == XMLStreamConstants.END_ELEMENT ||
            !reader.getName().equals(HandlerChainsModel.QNAME_HANDLER_CHAINS)) {
        return false;
    }

    HandlerAnnotationInfo handlerInfo = HandlerChainsModel.parseHandlerFile(
            reader, classLoader, serviceName, portName, binding);

    binding.setHandlerChain(handlerInfo.getHandlers());
    if (binding instanceof SOAPBinding) {
        ((SOAPBinding) binding).setRoles(handlerInfo.getRoles());
    }

    // move past </handler-chains>
    XMLStreamReaderUtil.nextContent(reader);
    return true;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:27,代碼來源:DeploymentDescriptorParser.java

示例3: 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

示例4: 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

示例5: testMTOMAccess

import javax.xml.ws.soap.SOAPBinding; //導入依賴的package包/類
@Test
@RunAsClient
public void testMTOMAccess() throws Exception
{
   URL wsdlURL = new URL(baseURL + "/EndpointBean?wsdl");
   QName qname = new QName("http://org.jboss.ws/jaxws/jbws3593", "EndpointBeanService");
   Service service = Service.create(wsdlURL, qname);
   Endpoint port = service.getPort(Endpoint.class);

   addClientHandler((BindingProvider)port, true);
   
   ((SOAPBinding)((BindingProvider)port).getBinding()).setMTOMEnabled(true);

   DataHandler response = port.namespace(new DataHandler("Jimbo","text/plain"));
   Object messg = getContent(response);
   assertEquals("Hello Jimbo", messg);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:18,代碼來源:JBWS3593TestCase.java

示例6: 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

示例7: 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

示例8: testSOAP12ClientAccess

import javax.xml.ws.soap.SOAPBinding; //導入依賴的package包/類
@Test
@RunAsClient
public void testSOAP12ClientAccess() throws Exception
{
   URL wsdlURL = new URL(baseURL + "/soap12?wsdl");
   QName qname = new QName("http://org.jboss.ws/jaxws/jbws2419", "SOAP12EndpointBeanService");
   Service service = Service.create(wsdlURL, qname);
   SOAP12Endpoint port = service.getPort(SOAP12Endpoint.class);

   BindingProvider provider = (BindingProvider)port;
   @SuppressWarnings("rawtypes")
   List<Handler> handlerChain = new ArrayList<Handler>();
   handlerChain.addAll(provider.getBinding().getHandlerChain());
   handlerChain.add(new SOAP12ClientHandler());
   provider.getBinding().setHandlerChain(handlerChain);
   ((SOAPBinding)provider.getBinding()).setMTOMEnabled(true);

   DataHandler response = port.namespace(new DataHandler("Jimbo","text/plain"));
   Object messg = getContent(response);
   assertEquals("Hello Jimbo", messg);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:22,代碼來源:JBWS2419TestCase.java

示例9: testSOAP11ClientAccess

import javax.xml.ws.soap.SOAPBinding; //導入依賴的package包/類
@Test
@RunAsClient
public void testSOAP11ClientAccess() throws Exception
{
   URL wsdlURL = new URL(baseURL + "/soap11?wsdl");
   QName qname = new QName("http://org.jboss.ws/jaxws/jbws2419", "SOAP11EndpointBeanService");
   Service service = Service.create(wsdlURL, qname);
   SOAP11Endpoint port = service.getPort(SOAP11Endpoint.class);

   BindingProvider provider = (BindingProvider)port;
   @SuppressWarnings("rawtypes")
   List<Handler> handlerChain = new ArrayList<Handler>();
   handlerChain.addAll(provider.getBinding().getHandlerChain());
   handlerChain.add(new SOAP11ClientHandler());
   provider.getBinding().setHandlerChain(handlerChain);
   ((SOAPBinding)provider.getBinding()).setMTOMEnabled(true);

   DataHandler response = port.namespace(new DataHandler("Jimbo","text/plain"));
   Object messg = getContent(response);
   assertEquals("Hello Jimbo", messg);
}
 
開發者ID:jbossws,項目名稱:jbossws-cxf,代碼行數:22,代碼來源:JBWS2419TestCase.java

示例10: 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

示例11: setBindingId

import javax.xml.ws.soap.SOAPBinding; //導入依賴的package包/類
@Override
public void setBindingId(String bind) {
    if (SOAPBinding.SOAP11HTTP_BINDING.equals(bind) 
        || SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bind)) {
        super.setBindingId("http://schemas.xmlsoap.org/wsdl/soap/");
    } else if (SOAPBinding.SOAP12HTTP_BINDING.equals(bind)
        || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bind)) {
        super.setBindingId("http://schemas.xmlsoap.org/wsdl/soap12/");
    } else {
        super.setBindingId(bind);
    }
    
    if (SOAPBinding.SOAP11HTTP_BINDING.equals(bind)
        || SOAPBinding.SOAP12HTTP_BINDING.equals(bind)) {
        setBindingConfig(new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)getServiceFactory()));
    } else if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equals(bind)
        || SOAPBinding.SOAP12HTTP_MTOM_BINDING.equals(bind)) {
        setBindingConfig(new JaxWsSoapBindingConfiguration((JaxWsServiceFactoryBean)getServiceFactory()));
        ((JaxWsSoapBindingConfiguration)getBindingConfig()).setMtomEnabled(true);
    }
}
 
開發者ID:GeeQuery,項目名稱:cxf-plus,代碼行數:22,代碼來源:CXFPlusClientFactoryBean.java

示例12: 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

示例13: 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

示例14: testEnableMTOM

import javax.xml.ws.soap.SOAPBinding; //導入依賴的package包/類
/**
 * Validate enabling MTOM when creating the service results ports created under that service
 * have MTOM enabled.
 */
public void testEnableMTOM() {
    QName serviceQName = new QName(namespaceURI, svcLocalPart);
    URL wsdlUrl = ClientMetadataTest.getWsdlURL(multiPortWsdl);
    DescriptionBuilderComposite sparseComposite = new DescriptionBuilderComposite();
    sparseComposite.setIsMTOMEnabled(true);
    ServiceDelegate.setServiceMetadata(sparseComposite);
    Service service = Service.create(wsdlUrl, serviceQName);
    ClientMetadataPortSEI port = service.getPort(ClientMetadataPortSEI.class);
    assertNotNull(port);
    // Verify that MTOM is enabled on this port.
    BindingProvider bindingProvider = (BindingProvider) port;
    SOAPBinding binding = (SOAPBinding) bindingProvider.getBinding();
    assertTrue(binding.isMTOMEnabled());
    
    // Verify that specific ports under this service also have MTOM enabled
    QName port1QN = new QName(namespaceURI, multiPortWsdl_portLocalPart1);
    ClientMetadataPortSEI port1 = service.getPort(port1QN, ClientMetadataPortSEI.class);
    SOAPBinding binding1 = ((SOAPBinding) ((BindingProvider) port1).getBinding());
    assertTrue(binding1.isMTOMEnabled());
    
    QName port2QN = new QName(namespaceURI, multiPortWsdl_portLocalPart2);
    ClientMetadataPortSEI port2 = service.getPort(port2QN, ClientMetadataPortSEI.class);
    SOAPBinding binding2 = ((SOAPBinding) ((BindingProvider) port2).getBinding());
    assertTrue(binding2.isMTOMEnabled());
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:30,代碼來源:ClientMetadataPortTest.java

示例15: testDisptachBindingProviderSPI

import javax.xml.ws.soap.SOAPBinding; //導入依賴的package包/類
/**
 * A test to verify that the Dispatch objects implement the proper interface
 */
public void testDisptachBindingProviderSPI() {
    Service svc = Service.create(serviceQName);
    svc.addPort(portQName, SOAPBinding.SOAP11HTTP_BINDING, "");
    
    Dispatch dsp = svc.createDispatch(portQName, Source.class, Service.Mode.MESSAGE);
    
    // Make sure we can cast the object to the right interfaces
    assertTrue("The Dispatch object should also be a javax.xml.ws.BindingProvider", 
            (dsp instanceof javax.xml.ws.BindingProvider));
    assertTrue("The Dispatch object should also be a org.apache.axis2.jaxws.spi.BindingProvider", 
            dsp instanceof org.apache.axis2.jaxws.spi.BindingProvider);
    
    org.apache.axis2.jaxws.spi.BindingProvider bp = (org.apache.axis2.jaxws.spi.BindingProvider) dsp;
    
    ServiceDelegate sd = bp.getServiceDelegate();
    assertTrue("The ServiceDescription was null", sd != null);
    
    EndpointDescription ed = bp.getEndpointDescription();
    assertTrue("The EndpointDescription was null", ed != null);
}
 
開發者ID:wso2,項目名稱:wso2-axis2,代碼行數:24,代碼來源:BindingProviderTests.java


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