| By Stanimir Stanev, Rob Bartlett | Article Rating: |
|
| March 3, 2008 06:00 AM EST | Reads: |
14,235 |
After the message is received, in the code above, the logic instantiates the standard AxisEngine, passes the deploy-shipping.wsdd to it, and invokes the MessageProcessor. Again, the name and location of the hard-coded deploy-shipping.wsdd file should be externalized to allow changes without code recompilation and redeployment.
The MessageProcessor works with a single SOAP request. It uses the AxisEngine to invoke the appropriate service operation. The beauty of this approach is that it reuses the AxisEngine that handles the SOAP messages without knowing how they were delivered. It's transport-independent.
...
Message soapMessage = new Message(bytesMessageReader);
MessageContext msgContext = new MessageContext(axisEngine);
msgContext.setRequestMessage(soapMessage);
axisEngine.invoke(msgContext);
soapMessage = msgContext.getResponseMessage();
...
The SOAP response is sent back to the JMS destination provided by the JMSSender from the consumer side.
...
Destination responseDestination = bytesMessage.getJMSReplyTo();
if (responseDestination != null)
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
soapMessage.writeTo(out);
JMSUtil.sendJmsMessage(responseDestination, out.toByteArray());
}
...
For simplicity's sake, we don't show any reasonable exception handlers or provide the code available in JMSUtil that contains the standard Java to-send JMS message to the specified destination.
Axis Server Engine
The Axis Server Engine is
provided by Axis. As we mentioned, it has no knowledge of how the SOAP
message was delivered. It just takes it and processes it, which will
actually result in an invocation of the actual GetDistance operation of
our ShippingService.
So how does AxisEngine find the ShippingService? Well, the deploy-shipping.wsdd provided to the AxisEngine is a standard Axis deployment descriptor. It describes handlers, services, operations, mappings, classes, and everything that Axis needs to find and invoke the operation as a regular Java method.
Shipping Service
We write the shipping service. It contains the actual business logic of the exposed service operations.
public class ShippingWebService
{
public GetDistanceResponse getDistance(GetDistanceRequest request)
throws Exception
{
...
}
}
As a regular Axis Web Service, the shipping Web Service requires the deploy-shipping.wsdd that we use to deploy the service under Axis. To learn more about how to write WSDD files, see the Apache Axis documentation.
Service Provider Summary
The only component that
we've added to handle SOAP messages is the JMSReceiver. It's plugged
into the architecture to handle messages delivered through JMS. The
rest of the components are exactly the same since they expose standard
SOAP over HTTP services. That's why this architecture can handle
requests delivered by both JMS and HTTP at the same time. Besides these
two, by implementing appropriate receivers, the service provider can be
extended to handle messages delivered by any transport.
The .NET Consumer of JMS
SOAP over HTTP is easy to
consume from a .NET application. Visual Studio 2005 or WSDL.exe will
automatically generate proxies based on a wsdl, so developers can get
down to the business logic rather than worry about the plumbing. That's
not to say it's as easy as pie. Not all SOAP is created equal, but
addressing the issues around SOAP compatibilities would warrant an
entire article (or several). Here we're focused on how to use the .NET
infrastructure to consume Java SOAP services over JMS. Our examples
were created for .NET 2.0 using Visual Studio 2005 and they assume a
general understanding of how to generate HTTP Web Service proxies. (Figure 2)
Published March 3, 2008 Reads 14,235
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.
- Kindle 2 vs Nook
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- Confessions of a Ulitzer Addict
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- It's the Java vs. C++ Shootout Revisited!
- Cloud Computing Can Revitalize Your Career as Software Developer
- IBM Could "Reinvent" Java: Mills
- Oracle & Cloud Computing: Exclusive Q&A with SVP Richard Sarwal
- A Brief History of Cloud Computing
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Why IBM’s Server Chief Got Busted
- Is Cloud Computing Like Teenage Sex?
- Industry Experts Discuss the State of Cloud Computing
- Performance Tuning Essentials for Java
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- A Cup of AJAX? Nay, Just Regular Java Please
- Java Developer's Journal Exclusive: 2006 "JDJ Editors' Choice" Awards
- The i-Technology Right Stuff
- JavaServer Faces (JSF) vs Struts
- Rich Internet Applications with Adobe Flex 2 and Java
- Java vs C++ "Shootout" Revisited
- Bean-Managed Persistence Using a Proxy List
- Reporting Made Easy with JasperReports and Hibernate
- Creating a Pet Store Application with JavaServer Faces, Spring, and Hibernate
- What's New in Eclipse?
- Why Do 'Cool Kids' Choose Ruby or PHP to Build Websites Instead of Java?
- i-Technology Predictions for 2007: Where's It All Headed?







































