当前位置: 首页>>代码示例>>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;未经允许,请勿转载。