How to fix MTOM/XOP issues in HPE LoadRunner?

How to fix MTOM/XOP issues in HPE LoadRunner?: Recently I was facing issues while scripting in HPE LoadRunner for the web services. My script threw “Response is not well-formed XML”. In last release, the script was working without any issues. But in this release, I was getting above error. I checked the detailed logs from HPE LoadRunner, but I couldn’t get any info.

Later I contacted the development team about this issue. They informed that they had implemented MTOM/XOP for sending Binary Data in this release. In this article, we will see how to fix MTOM/XOP issues in HPE LoadRunner?

What is MTOM/XOP?

MTOM/XOP stands for SOAP Message Transmission Optimization Mechanism/XML-binary Optimized Packaging. It defines the method which optimizes the transmission of XML data of type base64 and hexBinary in SOAP messages. If the transport protocol is HTTP, MIME attachments carry the data, concurrently it allows sender and receiver directly access the XML data.

It involves following process

  • Encode the binary data
  • Removed the binary data from SOAP envelope
  • Compresses the binary data and attaches it to the MIME package
  • Add references to the MIME package.

Response that we receive in HPE LoadRunner is MTOM format, not the SOAP format. But HPE LoadRunner is sending SOAP message and expecting SOAP format. But the server is sending back MTOM format. There is a conflict hence you will get above error.

How to fix MTOM/XOP issues in HPE LoadRunner?

To fix this, you need to add below custom handler to your web service call.

[rad_rapidology_locked optin_id=optin_1]



web_service_call( “StepName=EchoComplex_101”,




  “UserHandlerName=LrWsAttachmentsHandler”,  “UserHandlerArgs=ATTACHMENT_ADD; ATTACHMENTS_FORMAT_MIME;   ContentType=text/plain; FileName=C:\\temp\\results.discomap”,













Above custom handler overrides the transport layer and receives MTOM message. If your services using MTOP/XOP, do not forget to add above custom handler.

Happy Scripting!


4 thoughts on “How to fix MTOM/XOP issues in HPE LoadRunner?”

  1. Hi – I’m getting following error while trying to run the script…
    Action1.c(6): Error:Failed to initialize the Java environment – unable to initialize JVM.
    Action1.c(6): Error:Failed to process the request.
    Action1.c(6): Error:SOAP request “SOAP Request” execution failed

  2. Thanks, I have added the handler but getting a response a per below, if you have any suggestions as to resolve the below?
    Cannot receive message: Error creating a reader for the MTOM message : Malformed header

    Can you please elaborate on the FileName=C:\\temp\\results.discomap” section. Is this the output file?

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

New Year. New Hope. Learn TruWeb. 78% OFF for Limited Time of my Udemy course..BUY NOW