Welcome!

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.


Latest Stories
ICC is a computer systems integrator and server manufacturing company focused on developing products and product appliances to meet a wide range of computational needs for many industries. Their solutions provide benefits across many environments, such as datacenter deployment, HPC, workstations, storage networks and standalone server installations. ICC has been in business for over 23 years and their phenomenal range of clients include multinational corporations, universities, and small busines...
The current environment of Continuous Disruption requires companies to transform how they work and how they engineer their products. Transformations are notoriously hard to execute, yet many companies have succeeded. What can we learn from them? Can we produce a blueprint for a transformation? This presentation will cover several distinct approaches that companies take to achieve transformation. Each approach utilizes different levers and comes with its own advantages, tradeoffs, costs, risks, a...
This session describes how Professional Services organisations can deliver within Technology-as-a-Service (IaaS) constructs, in private and public enterprise cloud scenarios. See how professional services can be packaged and funded by IaaS cash flows, based upon consumption of technology services. Learn how significant, IT infrastructure transformations can be funded through OPEX spending models with multi-year As-a-Services based contracts. Understand how the automation of repeatable services c...
This sixteen (16) hour course provides an introduction to DevOps, the cultural and professional movement that stresses communication, collaboration, integration and automation in order to improve the flow of work between software developers and IT operations professionals. Improved workflows will result in an improved ability to design, develop, deploy and operate software and services faster.
Enterprises are universally struggling to understand where the new tools and methodologies of DevOps fit into their organizations, and are universally making the same mistakes. These mistakes are not unavoidable, and in fact, avoiding them gifts an organization with sustained competitive advantage, just like it did for Japanese Manufacturing Post WWII.
Most modern computer languages embed a lot of metadata in their application. We show how this goldmine of data from a runtime environment like production or staging can be used to increase profits. Adi conceptualized the Crosscode platform after spending over 25 years working for large enterprise companies like HP, Cisco, IBM, UHG and personally experiencing the challenges that prevent companies from quickly making changes to their technology, due to the complexity of their enterprise. An accomp...
Cloud computing is a goal aspired to by all organizations, yet those in regulated industries and many public sector organizations are challenged in adopting cloud technologies. The ability to use modern application development capabilities such as containers, serverless computing, platform-based services, IoT and others are potentially of great benefit for these organizations but doing so in a public cloud-consistent way is the challenge.
The digital transformation is real! To adapt, IT professionals need to transform their own skillset to become more multi-dimensional by gaining both depth and breadth of a wide variety of knowledge and competencies. Historically, while IT has been built on a foundation of specialty (or "I" shaped) silos, the DevOps principle of "shifting left" is opening up opportunities for developers, operational staff, security and others to grow their skills portfolio, advance their careers and become "T"-sh...
"Calligo is a cloud service provider with data privacy at the heart of what we do. We are a typical Infrastructure as a Service cloud provider but it's been designed around data privacy," explained Julian Box, CEO and co-founder of Calligo, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
In his session at 21st Cloud Expo, Michael Burley, a Senior Business Development Executive in IT Services at NetApp, described how NetApp designed a three-year program of work to migrate 25PB of a major telco's enterprise data to a new STaaS platform, and then secured a long-term contract to manage and operate the platform. This significant program blended the best of NetApp’s solutions and services capabilities to enable this telco’s successful adoption of private cloud storage and launching o...
When building large, cloud-based applications that operate at a high scale, it’s important to maintain a high availability and resilience to failures. In order to do that, you must be tolerant of failures, even in light of failures in other areas of your application. “Fly two mistakes high” is an old adage in the radio control airplane hobby. It means, fly high enough so that if you make a mistake, you can continue flying with room to still make mistakes. In his session at 18th Cloud Expo, Lee A...
Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (November 12-13, 2018, New York City) today announced the outline and schedule of the track. "The track has been designed in experience/degree order," said Schmarzo. "So, that folks who attend the entire track can leave the conference with some of the skills necessary to get their work done when they get back to their offices. It actually ties back to some work that I'm doing at the University of San...
Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term. A total of 88% of Fortune 500 companies from a generation ago are now out of business. Only 12% still survive. Similar percentages are found throughout enterprises of all sizes. We are offering early bird savings...
Digital transformation is about embracing digital technologies into a company's culture to better connect with its customers, automate processes, create better tools, enter new markets, etc. Such a transformation requires continuous orchestration across teams and an environment based on open collaboration and daily experiments. In his session at 21st Cloud Expo, Alex Casalboni, Technical (Cloud) Evangelist at Cloud Academy, explored and discussed the most urgent unsolved challenges to achieve fu...
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...