You are viewing a plain text version of this content. The canonical link for it is here.
Posted to p-dev@xerces.apache.org by Lev Lvovsky <li...@sonous.com> on 2008/05/07 07:02:32 UTC

parsing SOAP server response

I'm attempting to parse a SOAP response with Xerces, and things are  
looking fine but for the encodingStyle attribute of the 'Envelope'  
element.

The beginning of a SOAP envelope is something like this:

---
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP- 
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"  
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema 
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP- 
ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>...
---

I grabbed the Schema file for the envelope here from http://schemas.xmlsoap.org/soap/encoding/ 
  (BTW, how can I tell Xerces to get '/' if there is no actual server  
file name associated with a URL?), named it 'soap-envelope.xsd', and  
setExternalSchemaLocation() to be 'http://schemas.xmlsoap.org/soap/envelope/ 
  soap-envelope.xsd'.

Upon parsing the response, I get a validation error:

Attribute '{http://schemas.xmlsoap.org/soap/envelope/}encodingStyle'  
is not declared for element 'Envelope'.

If I add the 'http://schemas.xmlsoap.org/soap/encoding/ soap- 
encoding.xsd' string to the setExternalSchemaLocation call, it  
complains upon parsing the encoding Schema file.

Removing the attribute from the XML allows parsing subsequently - I'm  
sure there's something basic that I'm missing here - any pointers?

Thank you!
-lev

---------------------------------------------------------------------
To unsubscribe, e-mail: p-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: p-dev-help@xerces.apache.org


Re: parsing SOAP server response

Posted by Lev Lvovsky <li...@sonous.com>.
Boris,

On May 12, 2008, at 6:48 AM, Boris Kolpackov wrote:
>
> Let's look at the Envelope type in soap-envelope.xsd:
>
>  <xs:complexType name="Envelope" >
>    <xs:sequence>
>      <xs:element ref="tns:Header" minOccurs="0" />
>      <xs:element ref="tns:Body" minOccurs="1" />
>      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"  
> processContents="lax" />
>    </xs:sequence>
>    <xs:anyAttribute namespace="##other" processContents="lax" />
>  </xs:complexType>
>
> As you can see, this type allows any attributes as long as they are
> from a namespace other than the target namespace. encodingStyle is
> from the target namespace.
>
> This schema file appears to be a modified version of the one published
> by W3C at:
>
> http://www.w3.org/2001/06/soap-envelope
>
> It seems that the changes that were made (e.g., make encodingStyle
> global) broke things.

Thank you for the insight, I figured something must have been broken  
between the various versions of the Schema.

-lev



Re: parsing SOAP server response

Posted by Boris Kolpackov <bo...@codesynthesis.com>.
Hi Lev,

Lev Lvovsky <li...@sonous.com> writes:

> ---
> <?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-
> ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema "
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-
> ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>...
> ---
>
> I grabbed the Schema file for the envelope here from
> http://schemas.xmlsoap.org/soap/encoding/ (BTW, how can I tell Xerces to
>  get '/' if there is no actual server  file name associated with a URL?),
> named it 'soap-envelope.xsd', and  setExternalSchemaLocation() to be
> 'http://schemas.xmlsoap.org/soap/envelope/ soap-envelope.xsd'.
>
> Upon parsing the response, I get a validation error:
>
> Attribute '{http://schemas.xmlsoap.org/soap/envelope/}encodingStyle'
> is not declared for element 'Envelope'.

Let's look at the Envelope type in soap-envelope.xsd:

  <xs:complexType name="Envelope" >
    <xs:sequence>
      <xs:element ref="tns:Header" minOccurs="0" />
      <xs:element ref="tns:Body" minOccurs="1" />
      <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax" />
    </xs:sequence>
    <xs:anyAttribute namespace="##other" processContents="lax" />
  </xs:complexType>

As you can see, this type allows any attributes as long as they are
from a namespace other than the target namespace. encodingStyle is
from the target namespace.

This schema file appears to be a modified version of the one published
by W3C at:

http://www.w3.org/2001/06/soap-envelope

It seems that the changes that were made (e.g., make encodingStyle
global) broke things.

Boris

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

parsing SOAP server response

Posted by Lev Lvovsky <li...@sonous.com>.
(sorry for any cross-posting)

I'm attempting to parse a SOAP response with Xerces, and things are  
looking fine but for the encodingStyle attribute of the 'Envelope'  
element.

The beginning of a SOAP envelope is something like this:

---
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP- 
ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"  
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema 
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP- 
ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body>...
---

I grabbed the Schema file for the envelope here from http://schemas.xmlsoap.org/soap/encoding/ 
  (BTW, how can I tell Xerces to get '/' if there is no actual server  
file name associated with a URL?), named it 'soap-envelope.xsd', and  
setExternalSchemaLocation() to be 'http://schemas.xmlsoap.org/soap/envelope/ 
  soap-envelope.xsd'.

Upon parsing the response, I get a validation error:

Attribute '{http://schemas.xmlsoap.org/soap/envelope/}encodingStyle'  
is not declared for element 'Envelope'.

If I add the 'http://schemas.xmlsoap.org/soap/encoding/ soap- 
encoding.xsd' string to the setExternalSchemaLocation call, it  
complains upon parsing the encoding Schema file.

Removing the attribute from the XML allows parsing subsequently - I'm  
sure there's something basic that I'm missing here - any pointers?

Thank you!
-lev