views:

262

answers:

3

Technologies Involved

  • Mule
  • Apache CXF

Given

A simple POJO (controversial acronym, but let's say a smart POJO):

public class SmartPojo implements SomeBusinessInterface {

    public String doSomethingSmart( With something ) {

        String result;

        result = Irrelevant.process( something )

        return result;
    }
}

Need to Achieve

Expose SmartPojo as a Webservice without touching the code ( without: changing SmartPojo, changing SmartPojoInterface, adding a new interface, any JAX-WS annotations, etc ). The goal is to use Mule configuration only.

I can easily do it with Spring Integration, and would appreciate any input on how to achieve it with Mule. ( It seems that "cxf:inbound-endpoint" needs to be configured with "method-entry-point-resolver" + providing my WSDL in some way.. or another direction? )

Thank you

A: 

making progress with cxf's simple frontend:

<model name="smartPojoExposeModel">
    <service name="smartPojoExpose">
        <inbound>
            <cxf:inbound-endpoint 
                address="http://localhost:65082/smart-pojo"
                frontend="simple" 
                synchronous="true"/>
        </inbound>

        <component class="org.smart.pojo.SmartPojo" />

        <!-- DEBUG: Making sure the payload was received on inbound endpoint -->
        <outbound>
            <pass-through-router>
                <stdio:outbound-endpoint system="OUT"/>
            </pass-through-router>
        </outbound>         
    </service>
</model>

see it in a console (via stdio ), however getting "No message found for part" exception when org.apache.cxf.aegis.databinding.XMLStreamDataWriter.write()

still trying to understand if this is a right approach + whether or not I can configure which method to invoke, instead of an explicit call:

http://localhost:65082/smart-pojo/doSomethingSmart/something/weird/

suggestions? ideas?

litius
+1  A: 

CXF will use reflection to examine the public methods of your component class and expose them as SOAP operations in the wsdl.

This quote comes straight from Mule In Action. (page 58)

If you are trying to expose every public method in your class as a SOAP operation, then this is the approach you should take.

From your explict call above, it looks like you may want to implement a REST-ful or REST-like interface, not a SOAP interface. You would not use cxf to implement that. You would probably need to look at http://www.mulesoft.org/display/MULE/Mule+RESTpack.

solidjb
A: 

Hi litius,

Did you find an answer to this? I would also like to hear how you would turn a POJO with configuration only into a WS using Spring Integration... !?

thanks, Felix

oktylus
@Felix, My question was about Mule. In Spring Integration it is easily achieved since it strictly follows Enterprise Intergation Patterns, where there is a clear separation between Integration harness ( channels, adapters, etc.. ) and the actual function to take ( e.g. business service ). Here is how you would do it in Spring Integration: <ws:inbound-gateway id="simpleGateway" request-channel="inputChannel"/> <service-activator input-channel="inputChannel" ref="somePojo" method="someMethod"/>
litius