C# updating soap message before sending

Hi Guys,

I'm using HP UFT to run some automated tests. I'm reading a text file which contains valid xml and then sending the soap request using the text but when I send it has replaced all the < & > with > and < as seen below. The tool gives me the ability to add a BeforeExecuteStepEvent which I'm hoping I can use C# to modify the request before I send it so I was wondering if there is a way to convert the whole request to the proper format or run a replace over it

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
    <GetCityForecastByZIP xmlns="http://ws.cdyne.com/WeatherWS/">90210</ZIP></GetCityForecastByZIP>

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
This is correct XML entity encoding. Whitout any code, I need to guess: Use the XmlTextWriter.WriteRaw() method, to append the content from your file.
victoriaharryAuthor Commented:
Thanks, the way the tool works is very UI driven to make it easier for manual testers. The input to the request is linked to the output of the file read step. Before I can  use a method like you suggested I need to change the request before its send. Using c# is there a way to update the body before sending
ste5anSenior DeveloperCommented:
Okay, you also need to intercept it?

In this case use the SoapExtension infrastructure.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.