endpoint.tv – Meet SO-Aware (Part 1)

SO-Aware is an exciting new tool you can use with your WCF Services. This is not just another UDDI registry. Rather, this is a tool that works for SOAP, REST, and OData services and…you just have to see it in action.

    Tellago Studios SO-Aware
    endpoint.tv – Meet SO-Aware (Part 2 – coming soon)

Ron Jacobs
blog        http://blogs.msdn.com/rjacobs
twitter    @ronljacobs

BizTalk, SalesForce and MSMQ – Part II

BizTalk, SalesForce and MSMQ – Part II

In this post I would like to continue, where I left of in Part I where a did a run down in setting up an account at SalesForce, building a service and how to consume its WSDL. Also explained some security details necessary for communication with your SalesForce service. In an orchestration you can consume a web service build in SalesForce, through running BizTalk WCF Service Consuming Wizard. If you run the wizard and pick WDSL generated for your service BizTalk will generate schema and binding file for you. Schema en binding file shown below.

image

image

Binding file will be helpful in creating WCF-Custom send port. I have built an orchestration that consumes my created SalesForce web service. The orchestration is initiated (activated) by picking up a file form a folder location. Xml file contains account name I want to retrieve details from SalesForce. Information in the file will be used to call the service and response message is sent to MSMQ.

image

In MessageAssign shape code from ForceToken is called to obtain sessionId:

image

I have created a Windows Application to read message from the queue. Request message looks like this:

image

Response from web service using the request above will result in message containing it to queue.

image

I have created a windows application (test application) to read the message from the queue.

image

I can directly call my SalesForce service through .net (GetDetails), read from queue and write to queue. In .Net you are able to create proxy code from WSDL, through same steps as explained in part I (through adding a web reference).

Above you will find code used to test service.

One side note I would like to mention now is that if logins to SalesForce fail a couple of times you will be temporarily locked out of salesforce.com due to failed login attempts. So if forgot your password, that you have to ask for new one (I do not know how long your are locked out). Then take into account that your security token is tied to your password and subject to any password policies your administrators have configured. Whenever your password is reset, your security token is also reset. In first part you will see how. During writing of this post I was locked out.

If I try to get details from an account I click GetDetails, which in this case only returns website from the account.

image

If I click ReadFromQueue I will get complete response from the web service.

image

Code for ReadFromQueue:

I have created another web service on SalesForce in which I can update annual revenue for account.

image

I followed basically same procedure as for first web service created in SalesForce. I generated the WSDL, saved it to file and through BizTalk WCF Service Consuming Wizard I got schema and binding file. I created a new orchestration that reads files from MSMQ with new annual revenue information to be updated.

image

In my test application I can change to annual revenue from 1000 to 2000 and then click SendToQueue.

I change value inside my test app textbox including messagetype that has to be returned.

image

If I look at my account details now I see they changed.

image

With binding files generated by BizTalk you can import these inside your application through BizTalk Administrator console so that WCF-Custom send ports are generated for you.

image

If you right click on one of these generated port and click properties and then configure you will see details.

image

Action is filled in and URI and if you go to the net tab the binding then you also noticed that is filled in.

image

As you can see integration with SalesForce through web services is pretty straight forward. In coming posts I would like to share different implementations using same sample and dive into logging and support.

Cheers!

Technorati: BizTalkBizTalk Server 2009salesforce

Hosting WCF HTTP receive location inside BizTalk, without using IIS.

Recently I was in Redmond for the BizTalk VTS Summit, with a bunch of colleague BizTalk experts from all over the world.  During one of the discussions we had, a question came up about the fact that it seemed that to host HTTP endpoints, it is required to have IIS as the real host configured.

After my suggestion that is was perfectly possible to bypass IIS in this process, it looked that quite a number of attendees didn’t know about this.  And that’s the reason why I decided to add it to our blog

WCF-Custom vs WCF-CustomIsolated

First of all, I think it is a best practice to avoid using the non-WCF-custom adapters (like WCF-WSHttp, etc).  I always suggest colleagues and customers to use the WCF-Custom or WCF-CustomIsolated adapter, since they are the only adapters that provide the maximum capabilities of WCF in BizTalk.  The other WCF-* adapters only provide a subset of the various binding and behavior settings, specific for their binding, which results in an adapter change, when a more advanced setting is needed one day.

The WCF-Custom adapter, is the adapter that is used to host WCF endpoints inside BizTalk.  The WCF-Isolated adapter is hosted in a BizTalk Isolated Host, which is typically IIS.

The BizTalk WCF Service Publishing wizard

To expose an orchestration or a schema as a WCF service in BizTalk, the BizTalk WCF Service Publishing wizard is the typical way to use.  In this wizard, the orchestration or schema needs to be selected and a choice between three adapters is possible: WCF-BasicHttp, WCF-WSHttp, WCF-CustomIsolated. 

The last step of the wizard is used to create a web directory in IIS, where the BizTalk svc file will be created that hosts the custom WCF Service Host that will link through to the BizTalk Receive location. 

Unfortunately, the WCF Publishing wizard does not allow to select the ’In-Process’ adapters.  All of the three adapters/bindings are only available through an isolated host and required IIS.

Hosting the endpoint in the BizTalk process

To host the endpoint inside the BizTalk process, we need to manually create the WCF receive location.  To do so, we just need to select the WCF-Custom adapter and use the desired binding: BasicHttpBinding or WsHttpBinding. 

The following steps need to be used for this:

  1. Create a new receive location with the desired name
  2. Select the WCF-Custom adapter and open the properties for this adapter
  3. Specify an address for the endpoint (picture 1) Take into account that when IIS is already running on the machine, you might need to specify a different available port.
  4. Select your binding (or use the customBinding for full flexibility) in the Binding tab page. (picture 2) and set all desired binding properties to their correct setting.
  5. In the Messages tab page, you can also specify that failed request messages need to be suspended and that exceptions should be returned to the consumer. (picture 3)

Metadata publication

One downside of this way of work is the metadata publishing.  If you would query the exposed endpoint for the WSDL, you would get to see the WSDL of the generic BizTalk WCF Service Host with the 5 operations.

Therefore, it is needed to publish the metadata endpoint to IIS and provide that endpoint to the consumers of your in-process service.  But this way of work, is similar to the other protocols (like netMsmq, netTcp)

Advantages

  • Consistent approach for all binding types, independent of protocol.
  • No extra configuration / deployment needed (specific IIS security on IIS application pools, etc)
  • Performance (no extra hop)

Sam Vanhoutte, CODit

Want a Preview of BizTalk 2010?

Get sneak peak of QuickLearn’s BizTalk Online Anytime Training and learn about new features in BizTalk 2010 including:

  • Enhancements to the BizTalk Mapper
  • Adapter and Integration Changes
  • Improved Trading Partner Management
  • BizTalk Server Settings Dashboard
  • New OpsMgr Management Pack
  • Updated Platform Support

See all of QuickLearn’s BizTalk Training Courses


BizTalk Sftp Adapter – New release 1.3.6 available on CodePlex

I got great feedback from many users, and have made some updates to the bLogical adapter:.

Disabling the connection pool (only used for send ports)

Some SSH servers can not handle the connection pool very well. This can also be a problem if there is a limit set to number of connections a certain user can have. So I’ve been asked for the possibility to disable the connection pool for send ports, and this can now be done by setting the SSH Connection Limit to "0" in the admin console or BTSNTSvc.exe.config.

Logging and tracing

A much more verbose tracing as been added. If you care to save the trace info to file, you can use the TraceListener (System.Diagnostics):

  1. Enable Tracing in the port configuration.
  2. Open the BTSNTSvc.exe.config (or BTSNTSvc64.exe.config) file and add the following in the Config section:
    <system.diagnostics>
    <trace autoflush="false" indentsize="4">
    <listeners>
    <add name="BTSListener"
    type="System.Diagnostics.TextWriterTraceListener"
    initializeData="bLogical.Shared.Adapters.Sftp.log" />
    <remove name="Default" />
    </listeners>
    </trace>
    </system.diagnostics>

Public key authentication

There was a problem using identity file authentication as the password was sent as an empty string. This works for some but not all servers. The new version always set the password to null, which should work for all servers.

Macros

%UniversalDateTime% added to the list of supported macros

Misc

  • temp folder and remote permissions no longer required properties.
  • Empty files are no longer picked up or processed.

 

Special thanks to John Vestal at CSC and Antti.

Download the adapter from CodePlex

One Good Reason to Upgrade to .NET 4.0

[Source: http://geekswithblogs.net/EltonStoneman]

Using Parallel Extensions you can reduce loop execution time by 95%. Which, if you’re evaluating .NET 4.0 and VS 2010, should be a cinching argument*.

The Parallel Extensions library includes an abundance of features for fine-grained control over concurrent operations, and it also provides the very simple Parallel.ForEach construct, which takes an IEnumerable<> collection and an Action to run over each item, so:

Normal
0

false
false
false

EN-US
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
mso-pagination:widow-orphan;
font-size:11.0pt;
mso-bidi-font-size:10.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:”Times New Roman”;
mso-bidi-theme-font:minor-bidi;}

foreach (var item in GetItems(collectionSize))

{

ServiceCall(item);

}

– becomes:

Normal
0

false
false
false

EN-US
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
mso-pagination:widow-orphan;
font-size:11.0pt;
mso-bidi-font-size:10.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:”Times New Roman”;
mso-bidi-theme-font:minor-bidi;}

Parallel.ForEach(GetItems(collectionSize), x => ServiceCall(x));

The ForEach method partitions the collection and intelligently distributes work amongst the available processors and cores. The workload on the cores is actively monitored while work is being apportioned, so the distribution should be evenly spread whether the actions themselves are an even load or not.

In a simple test rig (available on github here: TPL Sample), I call a stub WCF service in a repeated loop – one version uses a sequential foreach, the other uses Parallel.ForEach. On a dual-core machine, the parallel version completes on average in less than 20% of the time of the sequential version:

But it gets better. Parallel.ForEach is thread-intensive and intended for heavy computional work; for blocking I/O operations like service calls, use of the Task class is preferred. This lets you fire off asynchoronous tasks and wait for the responses without blocking threads:

Normal
0

false
false
false

EN-US
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Table Normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
mso-pagination:widow-orphan;
font-size:11.0pt;
mso-bidi-font-size:10.0pt;
font-family:”Calibri”,”sans-serif”;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:”Times New Roman”;
mso-bidi-theme-font:minor-bidi;}

var collection = GetItems(collectionSize).ToArray();

var tasks = new Task[collectionSize];

for (int i=0; i<collectionSize; i++)

{

var item = collection[i];

tasks[i] = Task.Factory.StartNew(() => ServiceCall(item));

}

Task.WaitAll(tasks);

So with this approach you can farm out background tasks in a Web service without the risk of starving the ThreadPool so ASP.NET stops processing new requests.

Note that you must use an array of tasks, and you must pull the target item out of the collection before you add it as an action parameter to the task array – don’t try and use List<Task> or () => ServiceCall(collection[i]), you’ll either get an index out of range error, or the tasks will all fire against the first item.

For small collections (calling the service 200 times), the Task method runs in less than 15% of the time for the sequential version:

And for larger collections (3,000 service calls), the improvement is even more impressive – Parallel.ForEach running in 10% of the sequential version’s time, and the Task version in 5%:

Improvements aren’t limited to multi-core boxes either, you’ll still see significant – if less impressive – reduction in processing times on single-core, single-CPU machines.

The usual caveat for performance improvements apply here – you need to test before and after in your own scenarios – and with the parallel extensions, you also need to take your server load into account. Run your tests with no load to get an idea of the maximum improvement available, and run with typical load to see what the real improvement is likely to be.

Microsoft has an excellent introduction to the parallel extensions here: Patterns of Parallel Programming (CSharp) (pdf), which covers the parallel extensions in greater detail.

* – the Reactive Extensions on DevLabs contain a port of the parallel extensions in the System.Threading dll which can be used with .NET 3.5 SP1, but it’s unsupported and doesn’t have the same level of performance as the native TPL in .NET 4.0. If you’re upgrade argument isn’t convincing enough and you’re limited to 3.5 SP1, the ported version still makes for a big improvement over sequential processing.

BizTalk 2010 launch party-I’ll be there

Hi all

So, today my boss confirmed that I can go to the event held by the Swedish BizTalk
User Group. See the details of the event here: http://bugs20100908-widget.eventbrite.com/.
The event says it’s a BizTalk 2010 launch party but whether BizTalk 2010 will be
out there I don’t know.

I am really looking forward to hearing what Richard
Seroter
, Ewan
Fairweather and Stephen
W. Thomas
have to say. I have preordered their book, both paper and ebook editions.
Hopefully I will receive at least one of them before September 8’th where the event
starts.

Also, this will actually be the first time I will meet Johan
Hedberg and Mikael
H%u00e5kansson, who are two of my Swedish colleagues who are both BizTalk MVPs.

Anyway, flight and hotel are booked. Look for me there!



eliasen

endpoint.tv – Workflow Services Security Pack

Some of the big gaps with Workflow Services have been in the area of security. In this episode, we will see the new Workflow Services Security Activity pack, which fills these holes, allowing you to

  • Use PrincipalPermission based authorization
  • Work with Username and SAML tokens
  • Impersonate the caller
  • Create client credentials for calling services
  • And much more…

For more information see 
    Windows Workflow Foundation on CodePlex

Ron Jacobs
blog        http://blogs.msdn.com/rjacobs
twitter    @ronljacobs