当前位置: 首页>>代码示例>>Java>>正文


Java MTOMFeature类代码示例

本文整理汇总了Java中javax.xml.ws.soap.MTOMFeature的典型用法代码示例。如果您正苦于以下问题:Java MTOMFeature类的具体用法?Java MTOMFeature怎么用?Java MTOMFeature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MTOMFeature类属于javax.xml.ws.soap包,在下文中一共展示了MTOMFeature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldUseMtomOutbound

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
private boolean shouldUseMtomOutbound() {
    //Use the getter to make sure all the logic is executed correctly
    MTOMFeature myMtomFeature = getMtomFeature();
    if(myMtomFeature != null && myMtomFeature.isEnabled()) {
        //On client, always use XOP encoding if MTOM is enabled
        //On Server, mtomAcceptable and mtomRequest will be set - use XOP encoding
        //if either request is XOP encoded (mtomRequest) or
        //client accepts XOP encoding (mtomAcceptable)
        if (getMtomAcceptable() == null && getMtomRequest() == null) {
            return true;
        } else {
            if (getMtomAcceptable() != null &&  getMtomAcceptable() && getState().equals(State.ServerResponse)) {
                return true;
            }
            if (getMtomRequest() != null && getMtomRequest() && getState().equals(State.ServerResponse)) {
                return true;
            }
            if (getMtomRequest() != null && getMtomRequest() && getState().equals(State.ClientRequest)) {
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:25,代码来源:Packet.java

示例2: parseAnnotations

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
/**
 *
 * @param endpointClass web service impl class
 */
public void parseAnnotations(Class<?> endpointClass) {
    for (Annotation a : endpointClass.getAnnotations()) {
        WebServiceFeature ftr = getFeature(a);
        if (ftr != null) {
            if (ftr instanceof MTOMFeature) {
                // check conflict with @BindingType
                BindingID bindingID = BindingID.parse(endpointClass);
                MTOMFeature bindingMtomSetting = bindingID.createBuiltinFeatureList().get(MTOMFeature.class);
                if (bindingMtomSetting != null && bindingMtomSetting.isEnabled() ^ ftr.isEnabled()) {
                    throw new RuntimeModelerException(
                        ModelerMessages.RUNTIME_MODELER_MTOM_CONFLICT(bindingID, ftr.isEnabled()));
                }
            }
            add(ftr);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:WebServiceFeatureList.java

示例3: update

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
/**
 * Generates an MTOM policy if MTOM is enabled.
 *
 * <ol>
 * <li>If MTOM is enabled
 * <ol>
 * <li>If MTOM policy does not already exist, generate
 * <li>Otherwise do nothing
 * </ol>
 * <li>Otherwise, do nothing (that implies that we do not remove any MTOM policies if MTOM is disabled)
 * </ol>
 *
 */
public Collection<PolicySubject> update(PolicyMap policyMap, SEIModel model, WSBinding wsBinding) throws PolicyException {
    LOGGER.entering(policyMap, model, wsBinding);

    Collection<PolicySubject> subjects = new ArrayList<PolicySubject>();
    if (policyMap != null) {
        final MTOMFeature mtomFeature = wsBinding.getFeature(MTOMFeature.class);
        if (LOGGER.isLoggable(Level.FINEST)) {
            LOGGER.finest("mtomFeature = " + mtomFeature);
        }
        if ((mtomFeature != null) && mtomFeature.isEnabled()) {
            final QName bindingName = model.getBoundPortTypeName();
            final WsdlBindingSubject wsdlSubject = WsdlBindingSubject.createBindingSubject(bindingName);
            final Policy mtomPolicy = createMtomPolicy(bindingName);
            final PolicySubject mtomPolicySubject = new PolicySubject(wsdlSubject, mtomPolicy);
            subjects.add(mtomPolicySubject);
            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.fine("Added MTOM policy with ID \"" + mtomPolicy.getIdOrName() + "\" to binding element \"" + bindingName + "\"");
            }
        }
    } // endif policy map not null

    LOGGER.exiting(subjects);
    return subjects;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:MtomPolicyMapConfigurator.java

示例4: getFeatures

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
/**
 * process Mtom policy assertions and if found and is not optional then mtom is enabled on the
 * {@link WSDLBoundPortType}
 *
 * @param key Key that identifies the endpoint scope
 * @param policyMap Must be non-null
 * @throws PolicyException If retrieving the policy triggered an exception
 */
public Collection<WebServiceFeature> getFeatures(PolicyMapKey key, PolicyMap policyMap) throws PolicyException {
    final Collection<WebServiceFeature> features = new LinkedList<WebServiceFeature>();
    if ((key != null) && (policyMap != null)) {
        Policy policy = policyMap.getEndpointEffectivePolicy(key);
        if (null!=policy && policy.contains(OPTIMIZED_MIME_SERIALIZATION_ASSERTION)) {
            Iterator <AssertionSet> assertions = policy.iterator();
            while(assertions.hasNext()){
                AssertionSet assertionSet = assertions.next();
                Iterator<PolicyAssertion> policyAssertion = assertionSet.iterator();
                while(policyAssertion.hasNext()){
                    PolicyAssertion assertion = policyAssertion.next();
                    if(OPTIMIZED_MIME_SERIALIZATION_ASSERTION.equals(assertion.getName())){
                        features.add(new MTOMFeature(true));
                    } // end-if non optional mtom assertion found
                } // next assertion
            } // next alternative
        } // end-if policy contains mtom assertion
    }
    return features;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:MtomFeatureConfigurator.java

示例5: EHealthBoxPublicationClient

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
/**
 * Main constructor.
 * 
 * @param location
 *            the URL of the eHealth Publication version 3.0 web service.
 */
public EHealthBoxPublicationClient(String location) {
	EhBoxPublicationService publicationService = EhBoxPublicationServiceFactory
			.newInstance();
	/*
	 * Nasty way to disable MTOM for Apache CXF.
	 */
	this.ehBoxPublicationPort = publicationService
			.getEhBoxPublicationPort(new MTOMFeature(false,
					1024 * 1024 * 1024));

	QName publicationPortQName = new QName(
			"urn:be:fgov:ehealth:ehbox:publication:protocol:v3",
			"ehBoxPublicationPort");
	this.publicationDispatch = publicationService.createDispatch(
			publicationPortQName, Source.class, Service.Mode.PAYLOAD);

	this.wsSecuritySOAPHandler = new WSSecuritySOAPHandler();
	this.payloadLogicalHandler = new PayloadLogicalHandler();
	configureBindingProvider((BindingProvider) this.ehBoxPublicationPort,
			location);
	configureBindingProvider(this.publicationDispatch, location);
}
 
开发者ID:e-Contract,项目名称:mycarenet,代码行数:29,代码来源:EHealthBoxPublicationClient.java

示例6: sendMessage

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
public static Image sendMessage(String wsdl) throws Exception {
    ImageService imageService = new ImageServiceService(new URL(wsdl)).getImageServicePort(new MTOMFeature());

    // Create the Image bytes and send it to the MTOM endpoint...
    URL fileURL = Classes.getResource("switchyard_icon.jpeg");
    File aFile = new File(new URI(fileURL.toString()));
    long fileSize = aFile.length();

    Holder<byte[]> param = new Holder<byte[]>();
    param.value = new byte[(int) fileSize];
    InputStream in = fileURL.openStream();
    int len = in.read(param.value);
    while (len < fileSize) {
        len += in.read(param.value, len, (int) (fileSize - len));
    }
    byte[] response = imageService.resizeImage(param);
    return ImageIO.read(new ByteArrayInputStream(response));
}
 
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:19,代码来源:SoapMtomClient.java

示例7: newContentService

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
@Override
public ContentService newContentService(
    DocumentManagement documentManagement) {
  ContentService contentServicePort =
      contentServiceService.getBasicHttpBindingContentService(
          new MTOMFeature());

  setEndpointAddress(
      (BindingProvider) contentServicePort, "ContentService");
  setAuthenticationHandler(
      (BindingProvider) contentServicePort,
      getAuthenticationToken((BindingProvider) documentManagement));
  addSocketTimeoutConfiguration((BindingProvider) contentServicePort);

  return contentServicePort;
}
 
开发者ID:googlegsa,项目名称:opentext,代码行数:17,代码来源:OpentextAdaptor.java

示例8: testDefaultMTOMFeature

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
public void testDefaultMTOMFeature() {
    // Use the default feature config
    MTOMFeature feature = new MTOMFeature();
    
    Service svc = Service.create(new QName("http://test", "ProxyMTOMService"));
    ProxyMTOMService proxy = svc.getPort(ProxyMTOMService.class, feature);
    assertTrue("Proxy instance was null", proxy != null);
    
    proxy.sendAttachment("12345");
    
    TestClientInvocationController testController = getInvocationController();
    InvocationContext ic = testController.getInvocationContext();
    MessageContext request = ic.getRequestMessageContext();
    
    assertTrue("Request should not be null.", request != null);
    assertTrue("MTOM should be abled on the Message by default.", request.getMessage().isMTOMEnabled());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:18,代码来源:ProxyMTOMFeatureTest.java

示例9: testDisabledMTOMFeature

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
public void testDisabledMTOMFeature() {
    // Use the default feature config
    MTOMFeature feature = new MTOMFeature(false);
    
    Service svc = Service.create(new QName("http://test", "ProxyMTOMService"));
    ProxyMTOMService proxy = svc.getPort(ProxyMTOMService.class, feature);
    assertTrue("Proxy instance was null", proxy != null);
    
    proxy.sendAttachment("12345");
    
    TestClientInvocationController testController = getInvocationController();
    InvocationContext ic = testController.getInvocationContext();
    MessageContext request = ic.getRequestMessageContext();
    
    assertTrue("Request should not be null.", request != null);
    assertTrue("MTOM should NOT be abled on the Message by default.", !request.getMessage().isMTOMEnabled());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:18,代码来源:ProxyMTOMFeatureTest.java

示例10: testMTOMFeatureThreshold

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
public void testMTOMFeatureThreshold() {
    // Set a threshold that we will not meet.
    int threshold = 20000;
    MTOMFeature feature = new MTOMFeature(threshold);
    
    Service svc = Service.create(new QName("http://test", "ProxyMTOMService"));
    ProxyMTOMService proxy = svc.getPort(ProxyMTOMService.class, feature);
    assertTrue("Proxy instance was null", proxy != null);
    
    proxy.sendAttachment("12345");
    
    TestClientInvocationController testController = getInvocationController();
    InvocationContext ic = testController.getInvocationContext();
    MessageContext request = ic.getRequestMessageContext();
    
    assertTrue("Request should not be null.", request != null);
    // A Threshold indicates that MTOM should be enabled.
    // The decision about whether the attachment is inlined is made on a per attachment
    // basis in Axiom...and cannot be tested in unit test that does not send the message
    // to the server.
    assertTrue("MTOM should be enabled.", request.getMessage().isMTOMEnabled());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:ProxyMTOMFeatureTest.java

示例11: testOperationResolutionAndMTOMFeature

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
/**
 * Validate that doing operation resolution does not impact using a WebServiceFeature such as MTOM on the
 * createDispatch.
 */
public void testOperationResolutionAndMTOMFeature() {
    Service service = Service.create(wsdlDocumentLocation, serviceQName);
    MTOMFeature feature = new MTOMFeature(true);
    Dispatch<String> dispatch = service.createDispatch(portQName, String.class, Service.Mode.MESSAGE, feature);
    assertNotNull(dispatch);
    
    String result = dispatch.invoke(echoBodyContent_MESSAGE);
    TestClientInvocationController testController = getInvocationController();
    InvocationContext ic = testController.getInvocationContext();
    MessageContext requestMC = ic.getRequestMessageContext();
    
    OperationDescription opDesc = requestMC.getOperationDescription();
    assertNotNull("OpDesc from request MC should not be null", opDesc);
    // Make sure we get the correct Operation Description
    OperationDescription expectedOperationDescription = expectedOperationDescription(requestMC);
    assertSame("Wrong operation description returned", expectedOperationDescription, opDesc);
    assertTrue("MTOM should be enabled via the MTOMFeature.", requestMC.getMessage().isMTOMEnabled());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:23,代码来源:DispatchOperationResolutionTest.java

示例12: testDefaultMTOMFeature

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
public void testDefaultMTOMFeature() {
    // Use the default feature config
    MTOMFeature feature = new MTOMFeature();
    
    Service svc = Service.create(new QName("http://test", "TestService"));
    svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
    Dispatch<Source> d = svc.createDispatch(new QName("http://test", "TestPort"), 
        Source.class, Service.Mode.PAYLOAD, feature);
    
    d.invoke(null);
    
    TestClientInvocationController testController = getInvocationController();
    InvocationContext ic = testController.getInvocationContext();
    MessageContext request = ic.getRequestMessageContext();
    
    assertTrue("MTOM should be enabled via the MTOMFeature.", request.getMessage().isMTOMEnabled());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:18,代码来源:DispatchMTOMFeatureTest.java

示例13: testMTOMFeatureThresholdWithNoAttachment

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
public void testMTOMFeatureThresholdWithNoAttachment() {
    Service svc = Service.create(new QName("http://test", "TestService"));
    svc.addPort(new QName("http://test", "TestPort"), SOAPBinding.SOAP11HTTP_BINDING, "http://localhost");
    
    // Set the feature to be disabled.
    int threshold = 20000;
    MTOMFeature feature = new MTOMFeature(threshold);
            
    Dispatch<Source> d = svc.createDispatch(new QName("http://test", "TestPort"), 
        Source.class, Service.Mode.PAYLOAD, feature);
    
    d.invoke(null);
    
    TestClientInvocationController testController = getInvocationController();
    
    InvocationContext ic = testController.getInvocationContext();
    MessageContext request = ic.getRequestMessageContext();
    
    // A Threshold indicates that MTOM should be enabled.
    // The decision about whether the attachment is inlined is made on a per attachment
    // basis in Axiom...and cannot be tested in unit test that does not send the message
    // to the server.
    assertTrue("MTOM should be enabled.", request.getMessage().isMTOMEnabled());
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:25,代码来源:DispatchMTOMFeatureTest.java

示例14: isMTOMEnabled

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
public boolean isMTOMEnabled() {
    if (isMTOMEnabledCache != null) {
        return isMTOMEnabledCache.booleanValue();
    }
    
    // isMTOMEnabled is a combination of the @BindingType and the @MTOM setting.
    MTOM mtomAnnotation =
            (MTOM) getAnnoFeature(MTOMFeature.ID);
    
    // If the @MTOM annotation is set, it wins
    if (mtomAnnotation != null) {
        isMTOMEnabledCache = Boolean.valueOf(mtomAnnotation.enabled());
        return isMTOMEnabledCache.booleanValue();
    }
    
    // Else look at the bindingType
    String bindingType = getBindingType();
    isMTOMEnabledCache = Boolean.valueOf(isMTOMBinding(bindingType));
    return isMTOMEnabledCache.booleanValue();
}
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:21,代码来源:EndpointDescriptionImpl.java

示例15: parseAnnotations

import javax.xml.ws.soap.MTOMFeature; //导入依赖的package包/类
/**
 * Reads {@link WebServiceFeatureAnnotation feature annotations} on a class
 * and adds them to the list.
 *
 * @param endpointClass web service impl class
 */
public void parseAnnotations(Class<?> endpointClass) {
    for (Annotation a : endpointClass.getAnnotations()) {
        WebServiceFeature ftr = getFeature(a);
        if (ftr != null) {
            if (ftr instanceof MTOMFeature) {
                // check conflict with @BindingType
                BindingID bindingID = BindingID.parse(endpointClass);
                MTOMFeature bindingMtomSetting = bindingID.createBuiltinFeatureList().get(MTOMFeature.class);
                if (bindingMtomSetting != null && bindingMtomSetting.isEnabled() ^ ftr.isEnabled()) {
                    throw new RuntimeModelerException(
                        ModelerMessages.RUNTIME_MODELER_MTOM_CONFLICT(bindingID, ftr.isEnabled()));
                }
            }
            add(ftr);
        }
    }
}
 
开发者ID:alexkasko,项目名称:openjdk-icedtea7,代码行数:24,代码来源:WebServiceFeatureList.java


注:本文中的javax.xml.ws.soap.MTOMFeature类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。