[mule-user] How can I make a CXF Proxy Service return the correct WSDL?

158 views
Skip to first unread message

Magnus Larsson

unread,
Feb 1, 2009, 6:25:22 AM2/1/09
to us...@mule.codehaus.org
Hello!

I'm trying to build a Web Service Proxy that route incoming calls depending on SOAP Header information.

The example on http://www.mulesource.org/display/MULE2USER/Proxying+Web+Services using a CXF Proxy Service is very close to what I need.

But a problem I have found with this solution is that my endpoint now return a WSDL based on the interface org.mule.transport.cxf.
support.ProxyService instead of my WSDL.
This makes it impossible to work with JAX-WS clients (... and I need that)

The JAX-WS client (using CXF) returns the following error message:
javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {urn:soalab:purchase:v1}PurchasingService.

(Since http://localhost:9000/Purchasing?wsdl returns a WSDL based on the ProxyService - interface instead of my WSDL)


I have tried to add the wsdlLocation atttribute to the example, i.e.:

        <service name="routeBasedOnSoapAction">
            <inbound>
                <cxf:inbound-endpoint
                    wsdlLocation="classpath:/schemas/business/purchase/purchase-1.0.wsdl"
                    address="http://localhost:9000/Purchasing"
                    proxy="true"
                    synchronous="true"/>

But then the Mule Server fails during startup with

2009-feb-01 08:02:07 org.apache.cxf.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL
INFO: Creating Service {http://support.cxf.transport.mule.org/}ProxyService from WSDL: classpath:/schemas/business/purchase/purchase-1.0.wsdl
2009-02-01 08:02:07,160 ERROR org.mule.MuleServer            -
********************************************************************************
Message               : Initialisation Failure: Could not find definition for service {http://support.cxf.transport.mule.org/}ProxyService.
Type                  : org.mule.api.lifecycle.InitialisationException
Code                  : MULE_ERROR-72085
JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/lifecycle/InitialisationException.html
Object                : CxfMessageReceiver{this=4c502d, receiverKey=null, endpoint=http://localhost:9000/Purchasing}
********************************************************************************
Exception stack is:
1. Could not find definition for service {http://support.cxf.transport.mule.org/}ProxyService. (org.apache.cxf.service.factory.ServiceConstructionException)
  org.apache.cxf.wsdl11.WSDLServiceFactory:114 (null)
2. Initialisation Failure: Could not find definition for service {http://support.cxf.transport.mule.org/}ProxyService. (org.mule.api.lifecycle.InitialisationException)
  org.mule.transport.cxf.CxfMessageReceiver:273 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/lifecycle/InitialisationException.html)
********************************************************************************
Root Exception stack trace:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {http://support.cxf.transport.mule.org/}ProxyService.
    at org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:114)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:309)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:403)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:188)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)
 

Any suggestions on how to solve this?
I.e. make the CXF Proxy Service return my WSDL or go for another design?

Regards,
Magnus.

Daniel Feist

unread,
Feb 23, 2009, 9:05:35 AM2/23/09
to us...@mule.codehaus.org
Hi,

This has been fixed in Mule 2.2.0 which was released on Friday and will be announced today.  You need to specify the "wsdlLocation" and the "serviceName" and possibly "namespace"  (Note namespace hasn't got an attribute so you'll have to use a property for now)


Get back to me if you have any other issues with this.

HTH,
Dan

flashard

unread,
Feb 24, 2009, 4:59:05 PM2/24/09
to us...@mule.codehaus.org

I still get this error when using Mule 2.2 (upgraded yesterday), but in my
case I'm using Mule to use a CXF endpoint.

Relevant config:

<service name="availabilityManager">
<inbound>
<inbound-endpoint ref="availabilityRequest" connector-ref="activeMQ"
synchronous="true"/>
</inbound>
<outbound>
<pass-through-router>
<cxf:outbound-endpoint
proxy="true"
synchronous="true"
wsdlPort="AvailabilityRequestPortPort"

wsdlLocation="http://localhost:9080/availability-stubs/invoke/availability.wsdl"

address="http://localhost:9080/availability-stubs/invoke/?Service=AvailabilityRequestPortService"/>
</pass-through-router>
</outbound>
</service>

Error message is:

2009-02-24 21:52:40,406 ERROR ActiveMQ Session Task
(AbstractExceptionListener.java:390) -


********************************************************************************
Message : Initialisation Failure: Could not find definition
for service {http://support.cxf.transport.mule.org/}ProxyService.

Type : org.mule.retry.RetryPolicyExhaustedException
Code : MULE_ERROR-84
JavaDoc :
http://www.mulesource.org/docs/site/current2/apidocs/org/mule/retry/RetryPolicyExhaustedException.html
Object :
endpoint.outbound.http://localhost:9080/availability-stubs/invoke/call?Service=AvailabilityRequestPortService


********************************************************************************
Exception stack is:
1. Could not find definition for service
{http://support.cxf.transport.mule.org/}ProxyService.
(org.apache.cxf.service.factory.ServiceConstructionException)
org.apache.cxf.wsdl11.WSDLServiceFactory:114 (null)
2. Initialisation Failure: Could not find definition for service
{http://support.cxf.transport.mule.org/}ProxyService.

(org.mule.retry.RetryPolicyExhaustedException)
org.mule.retry.policies.AbstractPolicyTemplate:97
(http://www.mulesource.org/docs/site/current2/apidocs/org/mule/retry/RetryPolicyExhaustedException.html)


********************************************************************************
Root Exception stack trace:
org.apache.cxf.service.factory.ServiceConstructionException: Could not find
definition for service {http://support.cxf.transport.mule.org/}ProxyService.
at
org.apache.cxf.wsdl11.WSDLServiceFactory.create(WSDLServiceFactory.java:114)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:309)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:403)
at
org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:188)
at
org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:100)

at
org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:52)
at
org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:97)
at
org.mule.transport.cxf.ClientWrapper.createClientProxy(ClientWrapper.java:230)
at
org.mule.transport.cxf.ClientWrapper.initialize(ClientWrapper.java:109)
at
org.mule.transport.cxf.CxfMessageDispatcher.doConnect(CxfMessageDispatcher.java:76)
at
org.mule.transport.AbstractConnectable$1.doWork(AbstractConnectable.java:178)
at
org.mule.retry.policies.AbstractPolicyTemplate.execute(AbstractPolicyTemplate.java:59)
at
org.mule.transport.AbstractConnectable.connect(AbstractConnectable.java:166)
at
org.mule.transport.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:161)
at
org.mule.transport.AbstractConnector.send(AbstractConnector.java:2017)
at
org.mule.endpoint.DefaultOutboundEndpoint.send(DefaultOutboundEndpoint.java:76)
at
org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:327)
at
org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:213)
at
org.mule.routing.outbound.AbstractOutboundRouter$2.doInTransaction(AbstractOutboundRouter.java:152)
at
org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:99)
at
org.mule.routing.outbound.AbstractOutboundRouter.send(AbstractOutboundRouter.java:159)
at
org.mule.routing.outbound.FilteringOutboundRouter.route(FilteringOutboundRouter.java:79)
at
org.mule.routing.outbound.OutboundPassThroughRouter.route(OutboundPassThroughRouter.java:69)
at
org.mule.routing.outbound.DefaultOutboundRouterCollection$1.doInTransaction(DefaultOutboundRouterCollection.java:64)
at
org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:45)
at
org.mule.routing.outbound.DefaultOutboundRouterCollection.route(DefaultOutboundRouterCollection.java:69)
at
org.mule.service.AbstractService.sendToOutboundRouter(AbstractService.java:902)
at org.mule.model.seda.SedaService.doSend(SedaService.java:252)
at
org.mule.service.AbstractService.sendEvent(AbstractService.java:505)
at
org.mule.DefaultMuleSession.sendEvent(DefaultMuleSession.java:354)
at
org.mule.routing.inbound.DefaultInboundRouterCollection.send(DefaultInboundRouterCollection.java:220)
at
org.mule.routing.inbound.DefaultInboundRouterCollection.route(DefaultInboundRouterCollection.java:180)
at
org.mule.transport.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:364)
at
org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:252)
at
org.mule.transport.AbstractReceiverWorker$1.doInTransaction(AbstractReceiverWorker.java:114)
at
org.mule.transaction.TransactionTemplate.execute(TransactionTemplate.java:99)
at
org.mule.transport.AbstractReceiverWorker.doRun(AbstractReceiverWorker.java:131)
at
org.mule.transport.AbstractReceiverWorker.run(AbstractReceiverWorker.java:62)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at
org.mule.work.SyncWorkExecutor.doExecute(SyncWorkExecutor.java:41)
at
org.mule.work.MuleWorkManager.executeWork(MuleWorkManager.java:268)
at org.mule.work.MuleWorkManager.doWork(MuleWorkManager.java:156)
at
org.mule.transport.jms.MultiConsumerJmsMessageReceiver$SubReceiver.onMessage(MultiConsumerJmsMessageReceiver.java:313)
at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:1021)
at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)

--
View this message in context: http://www.nabble.com/How-can-I-make-a-CXF-Proxy-Service-return-the-correct-WSDL--tp21774054p22191591.html
Sent from the Mule - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


Dan Diephouse

unread,
Feb 24, 2009, 5:56:21 PM2/24/09
to us...@mule.codehaus.org
Try adding this to your endpoint:

<cxf:inbound-endpoint .... serviceName="YOUR_WSDL_SERVICE_NAME">
<property key="namespace" value="YOUR_WSDL_TARGET_NAMESPACE">
</cxf:inbound-endpoint>

I'm not sure why this is required, but we'll see if we can sort it out in the future.

Dan

flashard

unread,
Feb 24, 2009, 6:43:10 PM2/24/09
to us...@mule.codehaus.org

This is an outbound endpoint using a pass through router - serviceName is
only defined on inbound CXF endpoints not outbound (my inbound endpoint is a
JMS queue)

I tried once after adding the namespace property to my outbound endpoint,
and a second time using the namespace property and and supplying the
attribute operation="<service name>" (just guessing) but got the same error
message as before.

I'm going to try the Amazon outbound CXF endpoint from the webinar next just
to make sure that the CXF client is working with a "standard" service.


Dan Diephouse-2 wrote:
>
> Try adding this to your endpoint:
> <cxf:inbound-endpoint .... serviceName="YOUR_WSDL_SERVICE_NAME">
> <property key="namespace" value="YOUR_WSDL_TARGET_NAMESPACE">
> </cxf:inbound-endpoint>
>

--
View this message in context: http://www.nabble.com/How-can-I-make-a-CXF-Proxy-Service-return-the-correct-WSDL--tp21774054p22193293.html

Daniel Feist

unread,
Feb 24, 2009, 6:56:55 PM2/24/09
to us...@mule.codehaus.org
If you are using an outbound cxf endpoint with "proxy=true" then you
are calling another webservice somewhere (e.g. amazon). Therefore
these values need to be the target service name and namespace, not
those from inbound wsdl.

Dan

Dan Diephouse

unread,
Feb 24, 2009, 7:12:28 PM2/24/09
to us...@mule.codehaus.org
Ah... Well if you have proxy="true" you don't need the wsdlLocation at all. I wonder if taking that attribute off will fix things?

flashard

unread,
Feb 24, 2009, 7:58:27 PM2/24/09
to us...@mule.codehaus.org

On my machine I have a seperate Tomcat VM running my web service (running on
port 8080, but proxied via tcpTrace to port 9080) and I'm trying to make
Mule consume this service. My standalone Mule server is not serving any web
services at the moment - just consuming them.

If I access the WSDL specified in my CXF endpoint i.e.
http://localhost:9080/availability-stubs/invoke/availability.wsdl, then the
target namespace in the WSDL is "urn:com.hotels.availability1_0" which is
what I put in the endpoint.

I renamed my Service in the WSDL for clarities sake, and this is now
"AvailabilityService" (which is copied + pasted from the WSDL). As from the
previous posting, there is no attribute on the outbound service to specify
service which is why I put it on the address URL i.e. random guess based on
blindly copying something I don't understand from the Amazon CXF endpoint
example

I fire this all up, and I get exactly the same error message as before. For
reference, the Mule Endpoint is now:

<cxf:outbound-endpoint
proxy="true"
synchronous="true"

operation="Availability"
wsdlPort="AvailabilityPort"

wsdlLocation="http://localhost:9080/availability-stubs/invoke/availability.wsdl"

address="http://localhost:9080/availability-stubs/invoke/call?Service=AvailabilityService">
<property key="namespace" value="urn:com.hotels.availability1_0"/>
</cxf:outbound-endpoint>

and the WSDL just copied from
http://localhost:9080/availability-stubs/invoke/availability.wsdl is:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:schema="urn:com.hotels.availability1_0"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
targetNamespace="urn:com.hotels.availability1_0"> <wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:avs="urn:com.hotels.availability1_0"
targetNamespace="urn:com.hotels.availability1_0">

<xsd:element name="AvailabilityRequest">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="locationId"
type="xsd:long"/>
<xsd:element maxOccurs="1" minOccurs="1" name="checkInDate"
type="xsd:dateTime"/>
<xsd:element maxOccurs="1" minOccurs="1" name="numberOfDays"
type="xsd:int"/>
<xsd:element maxOccurs="1" minOccurs="1" name="numberOfRooms"
type="xsd:int"/>
<xsd:element maxOccurs="1" minOccurs="1" name="numberOfPeople"
type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="AvailabilityResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="available"
type="xsd:boolean"/>
<xsd:element maxOccurs="1" minOccurs="0" name="notes"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>
</wsdl:types>
<wsdl:message name="AvailabilityRequest">
<wsdl:part element="schema:AvailabilityRequest"
name="AvailabilityRequest">
</wsdl:part>
</wsdl:message>
<wsdl:message name="AvailabilityResponse">
<wsdl:part element="schema:AvailabilityResponse"
name="AvailabilityResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="Availability">
<wsdl:operation name="Availability">
<wsdl:input message="schema:AvailabilityRequest"
name="AvailabilityRequest">
</wsdl:input>
<wsdl:output message="schema:AvailabilityResponse"
name="AvailabilityResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AvailabilityBinding" type="schema:Availability">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Availability">
<soap:operation soapAction=""/>
<wsdl:input name="AvailabilityRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="AvailabilityResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AvailabilityService">
<wsdl:port binding="schema:AvailabilityBinding" name="AvailabilityPort">
<soap:address
location="http://localhost:9080/availability-stubs/invoke/call"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

Note also that I have a standalone CXF client generated using the CXF Maven
WSDL2Java plugin and this is accessing exactly the same instance of the
service using the same port etc. and this is working correctly.

Am I still missing something here?

Daniel Feist wrote:
>
> If you are using an outbound cxf endpoint with "proxy=true" then you
> are calling another webservice somewhere (e.g. amazon). Therefore
> these values need to be the target service name and namespace, not
> those from inbound wsdl.
>
> Dan
>

--
View this message in context: http://www.nabble.com/How-can-I-make-a-CXF-Proxy-Service-return-the-correct-WSDL--tp21774054p22194148.html

Daniel Feist

unread,
Feb 24, 2009, 8:13:13 PM2/24/09
to us...@mule.codehaus.org
Did you try removing the wsdlLocation as Dan D suggested?

If you look at webinar example this is not used there, nor is
serviceName or namespace, these are not required on outbound endpoints
from what I remember.

<cxf:outbound-endpoint
address="http://soap.amazon.com/onca/soap?Service=AWSECommerceService
"
proxy="true" synchronous="true">

Dan

flashard

unread,
Feb 24, 2009, 8:21:32 PM2/24/09
to us...@mule.codehaus.org

Excellent - Running with just:

<cxf:outbound-endpoint
proxy="true"
synchronous="true"

address="http://localhost:9080/availability-stubs/invoke/call?Service=AvailabilityService">
<property key="namespace" value="urn:com.hotels.availability1_0"/>
</cxf:outbound-endpoint>

And now its happy (or at least onto the next problem)

Thanks heaps for the help - I tried to add a comment to
http://www.mulesource.org/display/MULE2USER/Proxying+Web+Services but it
wouldn't let me... would be great if the docs referenced the need to add the
namespace property.

Dan Diephouse-2 wrote:
>
> Ah... Well if you have proxy="true" you don't need the wsdlLocation at
> all.
> I wonder if taking that attribute off will fix things?
>

--
View this message in context: http://www.nabble.com/How-can-I-make-a-CXF-Proxy-Service-return-the-correct-WSDL--tp21774054p22194381.html

flashard

unread,
Feb 24, 2009, 8:36:04 PM2/24/09
to us...@mule.codehaus.org

Sorry - got a bit out of sequence with replies and confirmed this in another
branch of Nabble.

Yes, removing the wsdlLocation made it work.

However I thought the wsdlLocation was a reasonable attribute to add based
on the CXF documentation that says that WSDLs are retreived at runtime
(unless configured not to) so that WS-Policy assertions etc. can be
processed - so not sure whether wsdlLocation causing it to fail is a bug, or
a feature request to somehow get Mule to pass the wsdlLocation through to
bits of CXF that want it.

Thanks again though...

--
View this message in context: http://www.nabble.com/How-can-I-make-a-CXF-Proxy-Service-return-the-correct-WSDL--tp21774054p22194515.html

Magnus Larsson

unread,
Mar 12, 2009, 8:05:57 AM3/12/09
to us...@mule.codehaus.org
Hello Dan!

Do you have any idea when namespace will be added as an attribute so we can skip the namespace-property?

The property works fine but looks "ugly" in the code ;-)

Regards,
Magnus.
--
Magnus Larsson

Callista Enterprise AB
Mobil: +46 (0)733-51 91 72
mailto:magnus....@callistaenterprise.se
http://www.callistaenterprise.se

Daniel Feist

unread,
Mar 12, 2009, 8:17:29 AM3/12/09
to us...@mule.codehaus.org
Reply all
Reply to author
Forward
0 new messages