July 12, 2006 at 11:03 PM #14018
I am building a BTS app that needs to use a solicit-response mechanism to send HTTP commands out to a server and capture its XML response.
Unfortunately I am a complete HTTP n00b and am not sure quite what to do. I had built some stuff already and had confidently assumed it would work but it didn’t (I got some 405 method not allowed message). Could you help?
What I essentially need to do is send an http://myserver.com?app=abc&cmd=xyz (value-pair) type command out to a server that may be over the intra- or internet and receive a response in the form of an XML-format ADO recordset. If I issue this command over IE I see the response I expect to capture in BTS. The actual server URI is variable so I am defining the solicit-response port as Dynamic and setting the server address at runtime.
The way I attempted to approach the problem was as follows:
On the send side, I defined a schema to represent the various bits I need (uri, app, cmd as in example above) in XML form and then define a flat file extension for it to turn it into the appropriately-delimited string. The send port runs over a pipeline that uses the Flat File assembler component. At runtime, the BTS orchestration builds an XML message that conforms to the schema I defined; I strip the uri out of the message and assign it to the send port address, and then post the message remnant to the send port: the Flat File component turns it into the appropriate string and the string should then get posted to the desired address. I have tested this by sending to a file rather than http port and the http string is what I would expect to see. Do I need to implement URI encoding myself using a custom pipeline that I’d slot in after the Flat File one has run, or should the http send port manage this my itself? I had assumed the latter…
On the receive side, I have built a pipeline component to capture the returned XML ADO Recordset and turn it into a more recognisable schema that I have declared in BTS. The http receive port runs over a pipeline that uses this component. I have tested this by using the pipeline on a file-based receive port and it seems to work ok.
However, I strongly suspect this is not the way I am supposed to be doing it!
It could be that this method is ok but that something else is causing the 405 error: I have set up the BTS http receive extension (though it was already there for hws anyway), but I reckon the problem is on the send rather than the receive side, and my knowledge of IIS and SharePoint is so shallow that I do not know what to do next.
Any help would be GREATLY appreciated!!
Thanks and best regards
July 13, 2006 at 4:00 PM #14019
…for the rapid response.
I had already built a C# test harness outside of BTS and had started yesterday incorporating this and the receive pipeline disassembler code into a method that can be called from an orchestration, and am happy to say that it appears to work ok (though I feel it is a bit of a hack).
I had thought about going down the custom adapter route and this is the way I’ll go in the next stage of the interface development (when time is not quite so tight!) I see that there are some articles describing how to make a custom adapter dynamic, so it should be ok…
Anyway, thanks again for the feedback and for basically confirming the course of action that I thought I might have to take. I needed to ask though to make sure I wasn’t just mis-using the BTS HTTP adapter.
July 13, 2006 at 12:38 AM #14017
Everything you have done looks perfectly ok except for one fatal flaw.
The HTTP Send adapter uses the HTTP POST method, not the HTTP GET method.
The IE browser will be using the HTTP GET method, which is what the web page is expecting.
This is why you get the 405 Method not allowed error.
There are a number of options
1. Change the web page to support the POST method
2. Write your own HTTP adapter that supports solicit response using GET.
3. Write a .NET class, with a static method that can be called from the orchestration. This method will download the data and return to the orchestration
[code:1:7aff474734]public static string GetXmlfromHttp(string Url)
string username = ConfigurationManager.AppSettings.Get(\"Username\");
string password = ConfigurationManager.AppSettings.Get(\"Password\");
WebClient request = new WebClient();
request.Credentials = new NetworkCredential(username, password);
byte fileData = request.DownloadData(source.ToString());
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.