DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Rethinking Enterprise Integration: The Understated Role of Enterprise Service Bus (ESB)
  • Creating a Mule ESB Sample Hello World Application
  • Step By Step Guide To Using Mule ESB
  • Is Enterprise Service Bus (ESB) Obsolete After Microservices?

Trending

  • DZone's Article Submission Guidelines
  • The End of “Good Enough Agile”
  • MCP Servers: The Technical Debt That Is Coming
  • GitHub Copilot's New AI Coding Agent Saves Developers Time – And Requires Their Oversight
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. Multipart WSDL With Mule ESB

Multipart WSDL With Mule ESB

Let's take a look at a tutorial that explains SOAP binding for an operation that has two parts with a SOAP header part and a SOAP body.

By 
venu a user avatar
venu a
·
Aug. 30, 18 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
11.5K Views

Join the DZone community and get the full member experience.

Join For Free

Before getting into an article, let’s have a quick introduction about web services with multi-part WSDL.

We can say a WSDL as multipart WSDL when:

1. SOAP binding for an operation bound to A SOAP body and non-binary attachments.

2. SOAP binding for an operation that has two parts with a SOAP header part and a SOAP body. The below screenshot from WSDL will help you in identifying the multi-part WSDL.Image title

In this article, we are going to discuss scenario number 2.

Currently, most of the banking, healthcare, insurance, and aviation sector players maintain their core enterprise integration systems with SOAP-based services for various reasons.

When you are migrating from a legacy WBS-based system into Mule, you will surely end up consuming WS with multi-part WSDL’s.

SOAP-based Webservice’s can be consumed in Mule using a Webservice consumer or CXF component with a JAX-WS client operation. As a web service consumer doesn’t support multi-part implementation, we will go with the CXF component.

Components used:

  1. CXF as JAX-WS client

  2. SOAP Router

  3. XML to JAXBObject transformer

  4. WSDL2 Java tool by CXF can be found here. 

Whenever you try consuming services with multi-part messages, the web service consumer shows a warning as “Warning: Operation Messages With More Than 1 Part Are Not Supported.”

When you drag and drop the DW component, it senses either SOAP Body or other parts, which makes it difficult for developers to perform transformations.

Step 1

Generate JAXB Objects corresponding to the given service WSDL.

Before generating JAXB objects, we need to make the below change to WSDL.

Find the PortType for your interface and place the below binding statement in your WSDL.

<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">         
<jaxws:enableWrapperStyle>false</jaxws:enableWrapperStyle>

</jaxws:bindings>

Drag and drop CXF componant, select operation as Jax-WS Client as shown in the below screenshot.

Image title

To generate JAXB objects, click on Generate from WSDL as highlighted in the above screenshot. Enter the WSDL location and Java package name in the "Generate from WSDL" pop-up:

Image title

Step 2

Identify the below classes from the generated Java files:

1. The interface represents Webservice (tip: search with “@WebService”).

2. Request header and body Java Objects (tip: Identify from Interface class Operation).

3. Webservice Client class (tip: search with “@WebServiceClient”).

Step 3

Prepare request for Jax-WS client.

As our message payload contains data formats like XML, we need to convert XML to the equivalent, JAXB object, using XML to JAXB Object Transformer.

Header JAXB object creation:

Image title

Body JAXB Object creation:

Image title

Step 4

Consume Webservice:

Assign the Payload with the required variables for the given Operation. As getDetails operation as two parameters, out payload will be an array of two JAXB objects.

@WebMethod

    @WebResult(name = "getDetailsResponse", targetNamespace = "http://soapMain.capg.com", partName = "parameters")

    public GetDetailsResponse getDetails(

        @WebParam(partName = "getDetails", name = "getDetails", targetNamespace = "http://soapMain.capg.com")

        GetDetails getDetails,

        @WebParam(partName = "InputHeader", name = "getDetailsHeader", targetNamespace = "http://soapMain.capg.com", header = true)

        GetDetailsHeader inputHeader

    );

Request Payload:

requestPayload = new object[2]();

requestPayload[0] = payload;

requestPayload[1] = flowVars.flwJaxBHeader;

payload = requestPayload;

Add a combination of CXF as JAX-WS client and HTTP requester for consuming the Webservice.

Image title

Thanks for reading this article, and let me know your thoughts and/or suggestions in the comments section. 

Enterprise service bus

Opinions expressed by DZone contributors are their own.

Related

  • Rethinking Enterprise Integration: The Understated Role of Enterprise Service Bus (ESB)
  • Creating a Mule ESB Sample Hello World Application
  • Step By Step Guide To Using Mule ESB
  • Is Enterprise Service Bus (ESB) Obsolete After Microservices?

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!