IBM Integration Bus web service client request - soap-client

I have to send a scheduled request to a SOAP web service with attachment (a zip) and metadata in the request . The data and file are prepared in a .NET compute node and a SOAP request node is made by a WSDL file. Unfortunately I do not know how I could pass the metadata and file to the SOAP request node from .NET compute node. The metadata is in the tag of the envelope, the uuid of the attachment is in the tag of the body. And the file goes into the attachment part.
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:tag="http://....">
<soap:Header>
<tag:metadata>
<tag:filename>filename</tag:filename>
<tag:date>2018-06-01</tag:date>
</tag:metadata>
</soap:Header>
<soap:Body>
<tag:file>
<tag:content>cid:4444444</tag:content>
</tag:file>
</soap:Body>
</soap:Envelope>
Could someone help me, please?

SOAP nodes support MTOM attachment handling, so IIB will take care of that automatically. The requirements are outlined in the IIB knowledge center:
An MTOM output message is written if all of the following criteria are met:
The Allow MTOM property is selected on the WS Extensions tab.
Validation is enabled. The Validate property on the SOAPRequest and SOAPAsyncRequest nodes controls validation of the anticipated response message and not validation of the outgoing request. MTOM output is therefore suppressed unless you set Validate to Content and value on a preceding input node or transformation node.
No child elements exist below SOAP.Attachment in the logical tree. If child elements are present, SOAP with Attachments (SwA) is used.
Elements exist in the output message that are identified as base64Binary in the associated XML Schema and whose length does not fall below a default threshold size of 1000 bytes.
https://www.ibm.com/support/knowledgecenter/SSMKHH_10.0.0/com.ibm.etools.mft.doc/ac56630_.htm
So you just put the binary data in your content element (provided that it has the correct type in the schema) as BLOB and configure the flow as above.

Related

AWS Lambda response not in TwiML format

I've been following this tutorial in order to set up a lambda function that replies to incoming texts from a Twilio webhook. The function seems to be working fine and receiving the text data, but when it passes the TwiML back to Twilio there's some kind of formatting issue. I'm getting a 12200 - Schema validation warning in the Twilio error log but I can't for the life of me find the issue with the TwiML. The message says:
WARN "Content is not allowed in prolog." at line 1, cols 1.
I've set up the API Gateway with the proper settings as stated in the tutorial. The Integration Request mapping template is set to application/x-www-form-urlencoded and the Integration Response and Method Response templates are set to application/xml.
My lambda function is:
def lambda_handler(event, context):
return '<?xml version="1.0" encoding="UTF-8"?><Response><Message><Body>Sorry, the command is invalid.</Body></Message></Response>'
This is the response I get when I send a request from Postman. There is a quotation and a newline character before the <?xml which appears to be the problem but as you can see in the lambda_handler() above, I don't believe I'm returning any quotations or \n.
"
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Response>
<Message>
<Body>Sorry, the command is invalid.</Body>
</Message>
</Response>"
Any help with returning XML in python or setting up the Lambda API Gateway would be appreciated as it appears that's where the problem lies.
So it turns out, it was an issue with the API Gateway after all. I had it set up properly, but didn't deploy it correctly so all the changes I was making were not being implemented. Make sure your API Gateway is deployed so your mapping templates actually take effect!

How to avoid loading email's content using spring integration mail

I am using spring integration mail (5.3.1 release)
I have a flow:
IntegrationFlows
.from(Mail
.imapIdleAdapter(imapAdapter)
)
.filter()
.filter()
...
.filter()
.handle(service1)
.get();
I want an email content to be loaded in service1.
I don't want to load email's content until it passes all filters.
My filters need to know only email headers.
I tried to use DefaultMailHeaderMapper but email's content is loaded anyway. I can see it in logs using "mail.debug"=true.
I was debugging and according to source of AbstractMailReceiver#receive, MimeMessage's content will be always loaded because e.g new IntegrationMimeMessage() uses MimeMessage(MimeMessage message) constructor that loads a content.
Is there any way to configure mail adapter to not load an email's content?
Thank you!
See docs: https://docs.spring.io/spring-integration/docs/current/reference/html/mail.html#mail-inbound. Especially this part:
tarting with version 5.2, the autoCloseFolder option is provided on the mail receiver. Setting it to false doesn’t close the folder automatically after a fetch, but instead an IntegrationMessageHeaderAccessor.CLOSEABLE_RESOURCE header (see MessageHeaderAccessor API for more information) is populated into every message to producer from the channel adapter.
And then take a look into the next section: https://docs.spring.io/spring-integration/docs/current/reference/html/mail.html#mail-mapping
So, to avoid eager content loading you should abandon the header mapper and don't close the folder automatically. This way the whole MimeMessage is sent as a payload. You probably won't be able to perform your filtering logic against headers because the content of the message is not fetched therefore we don't know what headers are there in MimeMessage. However you can try to get access to them from your filters, but already against the payload - not headers.

Which AMP extensions can fetch a response from an endpoint?

What AMP extensions can be used to get a response from the server in the form of variable that can be used later, such as in a template or as a parameter to an attribute?
amp-access
The authorization endpoint of amp-access can return "a free-form JSON object":
Here’s a small list of possible ideas for properties that can be returned from the Authorization endpoint:
Metering info: maximum allowed number of views and current number of views.
Whether the Reader is logged in or a subscriber.
A more detailed type of the subscription: basic, premium
Geo: country, region, custom publication region
amp-form
amp-form "allows publishers to render the responses using Extended Templates". The response is expected to be a valid JSON Object. Try the "Hiding input fields after success" demo in the amp-form sample to see it in action.
amp-list
amp-list fetches "content dynamically from a CORS JSON endpoint and renders it using a supplied template". The response must be a JSON object that contains an array property "items".
In addition to {{variable}} substitutions in Mustache templates, you can also use AUTHDATA(variable) elsewhere.
amp-live-list (not quite)
amp-live-list is a "wrapper and minimal UI for content that updates live in the client instance as new content is available in the source document". The page will re-fetch itself, giving the server a change to send new content. If new content is found, AMP will populate a <div items> element with the new (HTML) items. You can't use that as a variable.
It's name doesn't really suggest it, but I think you want AMP-list
https://github.com/ampproject/amphtml/blob/master/extensions/amp-list/amp-list.md
Fetches content dynamically from a CORS JSON endpoint and renders it using a supplied template.

Mule - Personalize Body SMTP Component

I have a mule flow that performs the following actions:
HTTP => JSON to XML => XSLT => Logger => SMTP
I want to personalize the body to the Email with the message.payload and my personal text for example:
It has received an XML message with the following information:
#[message.payloadAs(java.lang.String)]
The message.payload is the XML transformed with the XSLT component and the email will be received as follows:
It has received an XML message with the following information:
author:Gambardella, Matthew
What I need to personalize the message with my text?
Should I use a payload component or a property?
the SMTP connector it will use the payload as the body of the mail, so just set in the payload what you want to be sent for example:
<set-payload value="It has received an XML message with the following information: #[message.payloadAs(java.lang.String)]" doc:name="Set Payload"/>
Now if you want to send this email has HTML mail so that in your payload you can add html tag and even styles you can do that by adding to the SMTP a global connector and setting on the global connector the contentType, note that setting the mimeTypedirectly on the SMTP endpoint only will not have effect:
<smtp:connector name="SMTP_exception_mailer" contentType="text/html" validateConnections="true" doc:name="SMTP"/>
<smtp:outbound-endpoint host="host" port="25" connector-ref="SMTP_exception_mailer" to="you#me.com" from="system#mule" mimeType="text/html" doc:name="SMTP"/>
BONUS TIP FOR COMPLEX HTML MAIL
If you want to send complex html mail it's clear that using the set-payload component it will be quite complicated, a good alternative is to use the parse template component, this will allow you to write your html in an external file using also MEL expressions in it.

DocuSign REST API bulk recipient transactions not showing in response

I have issues with getting the ID for the newly created envelopes when using the bulk send feature.
I'm using a template that has a bulk recipient signer (from a CSV file).
I've managed to create with success a draft envelope with a bulk recipient signer based on the template, to pass the CSV file to the envelope and to change the status to 'sent' in order to trigger the sending of an envelope for each recipient.
The issue is that the response returned from sending the envelope doesn't contains the 'bulkRecipientTransactions' element (the CSV file contains 2 signers).
Below you can see a response sample:
<envelopeUpdateSummary xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<bulkEnvelopeStatus>
<batchId>97ef8125-b305-4de7-837b-d89c36bd994e</batchId>
<batchSize>2</batchSize>
<bulkEnvelopesBatchUri>/bulk_envelopes/97ef8125-b305-4de7-837b-d89c36bd994e</bulkEnvelopesBatchUri>
<failed>0</failed>
<queued>2</queued>
<sent>0</sent>
<submittedDate>2015-07-24T07:10:18.9900000Z</submittedDate>
</bulkEnvelopeStatus>
</envelopeUpdateSummary>
The same result came back when i've used the DocuSign API explorer for creating & sending a bulk recipient envelope - no 'bulkRecipientTransactions' element.
Also I've tried to check the status of one bulk send batch (/accounts/{accountId}/bulk_envelopes/{batchId}), but I've got as a result only the general batch info's - the element 'bulkEnvelopes' was missing!
<bulkEnvelopeStatus xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<batchId>97ef8125-b305-4de7-837b-d89c36bd994e</batchId>
<batchSize>2</batchSize>
<bulkEnvelopesBatchUri>/bulk_envelopes/97ef8125-b305-4de7-837b-d89c36bd994e</bulkEnvelopesBatchUri>
<endPosition>2</endPosition>
<failed>0</failed>
<nextUri/>
<previousUri/>
<queued>0</queued>
<resultSetSize>0</resultSetSize>
<sent>2</sent>
<startPosition>0</startPosition>
<submittedDate>2015-07-24T07:10:18.9900000Z</submittedDate>
<totalSetSize>2</totalSetSize>
</bulkEnvelopeStatus>
For all the workflow I've used the REST API v2 using C# and xml.
When you use /accounts/{accountId}/bulk_envelopes/{batchId} to get envelopes, you need specify queryString ?include=(all,failed,queued,sent).otherwise, you may not get any envelopes list result

Resources