Testing BizTalk by picking up XML from file locations - biztalk

I have a simple orchestration which subscribes to a message, changes a status field in the message header then send back to the message box.
To test this I have hooked it up to a file location to accept an incoming XML message (as the system which will produce the message is not yet complete) and would then want the new message with the changed header sent to a new file location.
I can see the XML file disappearing as it is picked up, but I'm not clear on how to then output that to a new XML file. There are no maps involved so I'm unsure how to configure a send port to pick up from the message box.

You need to add a filter on send port based on some promoted properties of the message.
some example or filters: BTS.MessageType = "MessageType"
Once you add a filter in send port It will subscribe from the message box.

Related

Biztalk multipart message with null member

I created one POP3 receive location which sends the email to one orchestration. The message I use for this is a multipart message, one part is for the Attachment and the second part is for the body.
When I send an email with attachment everything goes fine. But when I send an email without attachment, even before I process the message, I get an exception:
Exception thrown from: segment 3, progress 3
Inner exception: The XLANG/s message has no part at index '1'. The total number of parts found in the message is '1'. If you expect a multipart message, check that the pipeline supports multipart messages such as MIME.
the message in the suspended message, contains of course one part (only the body) as there is no attachment.
Is there any way to handle it or filter the receive component in the orchestration?
Which is the configuration of your Receive Location? Seems that you have setted the Body Part Index property to 1 and according to the documentation:
Otherwise if the Body Part Index is set to a value greater than 0 and
the Body Part Content Type is blank, then the body part with the
specified index is selected as the BizTalk message body part. If the
specified index is greater than the number of body parts then the
message is suspended.
Read this document Processing Multi Part Messages with the POP3 Adapter, this can help you.

How to change HTTP URL in FHIR Listener while using mirth connect?

I am trying to use the FHIR Listener extension in mirth connect. I want to use a sample FHIR server to test the process but i am not able to change the HTTP URL in FHIR Listener Settings. Is there any way I can change that?
We cannot change the URL of either HTTP url or FHIR listener url. It will always remain localhost. If you are trying read a sample data from the any test server try as below:
Go to the HTTP sender
select GET and paste the URL there test the connection.
deploy the channel and send some RAW data if your URL is correct you will get the response in Mirth.
In destination under navigate to "EDIT RESPONSE" portion and type the following to consume the response and print it (or) manipulate the response.
var ResponseMessage = response.getMessage();
logger.info(ResponseMessage)

BizTalk sending custom WCF headers with message level security

I'm attempting to have BizTalk broker the communication to a WCF service that maps some of its data within the response message's header and not the body portion. After researching, the solution was to write the header data to the OutboundCustomHeaders message context property and then the BizTalk WCF adapter will inject it into the outgoing message. This worked perfectly until I enabled message level security using a certificate. In this case, the header still gets included within the response message but AFTER the message is encrypted. This causes the receiving client to throw a MessageSecurityException with the message 'required message part was not encrypted."
Is there a way to configure BizTalk to write the OutboundCustomHeaders before encryption occurs or another way to inject my header in the response?
I'm not sure how much it helps or complicates the answer, but the receive location in BizTalk is using the ws2007HttpRelayBinding to create an Azure endpoint for the client connections.
The solution for this problem was found by creating a custom behavior that adds the required header to the channel protection requirements and attaching it to the ws2007HttpRelayBinding.
I used the following link as a reference to my solution: WCF custom messages security

Should I be using a PUT or POST in this situation?

A server side service is populating the database. I send a http request from my application with some metadata information from the document and I want the server side service to generate a unique uuid for this document and populate the db with the doc uuid and metadata and send back the uuid to me. Should the client be executing a PUT request in this case or a POST. I only want one record of the document metadata and uuid generated for it.
PUT is generally used to overwrite and replace or create a resource.
I think that is what you should be using here. For example:
PUT /document/ HTTP/1.1
Host: example.com
And have it return a UUID and metadata for the document.
And quoting from another SO question:
I think one cannot stress enough the fact that PUT is idempotent: if
the network is botched and the client is not sure whether his request
made it through, it can just send it a second (or 100th) time, and it
is guaranteed by the HTTP spec that this has exactly the same effect
as sending once.

nginx resumable upload with upload_module and multipart/form

I currently upload to a webservice on an nginx server using the upload module (http://www.grid.net.ru/nginx/upload.en.html) from a custom desktop application doing a simple multipart-form POST that sends a file in one part and a base64 encoded XML with the file's metadata in another part.
The server receives this POST, passes it to my webservice which reads the metadata, processes the file and all is good.
What I want to do now is use the upload module's upload_resumable directive to do the POST in several chunks to minimize disconnection chances and allow resume. I can currently do this following the protocol described here: http://www.grid.net.ru/nginx/resumable_uploads.en.html
One sends byte ranges of the file along with some headers to identify the chunk and the session in several posts and once all the parts have been uploaded, nginx will compose the final POST containing the file name and path and pass it to your upload_pass location (which in my case CGIs to a django app).
However, I am not clear on how one would send a multipart post with this method since the protocol indicates that the body of the POST must be the bytes indicated in the byte range. I need the final post to also contain the XML I wrote about above.
I can think of sending the XML as the first bytes of the body and a header that indicates how many bytes belong to it but that would mean extra handling of the final file to remove that header and the final files are potentially in the GB size range.
Any other ideas?
Since the protocol supported by nginx specifically states that the post should not be multipart I ended up sending the file in the body, and the rest of the parameters encoded in the URL. Not the prettiest URLs but it works.

Resources