Mule CXF consuming webservice - mule

i am creating one webservice in mule using cxf:jaxws-service. This is the url :http://localhost:65042/InsertDocService/InsertDoc, i am ablie to generate WSDL file, but i want to consume this service in mule using cxf:jaxws-client.
<flow name="documentumclientflowFlow1" doc:name="documentumclientflowFlow1">
<inbound-endpoint address="http://localhost:65042/InsertDocumentumService/InsertDocumentum" doc:name="Generic"/>
<cxf:jaxws-client operation="insertDocumentum" serviceClass="com.integration.IDocumentumInsert" port="80" mtomEnabled="true" enableMuleSoapHeaders="true" doc:name="SOAP"/>
<outbound-endpoint address="http://locahhost:65042/InsertDocumentumService/InsertDocumentum" doc:name="Generic"/>
</flow>
if i invoke this, it's going to Service project and getting erorr like"org.apache.cxf.interceptor.Fault: No such operation: (HTTP GET PATH_INFO: /InsertDocumentumService/InsertDocumentum)". Please any one suggest me how can i solve this issue and how can i consume this service.

Besides the type (locahhost instead of localhost), it looks like you're trying to use the same address in the outbound endpoint than in the inbound one. I don't think this is what you want to do, as it will lead to a looping re-entrant call that will eventually exhaust the pool threads, block, time out and die in a fire.
So what do you want to do with "documentumclientflowFlow1"? It is unclear from your question.

Related

Call a File Inbound Endpoint via Http endpoint - Set XML as payload and update in IBM MQ

I am designing an application flow where I have to read a file (XML File) and put the data into IBM MQ (Queue). Do I need to create an HTTP request that will trigger the File read and update queue, otherwise how do I perform this task.
Currently I am creating an HTTP Request and connecting it to WMQ but I am getting NULL data into the Queue. Basically the payload is NULL.
This is the data I read when I browse the Queue:
sr.org.mule.transport.NullPayload1.L5U���...xp
Try like this:
Whenever you use File connector at any other place than the beginning of the flow, then it becomes an outbound endpoint.
For using File as an inbound endpoint to retrieve any file, you must use it in the beginning of some flow & keep the flow in stopped state initially as:
<flow name="filePickupFlow" initialState="stopped">
<file:inbound-endpoint path="src/main/resources/input" responseTimeout="10000" doc:name="File"/>
<wmq:outbound-endpoint queue="gh" doc:name="WMQ" connector-ref="WMQ"/>
</flow>
For your case just change the path with your required file location.
Then for further calling it via http, create another flow with http endpoint & use an Expression component to start the flow containing file inbound endpoint call as :
<expression-component doc:name="Expression">
app.registry.filePickupFlow.start();
</expression-component>
Then if you wish to stop it after it completes processing, you can again use an Expression component as:
<expression-component doc:name="Expression">
Thread.sleep(5000);
app.registry.filePickupFlow.stop();
</expression-component>
Thread.sleep() is used here just to give some time gap between flow start & stop to let the flow operation complete. You can add some other thing for maintaing this time gap or set the time according to your own usage.
I guess this is what you were looking for.
Regards,
JJ
If you want to access the file component on-demand( Whenever you access the HTTP, only then File component needs to access), use Mule Requester in the place of file component which do the same work.
<mulerequester:config name="Mule_Requester" doc:name="Mule Requester"/>
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" basePath="test2" doc:name="HTTP Listener Configuration"/>
<flow name="httpFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<mulerequester:request config-ref="Mule_Requester" resource="file://C:/in" doc:name="Mule Requester"/>
<object-to-string-transformer doc:name="Object to String"/>
<logger message="**payload:*#[payload]" level="INFO" doc:name="Use WMQ here instead of Logger"/>
</flow>
Link to refer: https://github.com/mulesoft/mule-module-requester/blob/master/mulerequesterdemo/src/main/app/MuleRequesterDemo.xml
Instead of HTTP, you can also schedule job trigger using Poll component based on your requirement. Hope this helps.
You wanted to used file connector as inbound endpoint but actually using as outbound endpoint. Check your configuration xml file for file connector.
There are many ways for reading file as inbound like file connector, Poll scope or Quartz connector. You can use anyone of these as per you requirement. The simplest flow is as
<flow name="testfixedFlow">
<file:inbound-endpoint path="tmp" connector-ref="File" responseTimeout="10000" doc:name="File"/>
<wmq:outbound-endpoint queue="xyz" connector-ref="WMQ" doc:name="WMQ"/>
</flow>
But if you want to get resource in between the flow you can use Mule requester
Hope this helps.

Session variable are wiped out when passing through VM endpoint in Mule ESB ( Uses AMQP)

I'm using very simple flow, From the first flow I'm taking message from AMQP ( Ack Mode: Manual) and passing it to second flow via VM , In the 2nd flow where I'm using AMQP acknowledgement processor to acknowledge each message.
When we use VM, Both deliver tag and channel tag are wiped out( which is mandatory to AMQP acknowledge message processor as described in this url AMQP acknowledgement mule). So I'm trying to save the deliver-tag and amqp.channel in session variable.
First time I wondered, Channel value which is stored in session variable is erased when it passed through VM, but can able to see delivery tag.
Observation:
Instead of VM if we use flow-ref. It works fine. But in my case I need to use VM only.
amqp.delivery-tag type (java.lang.long)
amqp.channel type (com.rabbitmq.client.impl.ChannelN).
If the `Type' of amqp.channel causing problem. If so how can I save this in session variable. Please suggest. Please find my config xml.
<flow name="testrabbitmqFlow1" doc:name="testrabbitmqFlow1" >
<amqp:inbound-endpoint queueName="amqp.test.queue" exchangeDurable="true" queueDurable="true" responseTimeout="1000000" connector-ref="AMQP_Test" doc:name="AMQP">
<amqp:transaction recoverStrategy="REQUEUE" action="ALWAYS_BEGIN"/>
</amqp:inbound-endpoint>
<byte-array-to-string-transformer doc:name="Byte Array to String"/>
<set-session-variable variableName="storedeliveryTag" value="#[flowVars['amqp.delivery-tag']]" doc:name="Session Variable"/>
<set-session-variable variableName="storeChannel" value="#[flowVars['amqp.channel']]" doc:name="Session Variable"/>
<vm:outbound-endpoint exchange-pattern="one-way" path="/test" doc:name="VM">
<vm:transaction action="NONE"/>
</vm:outbound-endpoint>
Do any one knows how to resolve the issue.
This will never work
<vm:outbound-endpoint exchange-pattern="one-way" ...
First because given that the pattern is one-way the original thread will end, and the message will be put in a seda queue for a different thread pool.
Then because, when you put a message on a transport like VM, Http, etc. Flow variables get lost, and object instances, even if you try to serialize them and send them to another host, it won't make sense to the other host, i.e: open a file, try to serialize the descriptor somehow and send it to another host, it won't make sense.
My recomendation is to use a flow-ref rather than vm.

Alternative way for dynamic inbound endpoint for Mule 3

I am working on migrating my Mule 2 project to Mule 3. However, since Mule 3.3 stop supporting dynamic inbound endpoint, I need to find an alternative way to rewrite my inbound endpoint.
Basically, I want to make http call to get some data from specific websites by using current system time as the query parameter. My codes in mule-config.xml is like the following
<flow name="RetrieveNewsService">
<http:inbound-endpoint host="www.awebsite.com" port="80" path="datacenter/someData.asp?category=1&date=[function:dateStamp:MMddyyyy]" connector-ref="RetrieveNewsPollingHttpConnector" exchange-pattern="one-way" />
//doing some process
</flow>
I feed current time for "path" part, and it works perfect in Mule 2, but get the exception mentioning about dynamic inbound endpoint is not supported anymore.
Anyone has any idea how to rewrite the dynamic path for inbound endpoint and what is the purpose they decide to stop this feature? Thanks for your time!
You can use a poll on an HTTP outbound-endpoint as demonstrated here:
<flow name="RetrieveNewsService">
<poll frequency="10000">
<http:outbound-endpoint method="GET" host="localhost"
port="8082" path="test?dtm=#[server.dateTime.format('MMddyyyy')]"
exchange-pattern="request-response" />
</poll>
//doing some process
</flow>
PS. No idea why.

Start/Stop Flow/Endpoint in Mule 3.3.0

I need to programmatically start or stop a flow or endpoint from another flow. Can this be done? Is there risk of message loss?
<flow name="control>
<vm:inbound-endpoint path="in">
<script:component>
<!-- start/stop -->
</script:component>
</flow>
<flow name="startable-stoppable>
<any-transport:inbound-endpoint/>
<component/>
</flow>
After some research I've found that the best option in my case is to start/stop the connectors associated with the endpoints I want to control.
<script:component>
<script:script engine="groovy">
muleContext.getRegistry().lookupConnector('connectorName').start() // or stop()
</script:script>
</script:component>
A disadvantage of this approach is that all the endpoints associated with the connector will be affected. If this is a problem, every endpoint should have its own connector.
You can control the lifecycle of Mule moving parts with JMX: use JConsole to find out what MBean you need to access from your scripted component.

Mule Community Edition and Blocking retry policy

i would like to define some sort of "retry policy" for a custom componenet i built, meaning retry on the initiailise function of the compoenent.
Is that supported by some XML tag (retry policy??) or would i have to implement the retries inside the initialise function itself? (which would mean i would have to handle the threads and stuff if i want to handle it like the "blocking" property of the EE edition)
And suppose there is some sort of retry attempts - what would happen if the component is still attempting to reinitialise while an inbound endpoint event is triggered? (or would that endpoint not register until the flow manages to start the component?)
In case i wasnt clear - this is the short example:
<flow>
<quartz:inbound-endpoint jobName="eventTimer">
<quartz:event-generator-job />
</quartz:inbound-endpoint>
<component>
<singleton-object class="com.SomeComponent" />
</component>
<vm:outbound-endpoint path="ChatMsgs"
exchange-pattern="one-way" />
</flow>
I'd like to set a "non-blocking" retry policy on the component and i would like the flow not to start until the component manages to initialise, is that asking too much of mule? :)
Thanks in advance
Non-blocking retry policies are now part of CE (since 3.2.0).
To have your component integrated with Mule's lifecycle and retry policies, I suggest you develop it as a Mule module using DevKit (see "Mule’s Lifecycle Support" in http://blogs.mulesoft.org/introducing-the-new-devkit/). Though marketed as an "API connector toolkit", DevKit does way way more things...
Of course, this would make your component Mule specific but with the benefit of making it a first-class citizen of Mule's infrastructure.