Welcome!

Microsoft Cloud Authors: Pat Romanski, Liz McMillan, Lori MacVittie, Elizabeth White, Yeshim Deniz

Related Topics: Microsoft Cloud, Java IoT

Microsoft Cloud: Article

Java & .NET: SOAP Over JMS Interoperability

Exposing a Java Web Service via JMS using Apache Axis 1.4 and consuming it from both Java and .NET clients

Next, we attach the SOAP as a byte array to a message and send it to the queue/topic.

      IBytesMessage message = session.CreateBytesMessage();
      message.Content = bytBody;
      //Give the address of our temporary queue
      // so the service knows where to send the response
      message.NMSReplyTo = queue;
      using (IMessageProducer producer = session.CreateProducer())
      { NmsDestinationAccessor destinationResolver = new NmsDestinationAccessor();
      IDestination destination = destinationResolver.ResolveDestinationName(session, _queueName);
      producer.Send(destination, message);
     }

Now we wait for a response. We set a timeout (as a TimeSpan). Here it's a fixed value of 10 seconds for illustration, but it could easily come from a config file or passed as a property in the ActiveMqWebRequestCreate.

IBytesMessage response = (IBytesMessage)
consumer.Receive(
TimeSpan.FromSeconds(10))
as IBytesMessage;
stream = new MemoryStream();
stream.Write(response.Content, 0, response.Content.Length);

    } } }
    catch (NMSException e)
    { throw (e); }
    finally
    { m_RequestStream.InternalClose(); }

    ActiveMqQueueWebResponse resp = new ActiveMqQueueWebResponse();

Here we set the stream to our own.

    resp.SetDownloadStream(stream);
    return resp;
}

Our ActiveMqWebResponse class inherits System.Net.WebResponse and does little more than provide a setter and override the getter on the response stream, since the stream in the built-in WebResponse is read-only.

public class ActiveMqQueueWebResponse : WebResponse
{
    private Stream m_ResponseStream;
    private long m_lngContentLength;
    ...
    internal void SetDownloadStream(Stream vobjResponseStream)
    { m_ResponseStream = vobjResponseStream;
       m_ResponseStream.Position = 0; // Rewind the stream
       m_lngContentLength = m_ResponseStream.Length;
    }

    public override Stream GetResponseStream()
    { return m_ResponseStream;
} }

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;
} }


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.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


IoT & Smart Cities Stories
With 10 simultaneous tracks, keynotes, general sessions and targeted breakout classes, @CloudEXPO and DXWorldEXPO are two of the most important technology events of the year. Since its launch over eight years ago, @CloudEXPO and DXWorldEXPO have presented a rock star faculty as well as showcased hundreds of sponsors and exhibitors! In this blog post, we provide 7 tips on how, as part of our world-class faculty, you can deliver one of the most popular sessions at our events. But before reading...
If a machine can invent, does this mean the end of the patent system as we know it? The patent system, both in the US and Europe, allows companies to protect their inventions and helps foster innovation. However, Artificial Intelligence (AI) could be set to disrupt the patent system as we know it. This talk will examine how AI may change the patent landscape in the years to come. Furthermore, ways in which companies can best protect their AI related inventions will be examined from both a US and...
Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
DXWorldEXPO LLC, the producer of the world's most influential technology conferences and trade shows has announced the 22nd International CloudEXPO | DXWorldEXPO "Early Bird Registration" is now open. Register for Full Conference "Gold Pass" ▸ Here (Expo Hall ▸ Here)
@DevOpsSummit at Cloud Expo, taking place November 12-13 in New York City, NY, is co-located with 22nd international CloudEXPO | first international DXWorldEXPO and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The widespread success of cloud computing is driving the DevOps revolution in enterprise IT. Now as never before, development teams must communicate and collaborate in a dynamic, 24/7/365 environment. There is no time t...
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
The best way to leverage your Cloud Expo presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering Cloud Expo and @ThingsExpo will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at Cloud Expo. Product announcements during our show provide your company with the most reach through our targeted audiences.
Machine Learning helps make complex systems more efficient. By applying advanced Machine Learning techniques such as Cognitive Fingerprinting, wind project operators can utilize these tools to learn from collected data, detect regular patterns, and optimize their own operations. In his session at 18th Cloud Expo, Stuart Gillen, Director of Business Development at SparkCognition, discussed how research has demonstrated the value of Machine Learning in delivering next generation analytics to impr...
The challenges of aggregating data from consumer-oriented devices, such as wearable technologies and smart thermostats, are fairly well-understood. However, there are a new set of challenges for IoT devices that generate megabytes or gigabytes of data per second. Certainly, the infrastructure will have to change, as those volumes of data will likely overwhelm the available bandwidth for aggregating the data into a central repository. Ochandarena discusses a whole new way to think about your next...