Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

SOAP Message Validator -Does it validates SOAP Header Namespace

Hi,

I have two name space one in SOAP Header and another with SOAP Method as below.

Looks like SOAP Message Validator Policy only validates the SOAP Method Namespace, but if I change the namespace inside the SOAP Header, it does not validate, if I indicate it to validate from SOAP Validator Policy as below .

My SOAPMessage Validator Policy looks like below.

<MessageValidation async="false" continueOnError="false" enabled="true"
                   name="SOAP-Message-Validation">
  <DisplayName>SOAP Message Validation</DisplayName>
  <Properties/>
  <Element namespace="MethodNamespace">SoapMethodName</Element>
  <Element namespace="HeaderNamespace">SOAPHeaderTag</Element>
  <SOAPMessage/>
  <Source>request</Source>
  <ResourceURL>wsdl://MySOAP.wsdl</ResourceURL>
</MessageValidation>

1.If My request is as below, where I have given correct Header and Body namespace

<soap12:Envelope xmlns:xsi=NameeeeeSpacceeee" xmlns:soap12="AnotherValue">
  <soap12:Header>
    <AuthSOAPHeader xmlns="HeaderNamespace">
      <MoreHeaderElementsHere/>
    </AuthSOAPHeader>
  </soap12:Header>
  <soap12:Body>
    <SoapMethodName xmlns="MethodNamespace">
      <Other ElementsofBODY='foo'/>
    </SoapMethodName>
  </soap12:Body>
</soap12:Envelope>

2. If I change the SoapMethodName element to below,

<SoapMethodName xmlns="MethodNames"> <!-- instead of "MethodNamespace" -->

it gives me following error

{"fault":{"faultstring":"SOAP-Message-Validation failed with reason: \"Unexpected Root Element SoapMethodName [Line xx]\"","detail":{"errorcode":"steps.messagevalidation.Failed"}}}

3. If I change, in the request

<AuthSOAPHeader xmlns="HeaderNamespace">

to

<AuthSOAPHeader xmlns="Header">

...the policy does not complain, it just passes without complaining about MISMATCH in Header namespace.

I have indicated in SOAP MessageValidator to validate both Body name space and Header namespace, but not sure only Body name space is detected but not Header namespace.

Let me know, if I need to change the validation Policy information or may be need to update any other way or such header namespace validation is not possible ?

1 6 5,426
6 REPLIES 6