001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.servicemix.cxfbc;
018    
019    import java.io.IOException;
020    import java.io.InputStream;
021    import java.io.OutputStream;
022    import java.net.URI;
023    import java.util.ArrayList;
024    import java.util.HashMap;
025    import java.util.List;
026    import java.util.Map;
027    import java.util.concurrent.CopyOnWriteArrayList;
028    
029    import javax.jbi.management.DeploymentException;
030    import javax.jbi.messaging.ExchangeStatus;
031    import javax.jbi.messaging.InOnly;
032    import javax.jbi.messaging.MessageExchange;
033    import javax.jbi.messaging.MessagingException;
034    import javax.jbi.messaging.NormalizedMessage;
035    import javax.wsdl.WSDLException;
036    import javax.wsdl.factory.WSDLFactory;
037    import javax.wsdl.xml.WSDLReader;
038    import javax.xml.namespace.QName;
039    import javax.xml.parsers.ParserConfigurationException;
040    import javax.xml.transform.Source;
041    import javax.xml.transform.TransformerException;
042    import javax.xml.transform.dom.DOMSource;
043    import javax.xml.transform.stream.StreamSource;
044    
045    import org.w3c.dom.Document;
046    import org.w3c.dom.Element;
047    import org.w3c.dom.Node;
048    import org.xml.sax.SAXException;
049    
050    import com.ibm.wsdl.Constants;
051    
052    import org.apache.cxf.Bus;
053    
054    import org.apache.cxf.binding.jbi.JBIConstants;
055    import org.apache.cxf.binding.jbi.JBIFault;
056    
057    import org.apache.cxf.binding.soap.SoapMessage;
058    import org.apache.cxf.binding.soap.SoapVersion;
059    import org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor;
060    import org.apache.cxf.binding.soap.interceptor.SoapActionOutInterceptor;
061    import org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor;
062    import org.apache.cxf.binding.soap.interceptor.SoapPreProtocolOutInterceptor;
063    import org.apache.cxf.binding.soap.model.SoapBindingInfo;
064    import org.apache.cxf.binding.soap.model.SoapBodyInfo;
065    import org.apache.cxf.bus.spring.SpringBusFactory;
066    import org.apache.cxf.catalog.OASISCatalogManager;
067    import org.apache.cxf.endpoint.Client;
068    import org.apache.cxf.endpoint.ClientImpl;
069    import org.apache.cxf.endpoint.Endpoint;
070    import org.apache.cxf.endpoint.EndpointImpl;
071    import org.apache.cxf.feature.AbstractFeature;
072    import org.apache.cxf.interceptor.AttachmentOutInterceptor;
073    import org.apache.cxf.interceptor.Fault;
074    import org.apache.cxf.interceptor.Interceptor;
075    import org.apache.cxf.interceptor.StaxInInterceptor;
076    import org.apache.cxf.interceptor.StaxOutInterceptor;
077    
078    import org.apache.cxf.message.Exchange;
079    import org.apache.cxf.message.ExchangeImpl;
080    import org.apache.cxf.message.Message;
081    import org.apache.cxf.phase.PhaseChainCache;
082    import org.apache.cxf.phase.PhaseInterceptorChain;
083    import org.apache.cxf.phase.PhaseManager;
084    import org.apache.cxf.service.Service;
085    import org.apache.cxf.service.model.BindingMessageInfo;
086    import org.apache.cxf.service.model.BindingOperationInfo;
087    import org.apache.cxf.service.model.EndpointInfo;
088    import org.apache.cxf.service.model.OperationInfo;
089    import org.apache.cxf.service.model.SchemaInfo;
090    import org.apache.cxf.service.model.ServiceInfo;
091    import org.apache.cxf.transport.Conduit;
092    import org.apache.cxf.transport.ConduitInitiator;
093    import org.apache.cxf.transport.ConduitInitiatorManager;
094    import org.apache.cxf.transport.jbi.JBIMessageHelper;
095    import org.apache.cxf.wsdl.WSDLManager;
096    import org.apache.cxf.wsdl11.SchemaUtil;
097    import org.apache.cxf.wsdl11.ServiceWSDLBuilder;
098    import org.apache.cxf.wsdl11.WSDLServiceBuilder;
099    import org.apache.cxf.wsdl11.WSDLServiceFactory;
100    import org.apache.servicemix.JbiConstants;
101    import org.apache.servicemix.common.endpoints.ProviderEndpoint;
102    import org.apache.servicemix.cxfbc.interceptors.JbiOutInterceptor;
103    import org.apache.servicemix.cxfbc.interceptors.JbiOutWsdl1Interceptor;
104    import org.apache.servicemix.cxfbc.interceptors.MtomCheckInterceptor;
105    import org.apache.servicemix.cxfbc.interceptors.SchemaValidationOutInterceptor;
106    import org.apache.servicemix.jbi.jaxp.SourceTransformer;
107    import org.apache.servicemix.soap.util.DomUtil;
108    import org.springframework.core.io.Resource;
109    
110    /**
111     * 
112     * @author gnodet
113     * @org.apache.xbean.XBean element="provider" description="a provider endpoint
114     *                         that is capable of exposing SOAP/HTTP or SOAP/JMS
115     *                         services"
116     */
117    public class CxfBcProvider extends ProviderEndpoint implements
118            CxfBcEndpointWithInterceptor {
119    
120        List<Interceptor> in = new CopyOnWriteArrayList<Interceptor>();
121    
122        List<Interceptor> out = new CopyOnWriteArrayList<Interceptor>();
123    
124        List<Interceptor> outFault = new CopyOnWriteArrayList<Interceptor>();
125    
126        List<Interceptor> inFault = new CopyOnWriteArrayList<Interceptor>();
127    
128        private Resource wsdl;
129    
130        private String busCfg;
131    
132        private Bus bus;
133    
134        private ConduitInitiator conduitInit;
135    
136        private Conduit conduit;
137    
138        private URI locationURI;
139    
140        private EndpointInfo ei;
141    
142        private Endpoint ep;
143    
144        private Service cxfService;
145    
146        private boolean mtomEnabled;
147    
148        private boolean useJBIWrapper = true;
149    
150        private boolean useSOAPEnvelope = true;
151    
152        private boolean synchronous = true;
153        
154        private boolean schemaValidationEnabled;
155        
156        private List<AbstractFeature> features = new CopyOnWriteArrayList<AbstractFeature>();
157    
158        public void processExchange(MessageExchange exchange) {
159    
160        }
161    
162        public void process(MessageExchange exchange) throws Exception {
163    
164            if (exchange.getStatus() != ExchangeStatus.ACTIVE) {
165                return;
166            }
167            NormalizedMessage nm = exchange.getMessage("in");
168    
169            Object newDestinationURI = nm
170                    .getProperty(JbiConstants.HTTP_DESTINATION_URI);
171            if (newDestinationURI != null) {
172                ei.setAddress((String) newDestinationURI);
173            }
174    
175            Message message = ep.getBinding().createMessage();
176            message.put(MessageExchange.class, exchange);
177            Exchange cxfExchange = new ExchangeImpl();
178            cxfExchange.setConduit(conduit);
179            cxfExchange.setSynchronous(isSynchronous());
180            cxfExchange.put(MessageExchange.class, exchange);
181            message.setExchange(cxfExchange);
182            cxfExchange.setOutMessage(message);
183            cxfExchange.put(CxfBcProvider.class, this);
184    
185            QName opeName = exchange.getOperation();
186            BindingOperationInfo boi = null;
187            
188            if (opeName == null) {
189                // if interface only have one operation, may not specify the opeName
190                // in MessageExchange
191                if (ei.getBinding().getOperations().size() == 1) {
192                    boi = ei.getBinding().getOperations().iterator().next();
193                } else {
194                    boi = findOperation(nm, message, boi, exchange);
195                    cxfExchange.put(MessageExchange.class, exchange);
196                    
197                }
198            } else {
199                boi = ei.getBinding().getOperation(exchange.getOperation());
200            }
201            InputStream is = JBIMessageHelper.convertMessageToInputStream(nm
202                    .getContent());
203    
204            StreamSource source = new StreamSource(is);
205            message.setContent(Source.class, source);
206    
207            message.setContent(InputStream.class, is);
208            cxfExchange.setOneWay(boi.getOperationInfo().isOneWay());
209            cxfExchange.put(BindingOperationInfo.class, boi);
210            cxfExchange.put(Endpoint.class, ep);
211            cxfExchange.put(Service.class, cxfService);
212            cxfExchange.put(Bus.class, getBus());
213            PhaseInterceptorChain outChain = createInterceptorChain(message);
214            
215    
216            conduit.prepare(message);
217            OutputStream os = message.getContent(OutputStream.class);
218            message.put(org.apache.cxf.message.Message.REQUESTOR_ROLE, true);
219            try {
220                outChain.doIntercept(message);
221                // Check to see if there is a Fault from the outgoing chain
222                Exception ex = message.getContent(Exception.class);
223                if (ex != null) {
224                    throw ex;
225                }
226                ex = message.getExchange().get(Exception.class);
227                if (ex != null) {
228                    throw ex;
229                }
230                os = message.getContent(OutputStream.class);
231                os.flush();
232                is.close();
233                os.close();
234            } catch (Exception e) {
235                if (!(exchange instanceof InOnly)) {
236                    faultProcess(exchange, message, e);
237                }
238            }
239            if (boi.getOperationInfo().isOneWay()) {
240                exchange.setStatus(ExchangeStatus.DONE);
241                this.getChannel().send(exchange);
242            }
243    
244        }
245    
246        private BindingOperationInfo findOperation(NormalizedMessage nm, 
247                                                   Message message, 
248                                                   BindingOperationInfo boi, 
249                                                   MessageExchange exchange) 
250            throws TransformerException, ParserConfigurationException, IOException, SAXException {
251            //try to figure out the operationName based on the incoming message
252            //payload and wsdl if use doc/literal/wrapped
253            Element element = new SourceTransformer().toDOMElement(nm.getContent());
254            
255            if (!useJBIWrapper) {
256                SoapVersion soapVersion = ((SoapMessage)message).getVersion();                
257                if (element != null) {                                                      
258                    Element bodyElement = (Element) element.getElementsByTagNameNS(
259                            element.getNamespaceURI(),
260                            soapVersion.getBody().getLocalPart()).item(0);
261                    if (bodyElement != null) {    
262                        element = DomUtil.getFirstChildElement(bodyElement);
263                    } 
264                }
265            } else {
266                element = DomUtil.getFirstChildElement(DomUtil.getFirstChildElement(element));
267            }
268            
269            QName opeName = new QName(element.getNamespaceURI(), element.getLocalName());
270            SoapBindingInfo binding = (SoapBindingInfo) ei.getBinding();
271            for (BindingOperationInfo op : binding.getOperations()) {
272                String style = binding.getStyle(op.getOperationInfo());
273                if (style == null) {
274                    style = binding.getStyle();
275                }
276                if ("document".equals(style)) {
277                    BindingMessageInfo msg = op.getInput();
278                    if (msg.getExtensor(SoapBodyInfo.class)
279                                .getParts().get(0).getElementQName().equals(opeName)) {
280                        boi = op;
281                        exchange.setOperation(new QName(boi.getName().getNamespaceURI(), opeName.getLocalPart()));
282                        break;
283                    }
284                } else {
285                    throw new Fault(new Exception(
286                        "Operation must bound on this MessageExchange if use rpc mode"));
287                }
288            }
289            if (boi == null) {
290                throw new Fault(new Exception(
291                    "Operation not bound on this MessageExchange"));
292            }
293            return boi;
294        }
295    
296        private PhaseInterceptorChain createInterceptorChain(Message message) {
297            PhaseChainCache outboundChainCache = new PhaseChainCache();
298            PhaseManager pm = getBus().getExtension(PhaseManager.class);
299            List<Interceptor> outList = new ArrayList<Interceptor>();
300            if (isMtomEnabled()) {
301                outList.add(new JbiOutInterceptor());
302                outList.add(new MtomCheckInterceptor(true));
303                outList.add(new AttachmentOutInterceptor());
304    
305            }
306    
307            outList.add(new JbiOutInterceptor());
308            if (isSchemaValidationEnabled()) {
309                outList.add(new SchemaValidationOutInterceptor(isUseJBIWrapper(), isUseSOAPEnvelope()));
310            }
311            outList.add(new JbiOutWsdl1Interceptor(isUseJBIWrapper(), isUseSOAPEnvelope()));
312            outList.add(new SoapPreProtocolOutInterceptor());
313            outList.add(new SoapOutInterceptor(getBus()));
314            outList.add(new SoapActionOutInterceptor());
315            outList.add(new StaxOutInterceptor());
316    
317            getInInterceptors().addAll(getBus().getInInterceptors());
318            getInFaultInterceptors().addAll(getBus().getInFaultInterceptors());
319            getOutInterceptors().addAll(getBus().getOutInterceptors());
320            getOutFaultInterceptors().addAll(getBus().getOutFaultInterceptors());
321            PhaseInterceptorChain outChain = outboundChainCache.get(pm
322                    .getOutPhases(), outList);
323            outChain.add(getOutInterceptors());
324            outChain.add(getOutFaultInterceptors());
325            message.setInterceptorChain(outChain);
326            return outChain;
327        }
328    
329    
330        private void faultProcess(MessageExchange exchange, Message message,
331                Exception e) throws MessagingException {
332            javax.jbi.messaging.Fault fault = exchange.createFault();
333            if (e.getCause() != null) {
334                handleJBIFault(message, e.getCause().getMessage());
335            } else {
336                handleJBIFault(message, e.getMessage());
337            }
338            fault.setContent(message.getContent(Source.class));
339            exchange.setFault(fault);
340            boolean txSync = exchange.getStatus() == ExchangeStatus.ACTIVE
341                    && exchange.isTransacted()
342                    && Boolean.TRUE.equals(exchange
343                            .getProperty(JbiConstants.SEND_SYNC));
344            if (txSync) {
345                getContext().getDeliveryChannel().sendSync(exchange);
346            } else {
347                getContext().getDeliveryChannel().send(exchange);
348            }
349        }
350    
351        private void handleJBIFault(Message message, String detail) {
352            Document doc = DomUtil.createDocument();
353            Element jbiFault = DomUtil.createElement(doc, new QName(
354                    JBIConstants.NS_JBI_BINDING, JBIFault.JBI_FAULT_ROOT));
355            Node jbiFaultDetail = DomUtil.createElement(jbiFault, new QName("",
356                    JBIFault.JBI_FAULT_DETAIL));
357            jbiFaultDetail.setTextContent(detail);
358            jbiFault.appendChild(jbiFaultDetail);
359            message.setContent(Source.class, new DOMSource(doc));
360            message.put("jbiFault", true);
361        }
362    
363        /**
364         * Returns the list of interceptors used to process fault messages being
365         * sent back to the consumer.
366         * 
367         * @return a list of <code>Interceptor</code> objects
368         */
369        public List<Interceptor> getOutFaultInterceptors() {
370            return outFault;
371        }
372    
373        /**
374         * Returns the list of interceptors used to process fault messages being
375         * recieved by the endpoint.
376         * 
377         * @return a list of <code>Interceptor</code> objects
378         */
379        public List<Interceptor> getInFaultInterceptors() {
380            return inFault;
381        }
382    
383        /**
384         * Returns the list of interceptors used to process requests being recieved
385         * by the endpoint.
386         * 
387         * @return a list of <code>Interceptor</code> objects
388         */
389        public List<Interceptor> getInInterceptors() {
390            return in;
391        }
392    
393        /**
394         * Returns the list of interceptors used to process responses being sent
395         * back to the consumer.
396         * 
397         * @return a list of <code>Interceptor</code> objects
398         */
399        public List<Interceptor> getOutInterceptors() {
400            return out;
401        }
402    
403        /**
404         * Specifies a list of interceptors used to process requests recieved by the
405         * endpoint.
406         * 
407         * @param interceptors
408         *            a list of <code>Interceptor</code> objects
409         * @org.apache.xbean.Property description="a list of beans configuring
410         *                            interceptors that process incoming requests"
411         */
412        public void setInInterceptors(List<Interceptor> interceptors) {
413            in.addAll(interceptors);
414        }
415    
416        /**
417         * Specifies a list of interceptors used to process faults recieved by the
418         * endpoint.
419         * 
420         * @param interceptors
421         *            a list of <code>Interceptor</code> objects
422         * @org.apache.xbean.Property description="a list of beans configuring
423         *                            interceptors that process incoming faults"
424         */
425        public void setInFaultInterceptors(List<Interceptor> interceptors) {
426            inFault.addAll(interceptors);
427        }
428    
429        /**
430         * Specifies a list of interceptors used to process responses sent by the
431         * endpoint.
432         * 
433         * @param interceptors
434         *            a list of <code>Interceptor</code> objects
435         * @org.apache.xbean.Property description="a list of beans configuring
436         *                            interceptors that process responses"
437         */
438        public void setOutInterceptors(List<Interceptor> interceptors) {
439            out.addAll(interceptors);
440        }
441    
442        /**
443         * Specifies a list of interceptors used to process faults sent by the
444         * endpoint.
445         * 
446         * @param interceptors
447         *            a list of <code>Interceptor</code> objects
448         * @org.apache.xbean.Property description="a list of beans configuring
449         *                            interceptors that process fault messages being
450         *                            returned to the consumer"
451         */
452        public void setOutFaultInterceptors(List<Interceptor> interceptors) {
453            outFault.addAll(interceptors);
454        }
455    
456        /**
457         * Specifies the location of the WSDL defining the endpoint's interface.
458         * 
459         * @param wsdl
460         *            the location of the WSDL contract as a <code>Resource</code>
461         *            object
462         * @org.apache.xbean.Property description="the location of the WSDL document
463         *                            defining the endpoint's interface"
464         */
465        public void setWsdl(Resource wsdl) {
466            this.wsdl = wsdl;
467        }
468    
469        public Resource getWsdl() {
470            return wsdl;
471        }
472    
473        @Override
474        public void validate() throws DeploymentException {
475            try {
476                if (definition == null) {
477                    if (wsdl == null) {
478                        throw new DeploymentException("wsdl property must be set");
479                    }
480                    description = DomUtil.parse(wsdl.getInputStream());
481                    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
482                    WSDLReader reader = wsdlFactory.newWSDLReader();
483                    reader.setFeature(Constants.FEATURE_VERBOSE, false);
484                    try {
485                        //ensure the jax-ws-catalog is loaded
486                        OASISCatalogManager.getCatalogManager(getBus()).loadContextCatalogs();
487                        // use wsdl manager to parse wsdl or get cached definition
488                        definition = getBus().getExtension(WSDLManager.class)
489                                .getDefinition(wsdl.getURL());
490    
491                    } catch (WSDLException ex) {
492                        // 
493                    }
494                    WSDLServiceFactory factory = new WSDLServiceFactory(getBus(),
495                            definition, service);
496                    cxfService = factory.create();
497                    ei = cxfService.getServiceInfos().iterator().next()
498                            .getEndpoints().iterator().next();
499    
500                    for (ServiceInfo serviceInfo : cxfService.getServiceInfos()) {
501                        if (serviceInfo.getName().equals(service)
502                                && getEndpoint() != null
503                                && serviceInfo
504                                        .getEndpoint(new QName(serviceInfo
505                                                .getName().getNamespaceURI(),
506                                                getEndpoint())) != null) {
507                            ei = serviceInfo.getEndpoint(new QName(serviceInfo
508                                    .getName().getNamespaceURI(), getEndpoint()));
509    
510                        }
511                    }
512    
513                    ServiceInfo serInfo = new ServiceInfo();
514    
515                    Map<String, Element> schemaList = new HashMap<String, Element>();
516                    SchemaUtil schemaUtil = new SchemaUtil(bus, schemaList);
517                    schemaUtil.getSchemas(definition, serInfo);
518    
519                    serInfo = ei.getService();
520                    List<ServiceInfo> serviceInfos = new ArrayList<ServiceInfo>();
521                    serviceInfos.add(serInfo);
522                    // transform import xsd to inline xsd
523                    ServiceWSDLBuilder swBuilder = new ServiceWSDLBuilder(getBus(),
524                            serviceInfos);
525                    for (String key : schemaList.keySet()) {
526                        Element ele = schemaList.get(key);
527                        for (SchemaInfo sInfo : serInfo.getSchemas()) {
528                            Node nl = sInfo.getElement().getElementsByTagNameNS(
529                                    "http://www.w3.org/2001/XMLSchema", "import")
530                                    .item(0);
531                            if (sInfo.getNamespaceURI() == null // it's import
532                                    // schema
533                                    && nl != null
534                                    && ((Element) nl)
535                                            .getAttribute("namespace")
536                                            .equals(
537                                                    ele
538                                                            .getAttribute("targetNamespace"))) {
539    
540                                sInfo.setElement(ele);
541                            }
542                        }
543                    }
544    
545                    serInfo.setProperty(WSDLServiceBuilder.WSDL_DEFINITION, null);
546                    serInfo.getInterface().setProperty(WSDLServiceBuilder.WSDL_PORTTYPE, null);
547                    for (OperationInfo opInfo : serInfo.getInterface().getOperations()) {
548                        opInfo.setProperty(WSDLServiceBuilder.WSDL_OPERATION, null);
549                    }
550                    description = WSDLFactory.newInstance().newWSDLWriter()
551                            .getDocument(swBuilder.build());
552    
553                    if (endpoint == null) {
554                        endpoint = ei.getName().getLocalPart();
555                    }
556                    
557    
558                    ep = new EndpointImpl(getBus(), cxfService, ei);
559    
560                    // init transport
561                    if (locationURI != null) {
562                        ei.setAddress(locationURI.toString());
563                    }
564    
565                    ConduitInitiatorManager conduitMgr = getBus().getExtension(
566                            ConduitInitiatorManager.class);
567                    conduitInit = conduitMgr.getConduitInitiator(ei
568                            .getTransportId());
569                    conduit = conduitInit.getConduit(ei);
570                    CxfBcProviderMessageObserver obs = new CxfBcProviderMessageObserver(
571                            this);
572                    conduit.setMessageObserver(obs);
573                    
574                    checkWSRMInterceptors();
575                              
576    
577                    super.validate();
578                }
579            } catch (DeploymentException e) {
580                throw e;
581            } catch (Exception e) {
582                throw new DeploymentException(e);
583            }
584        }
585    
586        private void checkWSRMInterceptors() {
587            //to handle WS-RM requests and responses
588            for (Interceptor interceptor : getBus().getOutInterceptors()) {
589                if (interceptor.getClass().getName().equals("org.apache.cxf.ws.rm.RMOutInterceptor")) {
590                    ep.getOutInterceptors().add(new SoapOutInterceptor(getBus()));
591                    ep.getOutInterceptors().add(new StaxOutInterceptor());
592                    ep.getInInterceptors().add(new StaxInInterceptor());
593                    ep.getInInterceptors().add(new ReadHeadersInterceptor(getBus()));
594                    break;
595                }
596            }
597    
598        }
599    
600        @Override
601        public void start() throws Exception {
602            applyFeatures();
603            super.start();
604    
605        }
606    
607        private void applyFeatures() {
608            Client client = new ClientImpl(getBus(), ep, conduit);
609            if (getFeatures() != null) {
610                for (AbstractFeature feature : getFeatures()) {
611                    feature.initialize(client, getBus());
612                }
613            }
614        }
615        
616        protected Bus getBus() {
617            if (getBusCfg() != null) {
618                if (bus == null) {
619                    SpringBusFactory bf = new SpringBusFactory();
620                    bus = bf.createBus(getBusCfg());
621                }
622                return bus;
623            } else {
624                return ((CxfBcComponent) getServiceUnit().getComponent()).getBus();
625            }
626        }
627    
628        /**
629         * Specifies the location of the CXF configuraiton file used to configure
630         * the CXF bus. This allows you to access features like JMS runtime behavior
631         * and WS-RM.
632         * 
633         * @param busCfg
634         *            a string containing the relative path to the configuration
635         *            file
636         * @org.apache.xbean.Property description="the location of the CXF
637         *                            configuration file used to configure the CXF
638         *                            bus. This allows you to configure features
639         *                            like WS-RM and JMS runtime behavior."
640         */
641        public void setBusCfg(String busCfg) {
642            this.busCfg = busCfg;
643        }
644    
645        public String getBusCfg() {
646            return busCfg;
647        }
648    
649        /**
650         * Specifies the HTTP address of the exposed service. This value will
651         * overide any value specified in the WSDL.
652         * 
653         * @param locationURI
654         *            a <code>URI</code> object
655         * @org.apache.xbean.Property description="the HTTP address of the exposed
656         *                            service. This value will overide any value
657         *                            specified in the WSDL."
658         */
659        public void setLocationURI(URI locationURI) {
660            this.locationURI = locationURI;
661        }
662    
663        public URI getLocationURI() {
664            return locationURI;
665        }
666    
667        Endpoint getCxfEndpoint() {
668            return this.ep;
669        }
670    
671        EndpointInfo getEndpointInfo() {
672            return this.ei;
673        }
674    
675        /**
676         * Specifies if the endpoint can support binnary attachments.
677         * 
678         * @param mtomEnabled
679         *            a boolean
680         * @org.apache.xbean.Property description="Specifies if MTOM / attachment
681         *                            support is enabled. Default is
682         *                            <code>false</code>."
683         */
684        public void setMtomEnabled(boolean mtomEnabled) {
685            this.mtomEnabled = mtomEnabled;
686        }
687    
688        public boolean isMtomEnabled() {
689            return mtomEnabled;
690        }
691    
692        /**
693         * Specifies if the endpoint expects messages to use the JBI wrapper for
694         * SOAP messages.
695         * 
696         * @param useJBIWrapper
697         *            a boolean
698         * @org.apache.xbean.Property description="Specifies if the JBI wrapper is
699         *                            sent in the body of the message. Default is
700         *                            <code>true</code>. Ignore the value of
701         *                            useSOAPEnvelope if useJBIWrapper is true"
702         */
703        public void setUseJBIWrapper(boolean useJBIWrapper) {
704            this.useJBIWrapper = useJBIWrapper;
705        }
706    
707        public boolean isUseJBIWrapper() {
708            return useJBIWrapper;
709        }
710    
711        /**
712         * Specifies if the endpoint expects soap messages when useJBIWrapper is
713         * false, if useJBIWrapper is true then ignore useSOAPEnvelope
714         * 
715         * @org.apache.xbean.Property description="Specifies if the endpoint expects
716         *                            soap messages when useJBIWrapper is false, if
717         *                            useJBIWrapper is true then ignore
718         *                            useSOAPEnvelope. The default is
719         *                            <code>true</code>.
720         */
721        public void setUseSOAPEnvelope(boolean useSOAPEnvelope) {
722            this.useSOAPEnvelope = useSOAPEnvelope;
723        }
724    
725        public boolean isUseSOAPEnvelope() {
726            return useSOAPEnvelope;
727        }
728    
729        /**
730         * Specifies if the endpoints send message synchronously to external server
731         * using underlying jms/http transport *
732         * 
733         * @param synchronous
734         *            a boolean
735         * @org.apache.xbean.Property description="Specifies if the endpoints send
736         *                            message synchronously to external server using
737         *                            underlying jms/http transport. Default is
738         *                            <code>true</code>."
739         */
740        public void setSynchronous(boolean synchronous) {
741            this.synchronous = synchronous;
742        }
743    
744        public boolean isSynchronous() {
745            return synchronous;
746        }
747    
748        public void setFeatures(List<AbstractFeature> features) {
749            this.features = features;
750        }
751    
752        public List<AbstractFeature> getFeatures() {
753            return features;
754        }
755    
756        public boolean isSchemaValidationEnabled() {
757            return schemaValidationEnabled;
758        }
759    
760        /**
761         * Specifies if the endpoint use schemavalidation for the incoming/outgoing message.
762         * 
763         * @param schemaValidationEnabled
764         *            a boolean
765         * @org.apache.xbean.Property description="Specifies if the endpoint use schemavalidation for the incoming/outgoing message.
766         *  Default is <code>false</code>. 
767         */
768    
769        public void setSchemaValidationEnabled(boolean schemaValidationEnabled) {
770            this.schemaValidationEnabled = schemaValidationEnabled;
771        }
772    }