I am trying to consume a web service using the example at :
http://www.mulesoft.org/documentation/display/MULE3USER/Consuming+Web+Services+with+CXF
Based on the example I have made the following entry in mule-config.xml. How do I use this in my application? I looked at using a MuleClient, but that seems to require that you define the endpoint.
Should I be using a MuleClient to utilize this flow or is there some otherway?
The application is set of Spring object.
<flow name="connectorClient">
<cxf:jaxws-client serviceClass="gapps.GoogleAppsConnectorImpl" operation="add"/>
<outbound-endpoint address="http://localhost:8080/idm-esb/idmsrvc/GoogleAppsConnectorService"/>
</flow>
Thanks for your help.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
One more question related to this. I am looking at a url provided earlier to make to allow for dynamic endpoints?
<outbound-endpoint address="smtp://user:secret@#[header:OUTBOUND:host]"/>
<http:outbound-endpoint host="localhost" port="#[header:INBOUND:portNumber]" path="orderService"/>
I am assuming that in the above example, that the values are coming from a properties file. Is there any to set this file values programatically? In my case the endpoints will be stored in a database and set through a UI.
Appreciate your help with these.
I am trying to implement a flow to call a service. However, the call to the service does not occur. I am sure I have errors in my setup, but I am not certain as to where.
Any thoughts on what I need to change?
MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
ConfigurationBuilder builder = new SpringXmlConfigurationBuilder("mule-service-client-config.xml");
MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
MuleContext context = muleContextFactory.createMuleContext(builder, contextBuilder);
context.start();
MuleClient client = new MuleClient(context);
client.dispatch("vm://dispatchConnectorMessage", addReqType, null);
<flow name="connectorClient">
<vm:inbound-endpoint address="vm://dispatchConnectorMessage" exchange-pattern="request-response" >
</vm:inbound-endpoint>
<cxf:jaxws-client serviceClass="spi.gapps.GoogleAppsConnectorImpl" operation="add"/>
<outbound-endpoint
address="http://localhost:8080/idm-esb/idmsrvc/GoogleAppsConnectorService"
exchange-pattern="request-response" />
</flow>
thanks
Below is my flow definition, client and errors.
How should I be passing in the property?
<flow name="connectorClient">
<vm:inbound-endpoint address="dispatchConnectorMessage" exchange-pattern="request-response" >
</vm:inbound-endpoint>
<cxf:jaxws-client serviceClass="org.spml2.interf.ConnectorService" operation="add"/>
<outbound-endpoint
address="http://localhost:8080/idm-esb/idmsrvc/#[header:OUTBOUND:serviceName]"
exchange-pattern="request-response" />
</flow>
MuleClient client = new MuleClient(context);
log.info("Mule client calling dispatchConnector");
Map msgPropMap = new HashMap();
//msgPropMap.put("header:OUTBOUND:serviceName", "LDAPConnectorService");
msgPropMap.put("OUTBOUND:serviceName", "LDAPConnectorService");
MuleMessage msg = client.send("dispatchConnectorMessage?method=add", addReqType, msgPropMap);
Exception stack is:
1. Expression Evaluator "header" with expression "outbound:serviceName" returned
null but a value was required. (org.mule.api.expression.RequiredValueException)
org.mule.expression.ExpressionUtils:184 (http://www.mulesoft.org/docs/site/cur
rent3/apidocs/org/mule/api/expression/RequiredValueException.html)
2. Failed to route event via endpoint: org.mule.endpoint.DynamicOutboundEndpoint
@11913b3. Message payload is of type: MuleUniversalConduit$2 (org.mule.api.trans
port.DispatchException)
org.mule.endpoint.DynamicOutboundEndpoint:109 (http://www.mulesoft.org/docs/si
te/current3/apidocs/org/mule/api/transport/DispatchException.html)
msgPropMap.put("OUTBOUND:serviceName", "LDAPConnectorService");
In an earlier message, you had suggested that the vm:endpoint would look better as:
<vm:inbound-endpoint address="dispatchConnectorMessage" exchange-pattern="request-response" >
instead of
<vm:inbound-endpoint address="vm://dispatchConnectorMessage" exchange-pattern="request-response" >
However, when I remove the vm:// I get the exception below. How should I be defining the address for the vm:inbound endpoint?:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException:
Property 'protocol' threw exception; nested exception is java.lang.IllegalArgume
ntException: Address 'dispatchConnectorMessage' for protocol 'vm' should start w
ith vm://
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:1
15)
at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegi
stry(SpringXmlConfigurationBuilder.java:116)
at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(Spri
ngXmlConfigurationBuilder.java:73)
Thanks again for all your help with this
One more question - On my service I have several operations (add, modify, delete, setPassword). Is there a recommended way to map to these operations? Or should I create separate flow for each?
Currently, I have the only one operation defined:
<cxf:jaxws-client serviceClass="org.openiam.spml2.interf.ConnectorService" operation="add"/>
thanks
In an earlier message, you had suggested that the vm:endpoint would look better as:
instead of
<vm:inbound-endpoint address="dispatchConnectorMessage" exchange-pattern="request-response" >
<vm:inbound-endpoint address="vm://dispatchConnectorMessage" exchange-pattern="request-response" >
One more question - On my service I have several operations (add, modify, delete, setPassword). Is there a recommended way to map to multiple operations or be able to select which operation gets called based on the request that is coming in? Or should I create separate flow for each?
Currently, I have the only one operation defined: That works fine.
I am having some difficulties in setup the message-properties-transformer. Any thoughts on where I am wrong?
My configuration and exception are below:
<message-properties-transformer name="serviceClient" scope="outbound">
<add-message-property key="operation" value="#[header:INBOUND:operation]"/>
</message-properties-transformer>
<flow name="connectorClient">
<vm:inbound-endpoint path="dispatchConnectorMessage" exchange-pattern="request-response" >
</vm:inbound-endpoint>
<cxf:jaxws-client serviceClass="interf.ConnectorService" >
</cxf:jaxws-client>
<outbound-endpoint
address="http://localhost:8080/dm-esb/idmsrvc/#[header:INBOUND:serviceName]"
exchange-pattern="request-response" transformer-refs="serviceClient" >
</outbound-endpoint>
</flow>
2011-01-03 00:08:58,409 [http-8080-1] ERROR AbstractExceptionListener :
********************************************************************************
Message : local part cannot be "null" when creating a QName (java.
lang.IllegalArgumentException)
Code : MULE_ERROR-10999
--------------------------------------------------------------------------------
Exception stack is:
1. local part cannot be "null" when creating a QName (java.lang.IllegalArgumentE
xception)
javax.xml.namespace.QName:246 (null)
2. local part cannot be "null" when creating a QName (java.lang.IllegalArgumentE
xception) (org.mule.api.DefaultMuleException)
org.mule.module.cxf.CxfOutboundMessageProcessor:139 (http://www.mulesoft.org/d
ocs/site/current3/apidocs/org/mule/api/DefaultMuleException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.lang.IllegalArgumentException: local part cannot be "null" when creating a
QName
at javax.xml.namespace.QName.<init>(QName.java:246)
at javax.xml.namespace.QName.<init>(QName.java:190)
at org.mule.module.cxf.CxfOutboundMessageProcessor.getBindingOperationFr
omEndpoint(CxfOutboundMessageProcessor.java:310)
+ 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for ev
erything)
Map<String,String> msgPropMap = new HashMap<String,String>();
msgPropMap.put("serviceName", "LDAPConnectorService");
msgPropMap.put("operation", "add");
MuleMessage msg = client.send("vm://dispatchConnectorMessage", addReqType, msgPropMap);
<flow name="connectorClient">
<vm:inbound-endpoint path="dispatchConnectorMessage" exchange-pattern="request-response" >
</vm:inbound-endpoint>
<message-properties-transformer name="serviceClient" scope="outbound">
<add-message-property key="operation" value="#[header:INBOUND:operation]"/>
</message-properties-transformer>
<cxf:jaxws-client serviceClass="spml2.interf.ConnectorService" >
</cxf:jaxws-client>
<outbound-endpoint
address="http://localhost:8080/idm-esb/idmsrvc/#[header:INBOUND:serviceName]"
exchange-pattern="request-response" >
</outbound-endpoint>
</flow>
2011-01-03 14:21:01,823 [http-8080-1] ERROR AbstractExceptionListener :
I set the operation attribute back, but it looks like the message transformer is not having any effect. I am getting an illegalargument exception indicating that the wrong operation is being called.
<flow name="connectorClient">
<vm:inbound-endpoint path="dispatchConnectorMessage" exchange-pattern="request-response" >
</vm:inbound-endpoint>
<message-properties-transformer name="serviceClient" scope="outbound">
<add-message-property key="operation" value="#[header:INBOUND:operation]"/>
</message-properties-transformer>
<cxf:jaxws-client serviceClass="interf.ConnectorService" operation="modify" >
</cxf:jaxws-client>
<outbound-endpoint
address="http://localhost:8080/idm-esb/idmsrvc/#[header:INBOUND:serviceName]"
exchange-pattern="request-response" >
</outbound-endpoint>
</flow>
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.cxf.databinding.AbstractWrapperHelper.createWrapperObject(
AbstractWrapperHelper.java:99)
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMe
ssage(WrapperClassOutInterceptor.java:103)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:236)
No worries. I appreciate all your help.
I dont have a mule source project setup. However, I can if that would help.
suneet