OSB Design questions - email

I have to implement a system to poll emails from a mail server.
Process the email contents(body, subject, sender, date, etc) and prepare a request to send to another service using these data.
My question is: using OSB and the email transport I can read the variables(body, subject, etc), then I have to split the subject into 3 different variables(It's coming in this format: Var1) and prepare a call to another service(this service is already deployed and its wsdl and Url are known).
How can I do all of this? How can I split the subject and prepare my request? Do I have to use a java class or OSB can do it automatically?
How can I achieve this? Are there better options?

Mail transport is a polling based approach. And you need to setup a Proxy Service to poll your mails from a mail server. In you Proxy Service, you process your subject and body. Whether you need a custom Java class depends on how much you work with XML.
The more XML your message is, the less likely you need Java. If you are familiar with XQuery/XSLT, you can also in many ways avoid using custom Java to process your messages.
Once you have your messages ready for delivery, you can route them to a business service which may or may not be WSDL based.

Related

consuming REST server methods from BizTalk Server using WCF-WebHttp adapter

I'm using VS 2019 and BTS 2020 developer edition. I need to implement a scenario in which BizTalk sits between the client and the REST server (implemented in APS.NET Core) and the client send request to BizTalk as he/she typically sends to REST server. The aim is to practice BizTalk WCF-WebHttp adapters (for both receive and send). My idea is to handle all the API requests and methods in a single receive location, send port, orchestration. How can I achieve it? The reason I'm using orchestration is to map and do other process on the messages later.
Does this idea wrong? Should we individually create send ports/receive locations for every API method?
Is there any relation between the operation name of logical port in orchestration and operation name in WCF-WebHttp adapter URL mapping (<Operation Name="SomeName" ... />)? (to one single orchestration and handle all methods)
How to design the desired orchestration? (I have tried 'Decide' shape (adding rules like msg_input(BTS.Operation) == "SomeName") to separate different requests identified by URL mapping in the receive location and I was successful in this step, but is it the correct way either? However, I don't have any idea for designing shapes the way to correctly start orchestration. Also, I don't know ho to send requests from rule branches to send port within the orchestration)
I would also appreciate to hear any other suggestions for solving this problem in a different perspective.

How to process the webservice xml message in mirth

How to process the webservice XML message in Mirth Connect 3.x?
If I understand your question correct, you are asking for how to configure Mirth to become a Web server. It's actually easy and hard at the same time.
The easy way - create a new channel and configure the Source connector as Web Service Listener. Deploy the channel and you have a web server waiting for SOAP messages to be sent to a configured IP port. But the structure of these SOAP messages is governed by Mirth WSDL at localhost:8081/services/Mirth?wsdl.
If you want the SOAP message structure to be different then you are going to deep dive into creating your own Java class and overriding default web service methods. There is no a single answer for that, it is a completely separate topic.
I hope you are asking how to consume XML webservice message in Mirth?..
If you are receiving specifically SOAP you need to set webservice listener as your source channel listener. (as said previous answer, you will have the URL)
Go to your transformer and type the following code:
logger.info(connectorMessage.getRawData());
Once you do this you can see the data you received inside Mirth on the logger area.

How can I send IQs to multiple recipients with Smack without sending them multiple times?

I'm using SmackAPI to transmit custom IQ Packets between two Java applications. The XMPP Server is a local OpenFire installation. In principle the sending and receiving of this packets works fine. But now i want to send to multiple recipients. For messages this can be done very easily by using the MultipleRecipientManager class. But I have no idea how to send custom IQs to multiple recipients without sending them multiple times. I tried to just use the MultipleRecipientManager like with normal messages, but this is not working. Adding an extension (MultipleAddresses) to the custom IQ object does not work and hardcoding the addresses in the getChildElementXML method also does not work.
I always get an error from the xmpp server. It tells, that the service is unavailable. I think the problem is, that the server does not know my custom IQ, but how can I change this?
Extended Stanza Addressing is supported by my Openfire installation. But it seems like it is only working for normal messages.
I hope someone knows how to solve that.
Best regards
Stefan
For messages this can be done very easily by using the
MultipleRecipientManager class. But I have no idea how to send custom
IQs to multiple recipients without sending them multiple times.
There is no way to transfer the approach used by MultipleRecipientManager to IQs. You have to send them multiple times.
Your question makes me wonder if you haven't a design flaw in your implementation. IQ stanzas of type 'get' or 'set' need to be acknowledged by the receiver. That is also the reason why XEP-33 was specified to only work with messages. In theory you could use the 'from' attribute to track that every receiver has ack'd an IQ with an certain ID. But I guess this isn't done because it adds to much complexity to the protocol for little gain.
Anyway, it appears that you don't care for for the IQ results, so why not use messages instead?

Delivery different kind of protocols in a SOA architecture

I have a project that is currently in production delivering some web-services using the REST approach. Right now, I need to delivery some of this web-services in SOAP too (it means that I will need to deliver some of the same web-services in SOAP and others a bit different), so, I ask you:
Should I incorporate to the existent project the SOAP stack (libraries, configuration files, ...), building another layer that deliver the data in envelopes way (some people call it "anti-corruption layer") ?
Should I build another project using just the canonical model in common (become it in a shared-library) ?
... Or how do you proceed in similar situations ?
Please, consider our ideal target a SOA architecture.
Thanks.
In our projects we have a facade layer which exposes the services and maps to business entities, and a business layer where the business logic is run.
So to add a SOAP end point for an existing service, we just create a new facade and call in to the same business logic.
In many cases it is even simpler, since we use WCF we can have a http SOAP endpoint for external clients, and a binary tcpip endpoint for internal clients. The new endpoint can be added by changing the configuration without any need to change the code.
The way I think about an SOA system, you have messages and pub/sub. The message is the interface. Getting those messages into and out of the system is an implementation detail. I create an endpoint that accepts a raw message document (more REST-like, but not really REST) as well as an endpoint that accepts the message as a single parameter to a SOAP call. The code that processes the incoming message is a separate concern from the HTTP endpoint enablement.
You can use an ESB for this. Where ESB receive the soap messages and send the rest request to the back end. WSO2 ESB provides this functionality. Please look at this sample[1].
[1] http://wso2.org/project/esb/java/4.0.0/docs/samples/proxy_samples.html#Sample152

Do I need to implement an XMPP server?

(newbie alert)
I need to program a multiparty communication service for a course project, and I am considering XMPP for it.
The service needs following messaging semantics:
1) server will provide a method of registering and unregistering an address such as somenode#myservice.com/SomeResource. (for now I will do it manually).
2) server will provide a method of forwarding incoming messages from, say, somenode#myservice.com/SomeResource to someothernode#myservice.com/someOtherResource, assuming that the latter is registered, and a method for removing this forwarding. (for now I will do it manually).
3) anonymous clients can send messages to, say, somenode#myservice.com/someresource (one way traffic only). If there is any forwarding setup, the message will be forwarded. Finally if the address is somenode#myservice.com/someresource is registered, the message will be stored for later delivery (or immediate if a retrieving client is online - see below). If no forwarding and unregistered, message will be silently dropped.
4) clients can connect and retrieve messages from a registered address. Exact method of authenticating clients (e.g., passwords?) is yet to be determined.
Eventually, I want to add support for clients to connect from a web browser so they can register/unregister and set/remove forwarding themselves.
Thus, the server will have to do some non-standard switching. Will I need to implement an XMPP server for this? I guess some (or all?) of this can also be done using a XMPP client bot
You might investigate whether Pub/Sub is a better fit for your problem than custom messaging semantics. If so, you may find an implementation of it in your existing XMPP server.
You could probably get away with using a message queue like ActiveMQ for the communication and Apache Camel for the routing/forwarding/processing.