Coverage Report - org.mule.module.cxf.component.WebServiceWrapperComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
WebServiceWrapperComponent
0%
0/24
0%
0/10
2.4
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.module.cxf.component;
 8  
 
 9  
 import org.mule.DefaultMuleEvent;
 10  
 import org.mule.MessageExchangePattern;
 11  
 import org.mule.api.MuleContext;
 12  
 import org.mule.api.MuleEvent;
 13  
 import org.mule.api.MuleMessage;
 14  
 import org.mule.api.endpoint.EndpointBuilder;
 15  
 import org.mule.api.endpoint.OutboundEndpoint;
 16  
 import org.mule.config.i18n.CoreMessages;
 17  
 import org.mule.module.cxf.endpoint.CxfEndpointBuilder;
 18  
 
 19  0
 public class WebServiceWrapperComponent extends AbstractWebServiceWrapperComponent
 20  
 {
 21  
     private String wsdlPort;
 22  
     private String operation;
 23  
 
 24  
     protected MuleMessage doInvoke(MuleEvent event) throws Exception
 25  
     {
 26  0
         MuleContext muleContext = event.getMuleContext();
 27  
 
 28  
         String tempUrl;
 29  0
         if (addressFromMessage)
 30  
         {
 31  0
             tempUrl = event.getMessage().getInboundProperty(WS_SERVICE_URL);
 32  0
             if (tempUrl == null)
 33  
             {
 34  0
                 throw new IllegalArgumentException(CoreMessages.propertyIsNotSetOnEvent(WS_SERVICE_URL)
 35  
                     .toString());
 36  
             }
 37  
         }
 38  
         else
 39  
         {
 40  0
             tempUrl = address;
 41  
         }
 42  
 
 43  0
         EndpointBuilder endpointBuilder = new CxfEndpointBuilder("cxf:" + tempUrl, muleContext);
 44  0
         if (wsdlPort != null)
 45  
         {
 46  0
             endpointBuilder.setProperty("port", wsdlPort);
 47  
         }
 48  0
         if (operation != null)
 49  
         {
 50  0
             endpointBuilder.setProperty("operation", operation);
 51  
 
 52  
         }
 53  
 
 54  
         //TODO MULE-4952 what is the strategy here for proxy components?
 55  0
         endpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE);
 56  0
         OutboundEndpoint endpoint = endpointBuilder.buildOutboundEndpoint();
 57  
         
 58  0
         MuleEvent responseEvent = endpoint.process(new DefaultMuleEvent(event.getMessage(), endpoint,
 59  
             event.getSession()));
 60  
 
 61  0
         if (responseEvent != null)
 62  
         {
 63  0
             return responseEvent.getMessage();
 64  
         }
 65  
         else
 66  
         {
 67  0
             return null;
 68  
         }
 69  
     }
 70  
 
 71  
     public String getWsdlPort()
 72  
     {
 73  0
         return wsdlPort;
 74  
     }
 75  
 
 76  
     public void setWsdlPort(String wsdlPort)
 77  
     {
 78  0
         this.wsdlPort = wsdlPort;
 79  0
     }
 80  
 
 81  
     public String getOperation()
 82  
     {
 83  0
         return operation;
 84  
     }
 85  
 
 86  
     public void setOperation(String operation)
 87  
     {
 88  0
         this.operation = operation;
 89  0
     }
 90  
 
 91  
 }