IBM IIB/ACE (Soap Request) how to build a ESQL SOAP message with namespaces? - soap

I'm tryng to build the bellow XML message in ESQL and send it in a Soap Request Node, but the webservice is not receiving all the fields. One of them is the DocumentList structure, whose Code and Value are being sent empty. Can you help me?
<tns0:Envelope xmlns:tns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s00="http://www.outsystems.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns0:Header/>
<tns0:Body>
<s00:SentEntity>
<s00:EntityRequest>
<s00:Number>2274076</s00:Number>
<s00:EntityName>JOHN SNOW</s00:EntityName>
<s00:EntityCategory>NORMAL</s00:EntityCategory>
<s00:EntityType>PRIVATE</s00:EntityType>
<s00:ActionToDO>Verify</s00:ActionToDO>
<s00:DocumentList>
<s00:DocumentListStructure>
<s00:Code>BI</s00:Code>
<s00:Value>AOLA005510203040</s00:Value>
</s00:DocumentListStructure>
<s00:DocumentListStructure>
<s00:Code>HB</s00:Code>
<s00:Value>AOHB005510203040</s00:Value>
</s00:DocumentListStructure>
</s00:DocumentList>
<s00:DocumentList/>
</s00:EntityRequest>
</s00:SentEntity>
</tns0:Body>
</tns0:Envelope>

you can try:
DECLARE ns NAMESPACE 'http://www.outsystems.com';
DECLARE soapenv NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
SET OutputRoot.XMLNSC.soapenv:Envelope.(XMLNSC.NamespaceDecl)xmlns:soapenv = soapenv;
SET OutputRoot.XMLNSC.soapenv:Envelope.(XMLNSC.NamespaceDecl)xmlns:ns = ns;
SET OutputRoot.XMLNSC.soapenv:Envelope.soapenv:Body.ns:SentEntity.EntityRequest.Number = '2274076';
-- continue...

Related

stream two event messages in one from gRPC Server

I have a scenario where I am trying to send multiple messages in one and trying to stream the one message from the gRPC server to the gRPC client side.
My proto files on server side look like this:
Service Greeter{
rpc AccumulateEvents (EventRequest) returns (stream EventsMessage);
}
message EventsMessage{
FirstEvent firstEvents =1;
SecondEvents secondEvent = 2;
}
message EventRequest{
//sending empty request
}
The service method is as follows:
public override async Task AccumulateEvents(EventRequest eventRequest, IServerStreamWriter < EventsMessage > responseStream, ServerCallContext context) {
IDisposable disposable4 = service.SubscribeToEvents(OnEvents);
service.execute();
await responseStream.WriteAsync(new EventsMessage {
FirstEvent = firstEvent, SecondEvents = secondEvents
});
}
When I am trying to fetch and parse the stream from the client side,i am getting null for secondEvent part of the message EventsMessage. Only firstEvents was returned from the server to the client. I tried debugging and could see secondEvent getting populated but then it became null when the streaming started from the server.
Also, secondEvent is a repeated field. I am not sure if that is the reason of it becoming null.
Please let me know what i might be missing here.

ActiveMQ-Artemis 2.6 Set queue dead letter address using JMS management API

I'm trying to set the dead letter address for a queue via the JMS management API. From reading the latest Artemis docs it appears that I should be able to do this using the QueueControl.setDeadLetterAddress(...) method. See https://activemq.apache.org/artemis/docs/latest/management.html and search for "setDeadLetterAddress".
It is my understanding that the parameters of these methods should be found in the Artemis QueueControl javadocs here:
https://activemq.apache.org/artemis/docs/javadocs/javadoc-latest/org/apache/activemq/artemis/api/core/management/QueueControl.html
However, that documentation does not have any mention of a setDeadLetterAddress method or what parameters is might accept.
Does the QueueControl.setDeadLetterAddress method still exist and can it be called from the JMSManagementHelper.putOperationInvocation(...) method?
Many thanks!
Looking at the QueueControlImpl class code it is clear that the setDeadLetterAddress operation is no longer present. An operation in the ActiveMQServerControlImpl class named addAddressSettings does provide the capability to set the DLA for a queue (as well as plenty of other settings).
For example:
Queue managementQueue = ActiveMQJMSClient.createQueue("activemq.management");
Queue replyQueue = ActiveMQJMSClient.createQueue("management.reply");
JMSContext context = connectionFactory.createContext();
JMSConsumer consumer = context.createConsumer(replyQueue)) {
JMSProducer producer = context.createProducer();
producer.setJMSReplyTo(replyQueue);
// Using AddressSettings isn't required, but is provided
// for clarity.
AddressSettings settings = new AddressSettings()
.setDeadLetterAddress(new SimpleString("my.messages.dla"))
.setMaxDeliveryAttempts(5)
.setExpiryAddress(new SimpleString("ExpiryAddress"))
.setExpiryDelay(-1L) // No expiry
.setLastValueQueue(false)
.setMaxSizeBytes(-1) // No max
.setPageSizeBytes(10485760)
.setPageCacheMaxSize(5)
.setRedeliveryDelay(500)
.setRedeliveryMultiplier(1.5)
.setMaxRedeliveryDelay(2000)
.setRedistributionDelay(1000)
.setSendToDLAOnNoRoute(true)
.setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)
.setSlowConsumerThreshold(-1) // No slow consumer checking
.setSlowConsumerCheckPeriod(1000)
.setSlowConsumerPolicy(SlowConsumerPolicy.NOTIFY)
.setAutoCreateJmsQueues(true)
.setAutoDeleteJmsQueues(false)
.setAutoCreateJmsTopics(true)
.setAutoDeleteJmsTopics(false)
.setAutoCreateQueues(true)
.setAutoDeleteQueues(false)
.setAutoCreateAddresses(true)
.setAutoDeleteAddresses(false);
Message m = context.createMessage();
JMSManagementHelper.putOperationInvocation(m, ResourceNames.BROKER, "addAddressSettings",
"my.messages",
settings.getDeadLetterAddress().toString(),
settings.getExpiryAddress().toString(),
settings.getExpiryDelay(),
settings.isLastValueQueue(),
settings.getMaxDeliveryAttempts(),
settings.getMaxSizeBytes(),
settings.getPageSizeBytes(),
settings.getPageCacheMaxSize(),
settings.getRedeliveryDelay(),
settings.getRedeliveryMultiplier(),
settings.getMaxRedeliveryDelay(),
settings.getRedistributionDelay(),
settings.isSendToDLAOnNoRoute(),
settings.getAddressFullMessagePolicy().toString(),
settings.getSlowConsumerThreshold(),
settings.getSlowConsumerCheckPeriod(),
settings.getSlowConsumerPolicy().toString(),
settings.isAutoCreateJmsQueues(),
settings.isAutoDeleteJmsQueues(),
settings.isAutoCreateJmsTopics(),
settings.isAutoDeleteJmsTopics(),
settings.isAutoCreateQueues(),
settings.isAutoDeleteQueues(),
settings.isAutoCreateAddresses(),
settings.isAutoDeleteAddresses());
producer.send(managementQueue, m);
Message response = consumer.receive();
// addAddressSettings returns void but this will also return errors if the
// method or parameters are wrong.
log.info("addAddressSettings Reply: {}", JMSManagementHelper.getResult(response));

Drools - Response XML from multiple rule execution

I have the below two rules:
global Response myResponse;
rule "rule1"
when
Loan(processId == "1")
then
myResponse.setRuleId("rule1");
myResponse.setPmtStatus("valid");
end
rule "rule2"
when
Loan(amount > 1000)
then
myResponse.setRuleId("rule2");
myResponse.setPmtStatus("invalid");
end
When I access Drools through REST sending the below request XML, according to the data inserted, both rules should fire.
<batch-execution lookup="testsession">
<set-global identifier="myResponse" out-identifier="response">
<com.sample.Response></com.sample.Response>
</set-global>
<insert out-identifier = "loan">
<com.sample.Loan>
<loanId>11112222</loanId>
<processId>1</processId>
<amount>2000.00</amount>
</com.sample.Loan>
</insert>
<fire-all-rules/>
</batch-execution>
In my response XML, I would like to receive the consequence information from both rules. For example, I would like to get one response node with ruleID = rule1 and pmtStatus = valid, and another node with ruleId=rule2 and pmtStatus = invalid.
Right now, I am getting the results only from the rule executed last. Please would you advise how I should make my request in order to receive results from all fired rules in my return XML.
Thanks
If the number of rules are limited to two and won't scale in future you can have 2 global response objects created for each of the rule respectively.
Or else you can pass a List object by reference to the DRL file.
rule "rule1"
when
Loan(processId == "1")
$list: ArrayList<Response>
myResponse:Response()
then
myResponse.setRuleId("rule1");
myResponse.setPmtStatus("valid");
$list.add(myResponse);
end

Understanding Esper IO Http example

What is Trigger Event here ?
How to plug this to the EsperEngine for getting events ?
What URI should be passed ? how should engineURI look like ?
Is it the remote location of the esper engine ?
ConfigurationHTTPAdapter adapterConfig = new ConfigurationHTTPAdapter();
// add additional configuration
Request request = new Request();
request.setStream("TriggerEvent");
request.setUri("http://localhost:8077/root");
adapterConfig.getRequests().add(request);
// start adapter
EsperIOHTTPAdapter httpAdapter = new EsperIOHTTPAdapter(adapterConfig, "engineURI");
httpAdapter.start();
// destroy the adapter when done
httpAdapter.destroy();
Changed the stream from TriggerEvents to HttpEvents and I get this exception given below
ConfigurationException: Event type by name 'HttpEvents' not found
The "engineURI" is a name for the CEP engine instance and has nothing to do with the EsperIO http transport. Its a name for looking up what engines exists and finding the engine by name. So any text can be used here and the default CEP engine is named "default" when you allocate the default one.
You should define the event type of the event you expect to receive via http. A sample code is in http://svn.codehaus.org/esper/esper/trunk/esperio-socket/src/test/java/com/espertech/esperio/socket/TestSocketAdapterCSV.java
You need to declare your event type(s) in either Java, or through Esper's EPL statements.
The reason why you are getting exception is because your type is not defined.
Then you can start sending events by specifying type you are sending in HTTP request. For example, here is a bit of code in python:
import urllib
cepurl = "http://localhost:8084"
param = urllib.urlencode({'stream':'DataEvent',
'date': datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
'src':data["ipsrc"],
'dst':data["ipdst"],
'type':data["type"]})
# sending event:
f = urllib.urlopen(cepurl + "/sendevent?" + param);
rez = f.read()
in java this probably would be something like this:
SupportHTTPClient client = new SupportHTTPClient();
client.request(8084, "sendevent", "stream", "DataEvent", "date", "mydate");

How to aggregate the responses of two web services using spring integration

I am calling two webservices using spring-integration as shown below:
application-context.xml
<int:chain input-channel="requestChannelForHolidayService"
output-channel="outputChannelForHolidayService">
<int-ws:outbound-gateway
uri="http://localhost:8080/holidayService/holidayService" marshaller="marshaller"
unmarshaller="marshaller" />
</int:chain>
<int:chain input-channel="requestChannelForAccount"
output-channel="outputChannelForAccount">
<int-ws:outbound-gateway
uri="http://localhost:8080/spring-webservices-sample/endpoints"
marshaller="marshaller1" unmarshaller="marshaller1" />
</int:chain>
Testrunner.java
ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml");
MessageChannel channel=(MessageChannel) context.getBean("requestChannelForHolidayService",MessageChannel.class);
HolidayRequest request=new HolidayRequest();
BigInteger b1=new BigInteger("1");
BigInteger b2=new BigInteger("50");
request.setEmpId(b1);
request.setDays(b2);
System.out.println("sending request");
System.out.println("request sent");
channel.send(MessageBuilder.withPayload(request).build());
ApplicationContext context1 = new ClassPathXmlApplicationContext("application-context.xml");
MessageChannel channel1=(MessageChannel) context1.getBean("requestChannelForAccount",MessageChannel.class);
AccountDetailsRequest request2=new AccountDetailsRequest();
request2.setAccountNumber("12345");
System.out.println("sending request2");
System.out.println("request sent2");
channel1.send(MessageBuilder.withPayload(request2).build());
Now I need to combine the output of 'outputChannelForHolidayService' and 'outputChannelForAccount'.Can anyone help out for acheiving this. Thank you in advance.
You shouldn't use two application contexts; put them in the same context. Set the correlationId header on the messages; send both results to an aggregator with release-strategy-expression="size == 2".
Consider using a Messaging Gateway instead of sending to channels. Something like:
Collection<Object> process(#Payload Object[] requests, #Header("correlationId"), String correlation);
Then in the context, have...
gateway->splitter->payload-type-router->
request1Channel->ws->toAgg
request2Channel->ws->toAgg
toAggChannel->aggregator
If you omit the output-channel from the aggregator, the result will go back to the gateway.