Input:-
<balanceInquiry>
<request>
<amount>
<amount>5.0</amount>
<currency/>
</amount>
</request>
</balanceInquiry>
<balanceInquiry>
<request>
<amount>
<amount>10.0</amount>
<currency/>
</amount>
</request>
</balanceInquiry>
<balanceInquiry>
<request>
<amount>
<amount>57.0</amount>
<currency/>
</amount>
</request>
</balanceInquiry>
I am trying to hit a SOAP webservice using the above input, but the webservice can only accept one balanceInquiry request at once. So I am spliting the request into different balanceInquiry using splitter. but if the status of 1st request is success then I have to go for 2nd and so on. If anyone of them fails then I need to rollback all the previous transaction. there is a attribute which can be "success" or "fail" depending on the request.
So I want to know if there is any component to achieve this in mule? Please suggest.
I believe you should take a look at the foreach documentation. https://docs.mulesoft.com/mule-user-guide/v/3.7/foreach and the exception handling strategy ; https://docs.mulesoft.com/mule-user-guide/v/3.7/error-handling.
If your 3 inquiries are in the same message and that you are using the default exception strategy, it will rollback the previous transactions... assuming you are writing the SOAP responses in a database using a DB connector.
Since I don't know exactly what you wish to do in your transaction, here's another interesting link : https://docs.mulesoft.com/mule-user-guide/v/3.7/rollback-exception-strategy
Related
Using node-soap, when making a SOAP call, the XML elements are ordered by the order I write them in the request object (which is not reliable in JavaScript - nor is it maintainable at scale over time).
I've read that in some cases the order of the elements matter and it may require to organize the XML elements in the same order that appear in the WSDL - This appear to be the my case.
Consider this example:
<Request>
<Element2>
<SubElement1>
<SubElement2>
</Element2>
<Element1>
<SubElement3>
<SubElement4>
</Element1>
</Request>
For this WSDL:
<Request>
<Element1>
<SubElement3>
<SubElement4>
</Element1>
<Element2>
<SubElement1>
<SubElement2>
</Element2>
</Request>
For this request I would get an error that <Element1> is missing.
I could not find an option in node-soap to force the elements order by the WSDL.
Am I missing it or is there another way around.
In my SOA, there are two apps trading document information back and forth. One of them is IBM's filenet/content navigator. Now the other app cannot call upon documents in filenet when these document are checked out in filenet. This usually is solvable by manually logging into Filenet and right clicking the document and selecting to undo the checkout.
Since the holdup really screws with my SOA integration I want to be able to perform this "undo checkout" action in filenet through a webservice call in my SOA. This would save a lot of time spent on manual actions unlocking the documents. I am using Oracle's SOA suite 11g (and 12c), and my process is heavily carried by BPELs. I already have a nice webservice interacting with Filenet. However, I will need to create a new operation "UnlockDocument" to interact and perform this action in filenet.
What I need: I need to have the code that would cover the "UnlockDocument" operation in a filenet environment, or some similar trick that would get the job done. Any information (also non-code!) on how I could proceed is very welcome, and I´ll keep updating my post if I find more info myself!
Thank you for your help!
Jesper
It turns out there is no possible "UnlockDocument" or "CancelCheckout" operation in filenet's webservice. However, I have found a neat workaround that let's you do just that.
When a document is checked out in filenet through the client or through a webservicecall of the operation:
"CheckoutAction".
A copy of the document is made internally in filenet with the same VersionSeriesId as the original document, but with the property Isreserved = 'true'. If you perform a "DeleteAction" on this copy, you essentially recreate the manual "Cancel Checkout" step available in the filenet client. "DeleteAction" requires an ObjectIdand doesn't work on the VersionSeriesId. In order to get this ObjectID through a webservice call, you need to make a SOAPCall that obtains this ObjectID. To cancel the initial checkout, a second SOAPCall should be made that deletes the document with the in the previous step obtained ObjectID, aka: "the copy". Herefollows two examples of usable SOAPCalls:
ExecuteSearchRequest SoapCall:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sch="http://www.filenet.com/ns/fnce/2006/11/ws/schema">
<soap:Header>
<sch:Localization>
<sch:Locale>en_EN</sch:Locale>
<sch:Timezone/>
</sch:Localization>
</soap:Header>
<soap:Body>
<sch:ExecuteSearchRequest xsi:type="RepositorySearch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sch:SearchScope xsi:type="ObjectStoreScope" objectStore="ObjectStoreXXX"/>
<sch:SearchSQL>SELECT [Id] FROM Document WHERE VersionSeries = {"enter the VersionSeriesID of the initial document without quotes"} AND IsReserved = true</sch:SearchSQL>
</sch:ExecuteSearchRequest>
</soap:Body>
</soap:Envelope>
DeleteActionRequest SoapCall:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:sch="http://www.filenet.com/ns/fnce/2006/11/ws/schema">
<soap:Header>
<sch:Localization>
<sch:Locale>en-EN</sch:Locale>
<sch:Timezone/>
</sch:Localization>
</soap:Header>
<soap:Body>
<sch:ExecuteChangesRequest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sch:ChangeRequest>
<sch:TargetSpecification classId="Document" objectId="{"enter the objectId of the previously obtained document without quotes"}" objectStore="ObjectStoreO7"/>
<sch:Action xsi:type="sch:DeleteAction"/>
</sch:ChangeRequest>
</sch:ExecuteChangesRequest>
</soap:Body>
</soap:Envelope>
Now in order to get this to work from a SOA, you'll need to invoke filenet's webservice twice from your BPEL. First with the first operation: ExecuteSearchRequest, which yields you the ObjectId required to cancel the checkout, afterwards with the second operation ExecuteChangesRequest, which deletes the correct document, undoing the initial checkout. These operations are listed in the above SOAP examples. Additionally you need to add WS-security in your outgoing header with working credentials to access the Filenet service. Otherwise you won't be able to connect with filenet.
This has cost me a lot of time so I hope this helps someone besides me. Enjoy your mastery of filenet checkout deletion!
I am trying to send and receive message to and from JMS topics.
<testcase name="DeliveryToPT3PLIT">
...
<actions>
...
<send endpoint="fromEndpoint">
<message>
<resource file="com/roche/icc/citrus/messages/input/PT-3PLWoBatchSplit.xml"/>
</message>
<header>
...
</header>
</send>
<receive endpoint="toEndpoint">
<description>Receive asynchronous message from topic</description>
<message>
<resource file="com/roche/icc/citrus/messages/output/PT-3PLWoBatchSplit.xml"/>
</message>
<header>
...
</header>
</receive>
</actions>
</testcase>
It seems that these operations go one after another. The problem is that my application works really fast and when I send a message to first topic it appears on "toEndpoint" almost immediately. So the receive operation does not manage to catch appropriate message since it has been already processed.
Is there any way to make this operations simultaneously?
Regards
There is one thing to note about using JMS topics, because they work in a publish/subscribe manner, you have to subscribe first in order to receive the message.
That means you need to subscribe to the topic before a message is going to be published. Also, if you say that your application is fast, you may need to wait a few millis before sending the message. Here is a Java DSL example of what I think may work for you. (Note: I have tested this example with a JMS topic)
parallel().actions(
sequential().actions( // Thread #1
...
receive(action -> action.endpoint(toEndpoint).payload("message to be received"))),
sequential().actions( // Thread #2
sleep(500),
send(action -> action.endpoint(fromEndpoint).payload("message to be sent"))));
Notice the parallel() action container. It will execute every action inside it in a separate thread. Each sequential() represents a series of actions that allows you to group them together. Because both sequential() containers are inside the parallel(), the actions inside each of them will be executed on different threads.
So what happens here: you split your actions on two threads. On the first thread you wait for a message. On the second thread, you make it sleep for 500 millis first, after which you send the message.
I'm sorry that I don't have an XML example, but I hope this helps anyway.
Also don't forget to set the pub-sub-domain property to true on your endpoints. See the Citrus documentation on JMS topics: here.
I need to post a Rest call to SFDC with the respective credentials and create the SalesLead in SFDC. The response should come inthe form of Acknowledgment JSON response.
I am not sure how to use http:rest-service-component to post the data for creating lead.
Any help or sample is appreciated...
It is resolved now by using the "https:outbound-endpoint". All this code need is a JSON object as input.
Below is the snippnet:
<https:outbound-endpoint
method="POST" exchange-pattern="request-response"
address="url"
contentType="application/json" doc:name="HTTP" >
<message-properties-transformer scope="outbound">
<add-message-property key="Authorization" value="OAuth ****"/>
</message-properties-transformer>
</https:outbound-endpoint>
<echo-component doc:name="Echo"/>
I'm face with a situation where we cannot use schema to validate incoming request (basically schema is there but it accepts any String in request, wsdl designers have their own reasons to do that to accept request from different sources and flexibility). But when the request is received, I validate that the child element of request wrapper is what we expect (using XPath for that). Now if the child element is not what expected, I'd like to throw Soap Fault with Client code and may be include error message that schema validation failed, request doesn't contain valid element.
I'm using Mule 3.3 and doing my XPath validation in <choice> element and I want to throw exception in <otherwise> block.
Is there a way to throw Soap Fault manually in mule flow and
How to add custom fault string. I'm not sure if an outInterceptor will solve the purpose as I'm not using schemaValidation attribute of <cxf:proxyService>.
Here is part of my flow
<http:inbound-endpoint address="${service.address}" exchange-pattern="request-response">
<cxf:proxy-service wsdlLocation="classpath:service.wsdl" namespace="http://company.com/services/service" service="CompanyService" />
</http:inbound-endpoint>
<choice>
<when>.....</when>
<otherwise><!-- Here I want to throw Soap Fault ---></otherwise>
</choice>
<catch-exception-strategy>
<flow-ref name="generateErrorResponse" />
</catch-exception-strategy>
Since you are using a cxf:proxy-service you have complete control on the response. For example, if you add the following in your otherwise block, you'll be able to create whatever SOAP fault you want:
<expression-component><![CDATA[
message.payload = '<soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'
+ '<faultcode>A code</faultcode><faultstring>A string</faultstring>'
+ '</soap:Fault>';
]]></expression-component>