List of usage examples for javax.xml.ws.soap SOAPBinding SOAP11HTTP_MTOM_BINDING
String SOAP11HTTP_MTOM_BINDING
To view the source code for javax.xml.ws.soap SOAPBinding SOAP11HTTP_MTOM_BINDING.
Click Source Link
From source file:org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.java
/** * This will set up the arguments that will be used by the WsGen tool. *///from w ww . ja va 2 s . com private String[] getWsGenArguments(String className, String bindingType, String localOutputDirectory) throws WebServiceException { String[] arguments = null; if (bindingType == null || bindingType.equals("") || bindingType.equals(SOAPBinding.SOAP11HTTP_BINDING) || bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING)) { if (log.isDebugEnabled()) { log.debug("Generating WSDL with SOAP 1.1 binding type"); } arguments = new String[] { "-cp", classPath, className, "-keep", "-wsdl:soap1.1", "-d", localOutputDirectory }; } else if (bindingType.equals(SOAPBinding.SOAP12HTTP_BINDING) || bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) { if (log.isDebugEnabled()) { log.debug("Generating WSDL with SOAP 1.2 binding type"); } arguments = new String[] { "-cp", classPath, className, "-keep", "-extension", "-wsdl:Xsoap1.2", "-d", localOutputDirectory }; } else { throw new WebServiceException("The binding " + bindingType + " specified by the " + "class " + className + " cannot be used to generate a WSDL. Please choose " + "a supported binding type."); } return arguments; }
From source file:org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.java
/** * Create a service-provider side EndpointDescription based on the DescriptionBuilderComposite. * Note that per the/*from www. j a v a 2 s .co m*/ * JAX-WS Spec (Final Release, 4/19/2006 Section 4.2.3 Proxies, page 55)the "namespace component * of the port is the target namespace of the WSDL definition document". * * @param theClass The SEI or Impl class. This will be NULL for Dispatch clients since they * don't use an SEI */ EndpointDescriptionImpl(ServiceDescriptionImpl parent, String serviceImplName, Map<String, Object> properties, Integer portCompositeIndex) { if (log.isDebugEnabled()) { log.debug( "entry EndpointDescriptionImpl(ServiceDescriptionImpl, String, Map<String, Object>, Integer)"); log.debug(" parent=" + parent); log.debug(" serviceImplName=" + parent); log.debug(" portCompositeIndex=" + portCompositeIndex); } this.axisConfig = parent.getAxisConfigContext().getAxisConfiguration(); // initialize CustomAnnotationIntance list and CustomAnnotationProcessor map customAnnotations = new ArrayList<CustomAnnotationInstance>(); customAnnotationProcessors = new HashMap<String, CustomAnnotationProcessor>(); this.portCompositeIndex = portCompositeIndex; // set properties map this.properties = properties; this.parentServiceDescription = parent; this.serviceImplName = serviceImplName; // if the ServiceDescription's service QName is specified, let's use that to get the // correct DescriptionBuilderComposite if (parent.getServiceQName() != null) { composite = getServiceDescriptionImpl().getDescriptionBuilderComposite(parent.getServiceQName(), portCompositeIndex); } // otherwise we will get the DescriptionBuilderComposite by the current index else { composite = getServiceDescriptionImpl().getDescriptionBuilderComposite(null, portCompositeIndex); } if (composite == null) { throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr3")); } if (composite.getHandlerChainAnnot() != null && composite.getHandlerChainsType() != null) { throw ExceptionFactory .makeWebServiceException(Messages.getMessage("handlerSourceFail", composite.getClassName())); } handlerChainsType = composite.getHandlerChainsType(); //Set the base level of annotation that we are processing...currently // a 'WebService' or a 'WebServiceProvider' if (composite.getWebServiceAnnot() != null) webServiceAnnotation = composite.getWebServiceAnnot(); else webServiceProviderAnnotation = composite.getWebServiceProviderAnnot(); // now get the custom annotation and process information from the DBC customAnnotations.addAll(composite.getCustomAnnotationInstances()); customAnnotationProcessors.putAll(composite.getCustomAnnotationProcessors()); // Note that on the client side, the service QN should be set; on the server side it will not be. if (DescriptionUtils.isEmpty(getServiceDescription().getServiceQName())) { getServiceDescriptionImpl().setServiceQName(getServiceQName()); } //Call the getter to insure the qualified port name is set. getPortQName(); setupAxisServiceFromDBL(); addToAxisService(); //Add a reference to this EndpointDescription to the AxisService buildDescriptionHierachy(); WsdlComposite wsdlComposite = null; String bindingType = getBindingType(); boolean isSOAP11 = (bindingType.equals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING) || bindingType.equals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING)) ? true : false; // Determine if we need to generate WSDL // First, make sure that this is only a SOAP 1.1 based binding, per JAXWS spec. we cannot // generate WSDL if the binding type is not SOAP 1.1 based. // Then, assuming the composite does not contain a // Wsdl Definition, go ahead and generate it if (isSOAP11) { if ((isEndpointBased() && DescriptionUtils.isEmpty(getAnnoWebServiceEndpointInterface())) || (!isEndpointBased())) { //This is either an implicit SEI, or a WebService Provider wsdlComposite = generateWSDL(composite); } else if (isEndpointBased()) { //This impl class specifies an SEI...this is a special case. There is a bug //in the tooling that allows for the wsdllocation to be specifed on either the //impl. class, or the SEI, or both. So, we need to look for the wsdl as follows: // 1. If the Wsdl exists on the SEI, then check for it on the impl. // 2. If it is not found in either location, in that order, then generate DescriptionBuilderComposite seic = getServiceDescriptionImpl().getDBCMap() .get(composite.getWebServiceAnnot().endpointInterface()); //Only generate WSDL if a definition doesn't already exist if (seic.getWsdlDefinition() == null) wsdlComposite = generateWSDL(composite); } } else if (composite.getWsdlDefinition() == null) { //This is a SOAP12 binding that does not contain a WSDL definition, log a WARNING log.warn(Messages.getMessage("generateWSDLNonSoap11", composite.getClassName())); } if (isSOAP11) { //Save the WSDL Location and the WsdlDefinition, value depends on whether wsdl was generated Parameter wsdlLocationParameter = new Parameter(); wsdlLocationParameter.setName(MDQConstants.WSDL_LOCATION); Parameter wsdlDefParameter = new Parameter(); wsdlDefParameter.setName(MDQConstants.WSDL_DEFINITION); Parameter wsdlCompositeParameter = new Parameter(); wsdlCompositeParameter.setName(MDQConstants.WSDL_COMPOSITE); if (wsdlComposite != null) { //We have a wsdl composite, so set these values for the generated wsdl wsdlCompositeParameter.setValue(wsdlComposite); wsdlLocationParameter.setValue(wsdlComposite.getWsdlFileName()); Definition def = getServiceDescriptionImpl().getGeneratedWsdlWrapper().getDefinition(); URL wsdlUrl = getServiceDescriptionImpl().getGeneratedWsdlWrapper().getWSDLLocation(); if (def instanceof WSDLDefinitionWrapper) { wsdlDefParameter.setValue(def); } else { // Create WSDLDefinitionWrapper WSDLDefinitionWrapper wrap = null; ConfigurationContext cc = composite.getConfigurationContext(); if (cc != null && cc.getAxisConfiguration() != null) { wrap = new WSDLDefinitionWrapper(def, wsdlUrl, cc.getAxisConfiguration()); } else { // Probably shouldn't get here. But if we do, use // a memory sensitve wsdl wrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl, true, 2); } wsdlDefParameter.setValue(wrap); } } else if (getServiceDescriptionImpl().getWSDLWrapper() != null) { //No wsdl composite because wsdl already exists wsdlLocationParameter.setValue(getAnnoWebServiceWSDLLocation()); Definition def = getServiceDescriptionImpl().getWSDLWrapper().getDefinition(); URL wsdlUrl = getServiceDescriptionImpl().getWSDLWrapper().getWSDLLocation(); if (def instanceof WSDLDefinitionWrapper) { wsdlDefParameter.setValue(def); } else { // Create WSDLDefinitionWrapper WSDLDefinitionWrapper wrap = null; ConfigurationContext cc = composite.getConfigurationContext(); if (cc != null && cc.getAxisConfiguration() != null) { wrap = new WSDLDefinitionWrapper(def, wsdlUrl, cc.getAxisConfiguration()); } else { // Probably shouldn't get here. But if we do, use // a memory sensitve wsdl wrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl, true, 2); } wsdlDefParameter.setValue(wrap); } } else { //There is no wsdl composite and there is NOT a wsdl definition wsdlLocationParameter.setValue(null); wsdlDefParameter.setValue(null); } try { if (wsdlComposite != null) { axisService.addParameter(wsdlCompositeParameter); } axisService.addParameter(wsdlDefParameter); axisService.addParameter(wsdlLocationParameter); } catch (Exception e) { throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr4")); } } else { // Need to account for SOAP 1.2 WSDL when supplied with application Parameter wsdlDefParameter = new Parameter(); wsdlDefParameter.setName(MDQConstants.WSDL_DEFINITION); Parameter wsdlLocationParameter = new Parameter(); wsdlLocationParameter.setName(MDQConstants.WSDL_LOCATION); if (getServiceDescriptionImpl().getWSDLWrapper() != null) { wsdlLocationParameter.setValue(getAnnoWebServiceWSDLLocation()); Definition def = getServiceDescriptionImpl().getWSDLWrapper().getDefinition(); URL wsdlUrl = getServiceDescriptionImpl().getWSDLWrapper().getWSDLLocation(); if (def instanceof WSDLDefinitionWrapper) { wsdlDefParameter.setValue(def); } else { // Create WSDLDefinitionWrapper WSDLDefinitionWrapper wrap = null; ConfigurationContext cc = composite.getConfigurationContext(); if (cc != null && cc.getAxisConfiguration() != null) { wrap = new WSDLDefinitionWrapper(def, wsdlUrl, cc.getAxisConfiguration()); } else { // Probably shouldn't get here. But if we do, use // a memory sensitve wsdl wrapper wrap = new WSDLDefinitionWrapper(def, wsdlUrl, true, 2); } wsdlDefParameter.setValue(wrap); } } // No WSDL supplied and we do not generate for non-SOAP 1.1/HTTP // endpoints else { wsdlLocationParameter.setValue(null); wsdlDefParameter.setValue(null); } try { axisService.addParameter(wsdlDefParameter); axisService.addParameter(wsdlLocationParameter); } catch (Exception e) { throw ExceptionFactory.makeWebServiceException(Messages.getMessage("endpointDescriptionErr4"), e); } } // Before we leave we need to drive the CustomAnnotationProcessors if // there were any CustomAnnotationInstance objects registered Iterator<CustomAnnotationInstance> annotationIter = customAnnotations.iterator(); while (annotationIter.hasNext()) { CustomAnnotationInstance annotation = annotationIter.next(); if (log.isDebugEnabled()) { log.debug("Checking for CustomAnnotationProcessor for CustomAnnotationInstance " + "class: " + annotation.getClass().getName()); } CustomAnnotationProcessor processor = customAnnotationProcessors.get(annotation.getClass().getName()); if (processor != null) { if (log.isDebugEnabled()) { log.debug("Found CustomAnnotationProcessor: " + processor.getClass().getName() + " for CustomAnnotationInstance: " + annotation.getClass().getName()); } processor.processTypeLevelAnnotation(this, annotation); } } // Configure any available WebServiceFeatures on the endpoint. configureWebServiceFeatures(); // REVIEW: there are some throws above that won't cause the release setupReleaseResources(composite.getConfigurationContext()); releaseAxisServiceResources(); if (log.isDebugEnabled()) { log.debug("exit EndpointDescriptionImpl(ServiceDescriptionImpl, String, Map<String, Object>, Integer)"); } }
From source file:org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.java
private static boolean isMTOMBinding(String url) { if (url != null && (url.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) || url.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING) || url.equals(MDQConstants.SOAP11JMS_MTOM_BINDING) || url.equals(MDQConstants.SOAP12JMS_MTOM_BINDING))) { return true; }/*from w w w .j a v a 2 s . c om*/ return false; }
From source file:org.apache.axis2.jaxws.description.impl.EndpointDescriptionImpl.java
private boolean validateClientBindingID(String bindingId) { boolean isValid = true; if (bindingId != null && !(bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING) || bindingId.equals(javax.xml.ws.http.HTTPBinding.HTTP_BINDING) || bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING) || bindingId.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) || bindingId.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING) || bindingId.equals(MDQConstants.SOAP11JMS_BINDING) || bindingId.equals(MDQConstants.SOAP12JMS_BINDING) || bindingId.equals(MDQConstants.SOAP11JMS_MTOM_BINDING) || bindingId.equals(MDQConstants.SOAP12JMS_MTOM_BINDING))) { throw ExceptionFactory .makeWebServiceException(Messages.getMessage("addPortErr0", getPortQName().toString())); }/*from www. java 2 s. c om*/ return isValid; }
From source file:org.apache.axis2.jaxws.description.impl.ServiceDescriptionImpl.java
/** * Validate that, if using PAYLOAD mode, then interfaces list cannot contain SOAPMessage or * DataSource/*www . java 2 s . c o m*/ * * @return */ private void validateProviderInterfaces() { // Default for ServiceMode is 'PAYLOAD'. So, if it is specified (explicitly or // implicitly) then verify that we are not implementing improper interfaces) if ((composite.getServiceModeAnnot() == null) || composite.getServiceModeAnnot().value() == javax.xml.ws.Service.Mode.PAYLOAD) { Iterator<String> iter = composite.getInterfacesList().iterator(); while (iter.hasNext()) { String interfaceString = iter.next(); if (interfaceString.equals(MDQConstants.PROVIDER_SOAP) || interfaceString.equals(MDQConstants.PROVIDER_DATASOURCE)) { throw ExceptionFactory.makeWebServiceException( Messages.getMessage("validatePIsErr1", composite.getClassName())); } } } else { // We are in MESSAGE mode // Conformance: JAXWS Spec.- Sec. 4.3 (javax.activation.DataSource) // REVIEW: Should the provider interface validation be moved to post-construction validation, // since it seems that the logic to understand the default values for binding type // (see comment below) should be left to the creation of the Description objects. String bindingType = null; if (composite.getBindingTypeAnnot() != null) { bindingType = composite.getBindingTypeAnnot().value(); } Iterator<String> iter = composite.getInterfacesList().iterator(); while (iter.hasNext()) { String interfaceString = iter.next(); if (interfaceString.equals(MDQConstants.PROVIDER_SOAP)) { // Make sure BindingType is SOAP/HTTP with SOAPMessage // object, Default for Binding Type is SOAP/HTTP if (!DescriptionUtils.isEmpty(bindingType) && !bindingType.equals(SOAPBinding.SOAP11HTTP_BINDING) && !bindingType.equals(SOAPBinding.SOAP11HTTP_MTOM_BINDING) && !bindingType.equals(SOAPBinding.SOAP12HTTP_BINDING) && !bindingType.equals(SOAPBinding.SOAP12HTTP_MTOM_BINDING) && !bindingType.equals(MDQConstants.SOAP11JMS_BINDING) && !bindingType.equals(MDQConstants.SOAP11JMS_MTOM_BINDING) && !bindingType.equals(MDQConstants.SOAP12JMS_BINDING) && !bindingType.equals(MDQConstants.SOAP12JMS_MTOM_BINDING) && !bindingType.equals(MDQConstants.SOAP_HTTP_BINDING)) throw ExceptionFactory.makeWebServiceException( Messages.getMessage("validatePIsErr2", composite.getClassName())); } else if (interfaceString.equals(MDQConstants.PROVIDER_DATASOURCE)) { // Make sure BindingType is XML/HTTP with DataSource object if (DescriptionUtils.isEmpty(bindingType) || !bindingType.equals(javax.xml.ws.http.HTTPBinding.HTTP_BINDING)) throw ExceptionFactory.makeWebServiceException( Messages.getMessage("validatePIsErr3", composite.getClassName())); } } } }
From source file:org.seedstack.seed.ws.internal.WSPlugin.java
private String getBindingIdForToken(String lexical) { // NOSONAR if ("##SOAP11_HTTP".equals(lexical)) { return SOAPBinding.SOAP11HTTP_BINDING; } else if ("##SOAP11_HTTP_MTOM".equals(lexical)) { return SOAPBinding.SOAP11HTTP_MTOM_BINDING; } else if ("##SOAP12_HTTP".equals(lexical)) { return SOAPBinding.SOAP12HTTP_BINDING; } else if ("##SOAP12_HTTP_MTOM".equals(lexical)) { return SOAPBinding.SOAP12HTTP_MTOM_BINDING; } else if ("##XML_HTTP".equals(lexical)) { return HTTPBinding.HTTP_BINDING; }/*from w ww .j av a2 s . c o m*/ return lexical; }