Consuming WSE Web Service using Dynamic Port in BizTalk 2013 - biztalk

We have an application currently running in BizTalk 2006 R2 sending message to WSE2.0 web service using a dynamic send port. The properties it set for soap message port are as follow:
Message(WSE.IntegrityUser) = "some user"
Message(WSE.IntegrityPassword) = "Plain text Password"
Message(WSE.IntegrityPasswordOption) = "Plain text option"
Message(WSE.SoapAction) = "Operation Name"
Message(WSE.AuthenticationScheme) = "Integrated"
and the address for Dynamic port is set as below:
DynamicPort(Microsoft.XLANGs.BaseTypes.Address) = URL
Now I want to upgrade this solution to BizTalk 2013 and found that it no more support WSE. What are the alternatives to keep using Dynamic port?

Here is a msdn doc that you can reference to configure your dynamic port in BT with WCF adapters.There is sample code as well.
MSDN Link

Related

SparkPost SMTP relay with StartTLS suddenly gives error "Authentication failed because the remote party has closed the transport stream."

I have a (long) running webapplication written in VB on the ASP.NET 4.0 framework.
We have been using SparkPost to send e-mails for a while, but since a few days (not sure about the exact date), the e-mail functionality has stopped working and started giving the following error message
Authentication failed because the remote party has closed the transport stream.
We use MailKit version 1.22 (latest to support ASP.NET 4.0) to make the connection and send the e-mails like so:
Using objMessage As New MailMessage(from, to, title, message)
objMessage.IsBodyHtml = True
'https://github.com/jstedfast/MailKit
Using client As New MailKit.Net.Smtp.SmtpClient()
''accept all SSL certificates (in case the server supports STARTTLS)
client.ServerCertificateValidationCallback = Function(sender, certificate, chain, errors)
Return True
End Function
''Note: since we don't have an OAuth2 token, disable the XOAUTH2 authentication mechanism.
client.AuthenticationMechanisms.Remove("XOAUTH2")
client.AuthenticationMechanisms.Add("AUTH LOGIN")
client.Connect("smtp.sparkpostmail.com", 587, SecureSocketOptions.StartTls)
''Note: only needed if the SMTP server requires authentication
client.Authenticate("SMTP_Injection", "**********************")//the asterixes are the API key
client.Send(objMessage)
client.Disconnect(True)
End Using
End Using
this setup with StartTLS is what SparkPost documentation wants me to use.
I read that SparkPost has recently stopped supporting TSL 1.0. Could this be the culprit?
The .NET Framework 4.0 use SSL3.0 or TLS1.0 as default protocol. The easiest way to fix the problem is to upgrade your existing application to .NET Framework 4.6.2. After the upgrade your app will use the TLS1.2 protocol as default. You can read more about it here

BizTalk 2016: How to use HTTP Send adapter with API token

I need to make calls to a rest API service via BizTalk Send adapter. The API simply uses a token in the header for authentication/authorization. I have tested this in a C# console app using httpclient and it works fine:
string apiUrl = "https://api.site.com/endpoint/<method>?";
string dateFormat = "dateFormat = 2017-05-01T00:00:00";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Add("token", "<token>");
client.DefaultRequestHeaders.Add("Accept", "application/json");
string finalurl = apiUrl + dateFormat;
HttpResponseMessage resp = await client.GetAsync(finalurl);
if (resp.IsSuccessStatusCode)
{
string result = await resp.Content.ReadAsStringAsync();
var rootresult = JsonConvert.DeserializeObject<jobList>(result);
return rootresult;
}
else
{
return null;
}
}
however I want to use BizTalk to make the call and handle the response.
I have tried using the wcf-http adapter, selecting 'Transport' for security (it is an https site so security is required(?)) with no credential type specified and placed the header with the token in the 'messages' tab of the adapter configuration. This fails though with the exception: System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
I have tried googling for this specific scenario and cannot find a solution. I did find this article with suggestions for OAUth handling but I'm surprised that even with BizTalk 2016 I still have to create a custom assembly for something so simple.
Does anyone know how this might be done in the wcf-http send adapter?
Yes, you have to write a custom Endpoint Behaviour and add it to the send port. In fact with the WCF-WebHttp adapter even Basic Auth doesn't work so I'm currently writing an Endpoint Behaviour to address this.
One of the issues with OAuth, is that there isn't one standard that everyone follows, so far I've had to write 2 different OAuth behaviours as they have implemented things differently. One using a secret and time stamp hashed to has to get a token, and the other using Basic Auth to get a token. Also one of them you could get multiple tokens using the same creds, whereas the other would expire the old token straight away.
Another thing I've had to write a custom behaviour for is which version of TLS the end points expects as by default BizTalk 2013 R2 tries TLS 1.0, and then will fail if the web site does not allow it.
You can feedback to Microsoft that you wish to have this feature by voting on Add support for OAuth 2.0 / OpenID Connect authentication
Maybe someone will open source their solution. See Announcement: BizTalk Server embrace open source!
Figured it out. I should have used the 'Certificate' for client credential type.
I just had to:
Add token in the Outbound HTTP Headers box in the Messages tab and select 'Transport' security and 'Certificate' for Transport client credential type.
Downloaded the certificate from the API's website via the browser (manually) and installed it on the local servers certificate store.
I then selected that certificate and thumbprint in the corresponding fields in the adapter via the 'browse' buttons (had to scroll through the available certificates and select the API/website certificate I was trying to connect to).
I discovered this on accident when I had Fiddler running and set the adapter proxy setting to the local Fiddler address (http://localhost:8888). I realized that since Fiddler negotiates the TLS connection/certificate (I enabled tls1.2 in fiddler) to the remote server, messages were able to get through but not directly between the adapter and the remote API server (when Fiddler WASN'T running).

ASP - CDO Email Configuration Issue

I have a legacy ASP application that I moved from a old server to Windows 2012 server with IIS 8.5.
I see the email sending is failing with the below error in IIS logs.
80040220|The__SendUsing__configuration_value_is_invalid
Current code is
Dim MyCDONTSMail2
Dim HTML
Set MyCDONTSMail2 = CreateObject("CDO.Message")
HTML = "all html format of mail content"
MyCDONTSMail2.From= "some from address"
MyCDONTSMail2.To="some to address"
MyCDONTSMail2.Subject="My Subject"
MyCDONTSMail2.HTMLBody=HTML
MyCDONTSMail2.Send
set MyCDONTSMail2=nothing
I have read a few other articles over Internet and this as well. I add a little bit of configuration in the code as shown in all other articles
MyCDONTSMail2.HTMLBody=HTML
MyCDONTSMail2.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
MyCDONTSMail2.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")="SMTP Server Name"
MyCDONTSMail2.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
MyCDONTSMail2.Configuration.Fields.Update
MyCDONTSMail2.Send
set MyCDONTSMail2=nothing
But I still get the same error. My SMTP Server Name is absolutely correct as I used the same server in my other .Net applications hosted on the same server to this ASP application. The .Net app works well with the same configuration.
I'm not sure if ASP pages need any other configuration / installation required.
I have also tried to configure my SMTP server inside the IIS Website --> SMTL E-mail and changing the smtp server in the ASP code to localhost. But, it also resulted in the same error.
EDIT: Application Pool is set to Classic Pipeline Mode and Identity as NetworkService
Your provided sample code is not SMTP Authenticated...please try to use SMTP Authenticated script..
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "mail#yourdomain.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "email account password"
After that, have a check with email delivery.

BizTalk Setting up a recive location and port using the HL7 Adaptor

Just installed BizTalk 2010 and the HL7 adaptor, trying to set up a proof of concept application through the admin console:
1)Created a new 'Demo Application'
2)Created a request/response receive port
3)Created a request/response receive location associated to the receive port
3.a) Set the Type to MLLP
3.b) The only options I see for the Recieve pipeline are:
PassThrueReceive
XMLRecieve
3.b) The only options I see for the send pipeline are:
PassThruTransmit
XmlTransmit
How do I get the BTAHL7X and BTAHL7XML receive/send pipeline components to appear as an option?
I've tried adding a reference to BTAHL2XMLPipeline.dll and BTAHL72XPipeline.dll but I get an error:
Failed to add resources to application.
For help, click:
http://go.microsoft.com/fwlink/?LinkId=47400&ProdName=Microsoft+BizTalk+Server+2010&ProdVer=3.9.469.0&EvtSrc=Microsoft.BizTalk.Administration.SnapIn.Properties.Errors&EvtID=AddFilesForm_AddFailed&EvtChain=Microsoft.BizTalk.ApplicationDeployment+%2cApplyMultipleResourcesAddError%3bMicrosoft.BizTalk.ApplicationDeployment+%2cSatEntryExists
------------------------------ ADDITIONAL INFORMATION:
Failed to add resource(s). (mscorlib)
For help, click:
http://go.microsoft.com/fwlink/?LinkId=47400&ProdName=Microsoft+BizTalk+Server+2010&ProdVer=3.9.469.0&EvtSrc=Microsoft.BizTalk.ApplicationDeployment&EvtID=ApplyMultipleResourcesAddError&EvtChain=Microsoft.BizTalk.ApplicationDeployment+%2cSatEntryExists
Resource (-Type="System.BizTalk:BizTalkAssembly"
-Luid="BTAHL72XPipelines, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") already in store. 1) Use BTSTask's
overwrite flag or 2) Set redeploy flag to true in BizTalk Project or
3) Click overwrite all checkbox in Admin MMC to update if the
resource exists in the specified target application
"DemoApplication1". Overwrite flag will be ignored if the resource is
associated with another application.
(Microsoft.BizTalk.ApplicationDeployment.Engine)
For help, click:
http://go.microsoft.com/fwlink/?LinkId=47400&ProdName=Microsoft+BizTalk+Server+2010&ProdVer=3.9.469.0&EvtSrc=Microsoft.BizTalk.ApplicationDeployment&EvtID=SatEntryExists
In your new application, do you have a reference to the default application?
From the BizTalk Administration Console, Right-Click on the application and choose Properties.... In the Properties screen, choose References. You will want to add a reference to the default application here.
If you do have a reference to the default application, has the adapter been registered?
From the BizTalk Administration Console, expand Platform Settings and then right-click on Adapters. Select the New > Adapter... option and then look for MLLP in the dropdown. Select MLLP and give it a name of MLLP and then select OK. At this point, you should have the MLLP adapter available for use.

ASP.NET website problem while requesting XML data from remote server

I am writing code in asp.net to get XML data from external webserver.
*.cs Code
connection string: URL of external(third party) server for XML data
WebRequest req = WebRequest.Create(connectionString);
req.Proxy = WebProxy.GetDefaultProxy();
req.Proxy.Credentials = CredentialCache.DefaultCredentials;
req.Timeout = 1000;
using (WebResponse resp = req.GetResponse())
{
// reading data from XML file
}
Key Point
1. GetDefaultProxy() return information about proxy
2. Default Credentials() return username password which i have written in web.config as shown below
Web.config
<identity impersonate="true"
username="Username of PC where website is running"
password="password"/>
Problem Statement:
After installing website setup : Above code working fine at WindowsXP but the same code doesn't work at Windows server 2003. I am not able to find out what extra we need to configure in Windows Server 2003.
Please help me to find out the solution?
[EDIT]
Very random beheviour is observed at server. Sometimes the data comes and appear at client(browser) when we logged into windows server 2003.
But when we loggedout from server and try to request for data from client(browser) at another PC. It appear for very short duration. After say wait of 1 hour the data doesn't comes for new request.
An error message might be useful??
But at a guess I'd say it's that the proxy isn't configured on the 2003 server.
Check the firewall on Windows Server 2003 and make sure port 80 outbound is allowed (assuming that is the port used by the web service).
This might help. It's about proxy and .NET app.

Resources