Consuming a Web Service

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Consuming a Web Service

Adrian Brenes-2
Hello,

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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
If you want to use this flow from within your application (ie not exposed to the outside world), yes, the best is to:
  • add a VM request-response inbound endpoint,
  • make your outbound endpoint request-response,
  • call the VM endpoint with muleClient.send
HTH
D.

On Thu, Dec 23, 2010 at 2:56 PM, suneet Shah <[hidden email]> wrote:
Hello,

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



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
Thanks David. That helps quite a bit.

One more question related to this. I am looking at a url provided earlier to make to allow for dynamic endpoints?

http://www.mulesoft.org/documentation/display/MULE3USER/Configuring+Endpoints#ConfiguringEndpoints-DynamicEndpoints

<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.

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
Nope, these values are *not* coming from a properties file (else they won't be dynamic as replaced at configuration load time - usually with ${placeholders}).

In your case, simply add properties to the message you pass to Mule and use #[header:...] to retrieve these properties and build URLs on the fly.

D.
 
One more question related to this. I am looking at a url provided earlier to make to allow for dynamic endpoints?

http://www.mulesoft.org/documentation/display/MULE3USER/Configuring+Endpoints#ConfiguringEndpoints-DynamicEndpoints

<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.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
Thanks for all your help

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
In reply to this post by ddossot
Hi,

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

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
Maybe because you do client.dispatch, which doesn't wait for a response leading to an early termination of the whole Mule instance?

What about using send instead?

HTH
D.

PS. Your inbound VM endpoint would look better like that:

<vm:inbound-endpoint path="dispatchConnectorMessage" exchange-pattern="request-response" />

If you use an endpoint from a particular namespace (vm here), better use the specific attributes of the transport instead of the generic address.


On Wed, Dec 29, 2010 at 1:02 PM, suneet Shah <[hidden email]> wrote:
Hi,

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

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
Thanks David
That worked well. I am not trying to get the dynamic endpoints to work and am having some problems.

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)

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
msgPropMap.put("OUTBOUND:serviceName", "LDAPConnectorService");

Mmmh, I don't think using the desired scope in the property name works, but I may be wrong.

I would do:

Map<?, ?> msgPropMap = Collections.singletonMap("serviceName", "LDAPConnectorService");
MuleMessage msg = client.send("vm://dispatchConnectorMessage", addReqType, msgPropMap);

with:

       <flow name="connectorClient">
                <vm:inbound-endpoint path="dispatchConnectorMessage" exchange-pattern="request-response" />

                <cxf:jaxws-client serviceClass="org.spml2.interf.ConnectorService" operation="add"/>

               <outbound-endpoint
                       address="http://localhost:8080/idm-esb/idmsrvc/#[header:INBOUND:serviceName]"
                       exchange-pattern="request-response" />
       </flow>

HTH
D.

On Thu, Dec 30, 2010 at 10:02 AM, suneet Shah <[hidden email]> wrote:
Thanks David
That worked well. I am not trying to get the dynamic endpoints to work and am having some problems.

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 (<a href="http://www.mulesoft.org/docs/site/cur rent3/apidocs/org/mule/api/expression/RequiredValueException.html" target="_blank">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 (<a href="http://www.mulesoft.org/docs/si te/current3/apidocs/org/mule/api/transport/DispatchException.html" target="_blank">http://www.mulesoft.org/docs/si
te/current3/apidocs/org/mule/api/transport/DispatchException.html)

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
Thanks very much. That worked.

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

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
Hi,

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

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
In reply to this post by Adrian Brenes-2
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" >

No I suggested <vm:inbound-endpoint path="dispatchConnectorMessage" ...

If you use an endpoint from a specific transport schema use the specific attributes instead of the generic address attribute.

D.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
Thanks David.
I had actually misread your original message - hence the error.

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.

<cxf:jaxws-client serviceClass="org.openiam.spml2.interf.ConnectorService" operation="add"/>

thanks

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
Try removing the operation attribute from cxf:jaxws-client and use a message property transformer to create an outbound property named "operation" with the value you want. In this message property transformer set the property value to #[header:INBOUND:operation] to transfer a property named "operation" from inbound to outbound scope.

That should do the trick: you should be able to control the flow from your Java code by adding the operation to the props map.

HTH
D.

On Fri, Dec 31, 2010 at 9:44 AM, suneet Shah <[hidden email]> wrote:
Thanks David.
I had actually misread your original message - hence the error.

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.

<cxf:jaxws-client serviceClass="org.openiam.spml2.interf.ConnectorService" operation="add"/>

thanks

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
Hi,

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)

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
I think it is too late if you place the transformer on the outbound endpoint. Try placing the transformer right after the VM inbound.

D.


On Sun, Jan 2, 2011 at 9:12 PM, suneet Shah <[hidden email]> wrote:
Hi,

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 (<a href="http://www.mulesoft.org/d ocs/site/current3/apidocs/org/mule/api/DefaultMuleException.html" target="_blank">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)

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
I tried changing it to the following, but I am still getting the error below.
Any idea on where I am off?

                        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 :
********************************************************************************

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)

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
Your config looks good to me: maybe the cxf:jaxws-client needs a default value as it boot time that is going to be overridden at runtime with the message property? Can you try putting "add" back and override with an "operation" property equals to another of the operations you want to use?

HTH
D.

On Mon, Jan 3, 2011 at 11:26 AM, suneet Shah <[hidden email]> wrote:
I tried changing it to the following, but I am still getting the error below.
Any idea on where I am off?

                       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 :
********************************************************************************

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 (<a href="http://www.mulesoft.org/d ocs/site/current3/apidocs/org/mule/api/DefaultMuleException.html" target="_blank">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)

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

Adrian Brenes-2
Hi David,

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)

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Consuming a Web Service

ddossot
>:(

Sorry for this.

Do you, by any chance, have the possibility to put a breakpoint in org.mule.module.cxf.CxfOutboundMessageProcessor.getMethod(event) and see why isn't the "operation" property taken into account when finding the target service method?

D.

On Mon, Jan 3, 2011 at 2:12 PM, suneet Shah <[hidden email]> wrote:
Hi David,

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)

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

   http://xircles.codehaus.org/manage_email



12
Loading...