Validating Soap Envelope

Discussion in 'XML' started by Patrick Brunmayr, Oct 14, 2007.

  1. Hello

    I have a big Problem with validating a Soap Envelope. I have
    downloaded the xsd for a soap envelope from http://schemas.xmlsoap.org/soap/envelope/

    The validation succeeds as lonng as i don't use elements in body with
    a xsi:type attribute!

    The Problem is that foo:person is an abstract type and foo:driver is
    dervived from it. So using a foo:person is not allowed until specifing
    the type of person per xsi:type. The below example demonstrates this
    problem. When i try to validate this with the saxonica validator
    following error occurs

    Validation error on line 6 column 60 of test xml:
    Unknown type {foo:driver} specified in xsi:type attribute SAXON
    8.9.0.3 from Saxonica validate complete

    The definition of of sopa body says

    <xs:sequence>
    <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"
    processContents="lax"/>
    </xs:sequence>

    So when elements from other namespacas are found, try to find a schema
    defintion otherwise don't care

    In my example there is no schema defintion for "foo:driver" because
    the soap schema can not know about the schema where "foo:driver" is
    defined! I have no possibility at this stage of validation to include
    the schema defintion for those types. I need the xsi:type attribute
    coz the sopa body elements will be validatet at later stage. Dont
    specfifing the xsi:type attribute whill pass the soap envelope
    validation but not thr later body elements validation! How can i solve
    this

    My Sample Soap Request

    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xs="http://
    www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
    instance"
    xsi:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/
    envelope11.xsd">
    <env:Header/>
    <env:Body>
    <foo:person xmlns:foo="http://foo" xsi:type="foo:driver">
    </foo:person>
    </env:Body>
    </env:Envelope>
     
    Patrick Brunmayr, Oct 14, 2007
    #1
    1. Advertising

  2. Patrick Brunmayr wrote:
    > downloaded the xsd for a soap envelope from http://schemas.xmlsoap.org/soap/envelope/
    > The validation succeeds as long as i don't use elements in body with
    > a xsi:type attribute!


    If you specify xsi:type, you need to provide information so the system
    can find the schema which defines that type, as well as the schema for
    the soap envelope.

    The "any" means that the soap wrapper doesn't care what its contents are
    -- but that does NOT mean they aren't checked for consistency on their own.

    > In my example there is no schema defintion for "foo:driver" because
    > the soap schema can not know about the schema where "foo:driver" is
    > defined!


    Most systems for providing the schema information -- and specifically
    the schemalocation hint attribute -- can specify multiple schema
    documents that will be combined into a single effective schema. That's
    what you need to fix, I believe.

    There really ought to be articles and examples of this on the web by
    now. I'm not currently hacking around with Soap so I don't have a
    pointer handy, but may I suggest that Google Is Your Friend?

    --
    () ASCII Ribbon Campaign | Joe Kesselman
    /\ Stamp out HTML e-mail! | System architexture and kinetic poetry
     
    Joe Kesselman, Oct 15, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    0
    Views:
    546
  2. cxc
    Replies:
    0
    Views:
    6,538
  3. Replies:
    0
    Views:
    485
  4. GenxLogic
    Replies:
    3
    Views:
    1,351
    andrewmcdonagh
    Dec 6, 2006
  5. droesler
    Replies:
    2
    Views:
    561
    droesler
    Aug 31, 2010
Loading...

Share This Page