| By Stanimir Stanev, Rob Bartlett | Article Rating: |
|
| March 29, 2008 04:00 PM EDT | Reads: |
14,527 |
ActiveMqWebRequestCreate
ActiveMqWebRequestCreate is a class that is used to create instances of
our objects instead of the built-in ones for a particular URI prefix.
We'll see how this is used in the client application.
public class ActiveMqQueueWebRequestCreate : IWebRequestCreate
{
This has the same properties that are on the ActiveMqWebRequest so it can set them when it instantiates the requests.
...
public WebRequest Create(System.Uri uri)
{ ActiveMqQueueWebRequest request =
new ActiveMqQueueWebRequest(
uri, _queueAddress, _queueName,
_username, _password);
return request;
} }
The .NET Client
In the client, we
generate web service proxies exactly the same as if they were HTTP,
only we don't necessarily have the option to hit a url that
generates/serves a wsdl, so we use a file wsdl. We don't have to do
anything special with the proxies. In this example, ShippingService is
the service, and GetDistance() is its only operation. It accepts a
GetDistanceRequest and returns a GetDistanceResponse. Before we call an
operation on our service, we register our protocol to use our
ActiveMqWebRequestCreate for a custom URI prefix.
Once this protocol is registered, it's available from that point forward within the application domain.
// Create a dummy URI
System.Uri urlRequest = new System.Uri(
"activeJms://ftp.momentum.com/activeJmsUri/I/do/not/exist.txt");
// Register it
bool isGood = WebRequest.RegisterPrefix("activeJms",
new ActiveMqQueueWebRequest.ActiveMqQueueWebRequestCreate(
"tcp://localhost:61616", "myQueue", "un", "pw"));
We call our services the same way we would if it were HTTP. The only difference is that the URI uses a different prefix.
ShippingService.ShippingService svc = new ShippingService.ShippingService();
svc.Url = "activeJms://localhost:61616";
ShippingService.GetDistanceRequest req = new ShippingService.GetDistanceRequest();
req.startZipCode = "78728"; req.endZipCode = "50158";
ShippingService.GetDistanceResponse resp = svc.GetDistance(req);
In this specific implementation, each prefix has a fixed address and queue. Fancier implementations could support extra information in the URI query string similar to the Tibco one mentioned in the URL-based JMS transport section.
.NET Consumer Summary
The components
above can be created once, and then leveraged for any number of
services. Once the protocol is registered, we don't have to change the
way we work with services, and for all the talk of SOAP, we didn't have
to see any! There's nothing to prevent us from using both the JMS and
HTTP web service implementations in the same application or integration
tests.
Conclusion
We made our service consumers talk
directly to the MOM layer. No extra hubs are involved, so the SOAP
requests reach the middleware as quickly as possible. With appropriate
JMS adapters and knowledge, you can easily implement a consumer in
almost any language. Most important, we kept untouched the generated
stubs and proxies at the consumer and reused the service engine on the
server side. So in addition to the highly scalable and reliable, this
approach is also fast and easy to implement.
Published March 29, 2008 Reads 14,527
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Stanimir Stanev
Stanimir Stanev is a senior consultant at MomentumSI's Enterprise Architecture Solutions practice. He has many years of experience focusing on providing enterprise architecture and strategy expertise to companies looking to migrate to or maximize the advantages of SOA principles.
More Stories By Rob Bartlett
Rob Bartlett is a senior consultant at MomentumSI's Software Development Solutions practice. He has over a decade of experience in technical roles, guiding major corporations in the design, implementation, and integration of business solutions.
![]() |
sjsu 04/23/08 07:52:59 PM EDT | |||
good job man....... really good idea |
||||
- The Top 150 Players in Cloud Computing
- Commercial vs Federal Cloud Computing
- Why IBM’s Server Chief Got Busted
- Industry Experts Discuss the State of Cloud Computing
- Cloud Expo New York Call for Papers Now Open
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- US Federal Government is Major Cloud Computing Innovator
- Google Wave
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Adaptivity & Cloud Computing: Exclusive Q&A with CEO Tony Bishop
- 4th International Cloud Expo: Photo Album
- The Top 150 Players in Cloud Computing
- SYS-CON.TV: Cloud Computing Expo Power Panel
- Commercial vs Federal Cloud Computing
- Why IBM’s Server Chief Got Busted
- 1st Annual GovIT Expo: Letter from the Technical Chair
- Industry Experts Discuss the State of Cloud Computing
- Deputy CIO of the CIA to Keynote 1st Annual GovIT Expo
- SOA World Power Panel on SYS-CON.TV
- CIA was Headed to an Enterprise Cloud All Along: Jill Tummler Singer
- Cloud Expo New York Call for Papers Now Open
- 1st Annual Government IT Conference & Expo: Themes & Topics
- Stock in Focus: Dragon Capital
- The i-Technology Right Stuff
- Who Are The All-Time Heroes of i-Technology?
- Get the Message
- Where Are RIA Technologies Headed in 2008?
- i-Technology Viewpoint: Is Web 2.0 the Global SOA?
- i-Technology Viewpoint: Thinking Outside the VC Box
- ESB Myth Busters: 10 Enterprise Service Bus Myths Debunked
- i-Technology Viewpoint: When to Leave Your First IT Job
- SOA Web Services Edge Conference Coverage on SYS-CON.TV
- Five Reasons Why Web 2.0 Matters
- SYS-CON.TV's "SOA Web Services" and "Enterprise Open Source" Programs To Air in December
- SOA World Conference & Expo SYS-CON.TV Power Panel Live From Times Square










Cloud computing is a game changer. The cloud ...















