Coverage Report - org.mule.transport.cxf.component.WebServiceWrapperComponent
 
Classes in this File Line Coverage Branch Coverage Complexity
WebServiceWrapperComponent
59%
13/22
62%
5/8
2
 
 1  
 /*
 2  
  * $Id: WebServiceWrapperComponent.java 12228 2008-07-03 00:26:59Z aguenther $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.transport.cxf.component;
 12  
 
 13  
 import org.mule.DefaultMuleMessage;
 14  
 import org.mule.api.MuleContext;
 15  
 import org.mule.api.MuleEvent;
 16  
 import org.mule.api.MuleMessage;
 17  
 import org.mule.api.endpoint.EndpointBuilder;
 18  
 import org.mule.api.endpoint.OutboundEndpoint;
 19  
 import org.mule.config.i18n.CoreMessages;
 20  
 import org.mule.endpoint.EndpointURIEndpointBuilder;
 21  
 import org.mule.transport.soap.component.AbstractWebServiceWrapperComponent;
 22  
 
 23  8
 public class WebServiceWrapperComponent extends AbstractWebServiceWrapperComponent
 24  
 {
 25  
     private String wsdlPort;
 26  
     private String operation;
 27  
 
 28  
     protected MuleMessage doOnCall(MuleEvent event) throws Exception
 29  
     {
 30  4
         MuleContext muleContext = event.getMuleContext();
 31  
 
 32  
         String tempUrl;
 33  4
         if (addressFromMessage)
 34  
         {
 35  2
             tempUrl = event.getMessage().getStringProperty(WS_SERVICE_URL, null);
 36  2
             if (tempUrl == null)
 37  
             {
 38  0
                 throw new IllegalArgumentException(CoreMessages.propertyIsNotSetOnEvent(WS_SERVICE_URL)
 39  
                     .toString());
 40  
             }
 41  
         }
 42  
         else
 43  
         {
 44  2
             tempUrl = address;
 45  
         }
 46  4
         MuleMessage message = new DefaultMuleMessage(event.transformMessage());
 47  
 
 48  4
         EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("cxf:" + tempUrl, muleContext);
 49  4
         if (wsdlPort != null)
 50  
         {
 51  0
             endpointBuilder.setProperty("wsdlPort", wsdlPort);
 52  
         }
 53  4
         if (operation != null)
 54  
         {
 55  0
             endpointBuilder.setProperty("operation", operation);
 56  
 
 57  
         }
 58  
 
 59  4
         OutboundEndpoint endpoint = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(
 60  
             endpointBuilder);
 61  
 
 62  4
         MuleMessage result = event.getSession().sendEvent(message, endpoint);
 63  4
         return result;
 64  
     }
 65  
 
 66  
     public String getWsdlPort()
 67  
     {
 68  0
         return wsdlPort;
 69  
     }
 70  
 
 71  
     public void setWsdlPort(String wsdlPort)
 72  
     {
 73  0
         this.wsdlPort = wsdlPort;
 74  0
     }
 75  
 
 76  
     public String getOperation()
 77  
     {
 78  0
         return operation;
 79  
     }
 80  
 
 81  
     public void setOperation(String operation)
 82  
     {
 83  0
         this.operation = operation;
 84  0
     }
 85  
 
 86  
 }