You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Richard Schrauwen <r_...@hotmail.com> on 2005/07/15 14:23:53 UTC

org.xml.sax.SAXException: Invalid element problem

Hi,

I'm using axis 1.2 to create a web service client based on a WSDL file. The 
WSDL is from an external .net system and I have created the java stubs for 
it. Now I have this problem that the 'GetTreeResponseGetTreeResult' response 
the server gives me for a 'GetTree' soap call cannot be deserialised because 
of a 'schema' element? I saw some similar problems on this list, but not 
quite the same as this....

This is the axis fault I get and below is the wsdl part and soap response. I 
hope anyone has a clue about what's wrong here.

thanks,
Richard

* AxisFault:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Invalid element in 
com.ericsson.sicc.drgelementmanager.GetTreeResponseGetTreeResult - schema
faultActor:
faultNode:
faultDetail:
        {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException: 
Invalid element in 
com.ericsson.sicc.drgelementmanager.GetTreeResponseGetTreeResult - schema
        at 
org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:255)
        at 
org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
        at 
org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
        at 
org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
        at 
org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)


* wsdl extract:
<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by John 
(42networks) -->
<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:i1="http://www.tempuri.org/NodeContents.xsd" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:s0="http://42Networks.com/cpe/DRGMgr" 
xmlns:i5="http://tempuri.org/AutoUpgrade.xsd" 
xmlns:i4="http://www.tempuri.org/Templates.xsd" 
xmlns:i3="http://www.tempuri.org/Element.xsd" 
xmlns:i2="http://tempuri.org/NewElement.xsd" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:i0="http://www.tempuri.org/Node.xsd" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns="http://schemas.xmlsoap.org/wsdl/" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://42Networks.com/cpe/DRGMgr">
<types>
  <s:schema elementFormDefault="qualified" 
targetNamespace="http://42Networks.com/cpe/DRGMgr">
   <s:import namespace="http://www.w3.org/2001/XMLSchema"/>
   <s:element name="GetTree">
    <s:complexType/>
   </s:element>
   <s:element name="GetTreeResponse">
    <s:complexType>
     <s:sequence>
      <s:element minOccurs="0" maxOccurs="1" name="GetTreeResult">
       <s:complexType>
        <s:sequence>
         <xs:element name="Node">
          <xs:complexType>
           <xs:choice maxOccurs="unbounded">
            <xs:element name="TreeTblNode">
             <xs:complexType>
              <xs:sequence>
               <xs:element name="ID" type="xs:int"/>
               <xs:element name="ParentID" type="xs:int" minOccurs="0"/>
               <xs:element name="Name" type="xs:string" minOccurs="0"/>
              </xs:sequence>
             </xs:complexType>
            </xs:element>
           </xs:choice>
          </xs:complexType>
         </xs:element>
        </s:sequence>
       </s:complexType>
      </s:element>
     </s:sequence>
    </s:complexType>
   </s:element>
.....

* SOAPResponse:
HTTP/1.1	200 OK
Server: Microsoft-IIS/5.0
Date:	Thu, 14 Jul	2005 11:59:50 GMT
X-Powered-By: ASP.NET
X-AspNet-Version:	1.1.4322
Cache-Control:	private,	max-age=0
Content-Type: text/xml;	charset=utf-8
Content-Length: 1682

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetTreeResponse xmlns="http://42Networks.com/cpe/DRGMgr">
  <GetTreeResult>
   <xs:schema id="Node" targetNamespace="http://www.tempuri.org/Node.xsd" 
xmlns:mstns="http://www.tempuri.org/Node.xsd" 
xmlns="http://www.tempuri.org/Node.xsd" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" 
attributeFormDefault="qualified" elementFormDefault="qualified">
    <xs:element name="Node" msdata:IsDataSet="true" msdata:Locale="sv-SE">
     <xs:complexType>
      <xs:choice maxOccurs="unbounded">
       <xs:element name="TreeTblNode">
        <xs:complexType>
         <xs:sequence>
          <xs:element name="ID" msdata:AutoIncrement="true" type="xs:int" />
          <xs:element name="ParentID" type="xs:int" minOccurs="0" />
          <xs:element name="Name" type="xs:string" minOccurs="0" />
         </xs:sequence>
        </xs:complexType>
       </xs:element>
      </xs:choice>
     </xs:complexType>
     <xs:unique name="NodeKey1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:TreeTblNode" />
      <xs:field xpath="mstns:ID" />
     </xs:unique>
    </xs:element>
   </xs:schema>
   <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" 
xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
    <node xmlns="http://www.tempuri.org/Node.xsd">
     <TreeTblNode diffgr:id="TreeTblNode1" msdata:rowOrder="0">
      <ID>1</ID>
      <Name>Root</Name>
     </TreeTblNode>
     <TreeTblNode diffgr:id="TreeTblNode2" msdata:rowOrder="1">
      <ID>2</ID>
      <ParentID>1</ParentID>
      <Name>Test</Name>
     </TreeTblNode>
    </Node>
   </diffgr:diffgram>
  </GetTreeResult>
</GetTreeResponse>
</soap:Body>
</soap:Envelope>



Re: org.xml.sax.SAXException: Invalid element problem

Posted by Anne Thomas Manes <at...@gmail.com>.
The response message doesn't conform to the WSDL. The WSDL doesn't
mention the <xs:schema> or <diffgr:diffgram> elements that are
included in the response message. Note, also, that the remainder of
the response message doesn't conform either to the WSDL or the
embedded schema, because both tell you to expect a node called <Node>,
but it in fact returns a node called <node>. (XML is case sensitive.)

The service is trying to return a .NET DataSet, which is a no-no for
interoperability.

You need to go back to your external service provider and ask them to
provide you with a WSDL that actually describes the expected response
message. You might also tell them that their service should not return
a .NET DataSet, and that the DataSet should be converted into a simple
array. If they won't change the service for you, you will probably
need to process the response message programmatically.

Anne

On 7/15/05, Richard Schrauwen <r_...@hotmail.com> wrote:
> Hi,
> 
> I'm using axis 1.2 to create a web service client based on a WSDL file. The
> WSDL is from an external .net system and I have created the java stubs for
> it. Now I have this problem that the 'GetTreeResponseGetTreeResult' response
> the server gives me for a 'GetTree' soap call cannot be deserialised because
> of a 'schema' element? I saw some similar problems on this list, but not
> quite the same as this....
> 
> This is the axis fault I get and below is the wsdl part and soap response. I
> hope anyone has a clue about what's wrong here.
> 
> thanks,
> Richard
> 
> * AxisFault:
> AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
> faultSubcode:
> faultString: org.xml.sax.SAXException: Invalid element in
> com.ericsson.sicc.drgelementmanager.GetTreeResponseGetTreeResult - schema
> faultActor:
> faultNode:
> faultDetail:
>         {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXException:
> Invalid element in
> com.ericsson.sicc.drgelementmanager.GetTreeResponseGetTreeResult - schema
>         at
> org.apache.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:255)
>         at
> org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
>         at
> org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
>         at
> org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1140)
>         at
> org.apache.axis.message.RPCElement.deserialize(RPCElement.java:345)
> 
> 
> * wsdl extract:
> <?xml version="1.0" encoding="utf-8"?>
> <!-- edited with XMLSpy v2005 rel. 3 U (http://www.altova.com) by John
> (42networks) -->
> <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:i1="http://www.tempuri.org/NodeContents.xsd"
> xmlns:s="http://www.w3.org/2001/XMLSchema"
> xmlns:s0="http://42Networks.com/cpe/DRGMgr"
> xmlns:i5="http://tempuri.org/AutoUpgrade.xsd"
> xmlns:i4="http://www.tempuri.org/Templates.xsd"
> xmlns:i3="http://www.tempuri.org/Element.xsd"
> xmlns:i2="http://tempuri.org/NewElement.xsd"
> xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:i0="http://www.tempuri.org/Node.xsd"
> xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
> xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://42Networks.com/cpe/DRGMgr">
> <types>
>   <s:schema elementFormDefault="qualified"
> targetNamespace="http://42Networks.com/cpe/DRGMgr">
>    <s:import namespace="http://www.w3.org/2001/XMLSchema"/>
>    <s:element name="GetTree">
>     <s:complexType/>
>    </s:element>
>    <s:element name="GetTreeResponse">
>     <s:complexType>
>      <s:sequence>
>       <s:element minOccurs="0" maxOccurs="1" name="GetTreeResult">
>        <s:complexType>
>         <s:sequence>
>          <xs:element name="Node">
>           <xs:complexType>
>            <xs:choice maxOccurs="unbounded">
>             <xs:element name="TreeTblNode">
>              <xs:complexType>
>               <xs:sequence>
>                <xs:element name="ID" type="xs:int"/>
>                <xs:element name="ParentID" type="xs:int" minOccurs="0"/>
>                <xs:element name="Name" type="xs:string" minOccurs="0"/>
>               </xs:sequence>
>              </xs:complexType>
>             </xs:element>
>            </xs:choice>
>           </xs:complexType>
>          </xs:element>
>         </s:sequence>
>        </s:complexType>
>       </s:element>
>      </s:sequence>
>     </s:complexType>
>    </s:element>
> .....
> 
> * SOAPResponse:
> HTTP/1.1        200 OK
> Server: Microsoft-IIS/5.0
> Date:   Thu, 14 Jul     2005 11:59:50 GMT
> X-Powered-By: ASP.NET
> X-AspNet-Version:       1.1.4322
> Cache-Control:  private,        max-age=0
> Content-Type: text/xml; charset=utf-8
> Content-Length: 1682
> 
> <?xml version="1.0" encoding="utf-8" ?>
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <soap:Body>
> <GetTreeResponse xmlns="http://42Networks.com/cpe/DRGMgr">
>   <GetTreeResult>
>    <xs:schema id="Node" targetNamespace="http://www.tempuri.org/Node.xsd"
> xmlns:mstns="http://www.tempuri.org/Node.xsd"
> xmlns="http://www.tempuri.org/Node.xsd"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
> attributeFormDefault="qualified" elementFormDefault="qualified">
>     <xs:element name="Node" msdata:IsDataSet="true" msdata:Locale="sv-SE">
>      <xs:complexType>
>       <xs:choice maxOccurs="unbounded">
>        <xs:element name="TreeTblNode">
>         <xs:complexType>
>          <xs:sequence>
>           <xs:element name="ID" msdata:AutoIncrement="true" type="xs:int" />
>           <xs:element name="ParentID" type="xs:int" minOccurs="0" />
>           <xs:element name="Name" type="xs:string" minOccurs="0" />
>          </xs:sequence>
>         </xs:complexType>
>        </xs:element>
>       </xs:choice>
>      </xs:complexType>
>      <xs:unique name="NodeKey1" msdata:PrimaryKey="true">
>       <xs:selector xpath=".//mstns:TreeTblNode" />
>       <xs:field xpath="mstns:ID" />
>      </xs:unique>
>     </xs:element>
>    </xs:schema>
>    <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
> xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
>     <node xmlns="http://www.tempuri.org/Node.xsd">
>      <TreeTblNode diffgr:id="TreeTblNode1" msdata:rowOrder="0">
>       <ID>1</ID>
>       <Name>Root</Name>
>      </TreeTblNode>
>      <TreeTblNode diffgr:id="TreeTblNode2" msdata:rowOrder="1">
>       <ID>2</ID>
>       <ParentID>1</ParentID>
>       <Name>Test</Name>
>      </TreeTblNode>
>     </Node>
>    </diffgr:diffgram>
>   </GetTreeResult>
> </GetTreeResponse>
> </soap:Body>
> </soap:Envelope>
> 
> 
>