DZone
Integration Zone
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
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Integration Zone > 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.

venu a user avatar by
venu a
·
Aug. 30, 18 · Integration Zone · Tutorial
Like (3)
Save
Tweet
10.66K 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.

Popular on DZone

  • XAMPP vs WAMP: Which Local Server Is Best?
  • 5 Options for Deploying Microservices
  • The Digital Finance Revolution, Open Banking, and APIs
  • A Guide to Maven 3 Beta

Comments

Integration Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo