Click here to Skip to main content
13,042,329 members (111,857 online)
Rate this:
Please Sign up or sign in to vote.
Hi Guys

Before you answer read! and please dont give me a result you quickly Googled, i need someone who actualy dealt with this and can give me an actual answer.

I have a delphi program that calls my .net web service, problem is the parameters always comes through as a null value , all i need is to pasre a simple string through so I built a bit of code into my Global.asax code.

protected void Application_BeginRequest(object sender, EventArgs e)
            string name = HttpContext.Current.Request.Url.ToString();
            if (name.Contains("PMA/PMAService.asmx"))
                // Create byte array to hold request bytes
                byte[] inputStream = new byte[HttpContext.Current.Request.ContentLength];
                // Read entire request inputstream
                HttpContext.Current.Request.InputStream.Read(inputStream, 0, inputStream.Length);
                //Set stream back to beginning
                HttpContext.Current.Request.InputStream.Position = 0;
                //Get  XML request
                string requestString =UTF8Encoding.UTF8.GetString(inputStream);

This captures the incoming soap requests

From delphi the request is as follow:
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xmlns:xsd="" xmlns:xsi="">
<saySomething xmlns=""><xsd:data>hello</xsd:data></saySomething>

I need to change this into Following (this is what comes from a .net client program):

<s:Envelope xmlns:s="">
<saySomething xmlns="" xmlns:i=""><data>hello</data></saySomething>

I know how to manipulate the string but how do i manipulate the request input stream before it hits the web service and runs the command and returns the result ?

Thank you in advance
Posted 31-Jul-12 20:51pm
L Viljoen5.2K

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

found a solution.

It involves inherriting from the SoapExtension and changing data in the

public override void ProcessMessage()

Method in order to rewrite the stream beforeit becomes deserialized.

Will write an article regarding this over the weekend.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 1 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100