cbg
cbg

Reputation: 41

How to make C# web service produce soapenv namespace instead of soap?

Is there a way to make a C#/.NET web service which normally produces XML like this

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
 <DHeader xmlns="http://www.abc.com" />
</soap:Header>
  <soap:Body>
    <Response xmlns="http://www.abc.com">
      <Result>
        <ErrorObject ObjectID="string" ErrorCode=""  />          
      </Result>
     </Response>
   </soap:Body>
</soap:Envelope>

to produce XML like this.

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapv:Header>
    <DHeader xmlns="http://www.abc.com" />
  </soapenv:Header>
  <soapenv:Body>
    <Response xmlns="http://www.abc.com">
      <Result>
        <ErrorObject ObjectID="string" ErrorCode=""  />          
      </Result>
    </Response>
  </soapenv:Body>
</soapenv:Envelope>

This trying solve a problem with an AXIS client consuming a .NET web service. AXIS is choking on the soap namespace and needs a soapenv namespace. Changing the AXIS side is not possible.

any thoughts or comments would be great.

Here is the exact error as requested.

line -1: Element Envelope@http://www.w3.org/2003/05/soap-envelope is not a valid Envelope@http://schemas.xmlsoap.org/soap/envelope/ document or a valid substitution. 

Upvotes: 4

Views: 4397

Answers (1)

John Saunders
John Saunders

Reputation: 161773

soapenv is not a namespace - it's a namespace prefix.

As long as the prefixes refer to the same namespace, soap and soapenv refer to the same thing, and have the identical meaning.

It seems extremely unlikely that any version of AXIS is so badly broken as to treat the prefixes specially. You should assume you have a different problem. Please post the exact error you're receiving.

Upvotes: 1

Related Questions