axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kraus, David" <dkr...@MicroStrategy.com>
Subject RE: ADBException: Unexpected subelement Code
Date Mon, 17 Sep 2007 16:50:59 GMT
Your schema namespace is V0.2, yet your client is prepending the V0
namespace to soap requests.

 

________________________________

From: Erwin Reinhoud [mailto:Erwin.Reinhoud@ictu.nl] 
Sent: Monday, September 17, 2007 12:43 AM
To: axis-user@ws.apache.org
Subject: ADBException: Unexpected subelement Code

 

Dear users,

 

I am using axis2 1.3 and an ant script to generate a service. However i
keep getting the "Unexpected subelement" exception as soon as i add for
example the "Metadata" element being a complex type (see additions
below). I renamed some stuff for this post so please disregard any
possible errors (the wsdl+schema is validated). I also added the"-uw"
argument to the wsdl2java but does not seem to help. The question is
what is wrong with the ant target or wsdl, assuming that the soapui
generated request is correct?

 

Thanks in advance.

Kind regards,

Erwin

 

Server response:

 

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <soapenv:Fault>
         <faultcode>soapenv:Server</faultcode>
         <faultstring>org.apache.axis2.databinding.ADBException:
Unexpected subelement Code2</faultstring>
         <detail/>
      </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>

 

 

 

SOAPUI request based on wsdl:

 

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/
<http://schemas.xmlsoap.org/soap/envelope/> " 
xmlns:v0="http://localhost/schemas/v0.2 <http://localhost/schemas/v0.2>
">
   <soapenv:Header/>
   <soapenv:Body>
      <v0:Send>
         <v0:Metadata>
            <v0:Code2 >?</v0:Code2  >
         </v0:Metadata>
         <!--Optional:-->
         <v0:Data>?</v0:Data>
      </v0:Send>
   </soapenv:Body>
</soape 

 

 

ANT WSDL2JAVA target:

 

 <target name="generate.service" depends="prepare.repo">
                 <java classname="org.apache.axis2.wsdl.WSDL2Java">
                        <arg value="-uri" />
                        <arg value="wsdl\DataService_v0.2.wsdl" />
                        <arg value="-ss" />
                        <arg value="-uw" />
                        <arg value="-sd" />
                          <arg value="-g"/>
                        <arg value="-p" />
                        <arg value="-o" />
                        <arg value="${gen.service.dir}" />
                        <classpath refid="axis2.class.path" />
                </java>
                
              
          </target>

 

 

 

 

The schema:

 

<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xmime="http://www.w3.org/2005/05/xmlmime" 
xmlns:tns="http://localhost/schemas/v0.2" 
targetNamespace="http://localhost/schemas/v0.2"
elementFormDefault="qualified">
<xsd:import namespace="http://www.w3.org/2005/05/xmlmime"
schemaLocation="xmlmime.xml"/> 
 

<xsd:element name="Send">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element name="Metadata" type="tns:Metadata"/>
    <xsd:element name="Data" type="xsd:string" minOccurs="0"/>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:element name="SendResponse">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element name="berichtUit" type="tns:Status" nillable="true"
minOccurs="0"/>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>
 <xsd:complexType name="Status">
  <xsd:sequence>
   <xsd:element name="Code" type="xsd:string"/>
   <xsd:element name="Melding" type="xsd:string" minOccurs="0"/>
  </xsd:sequence>
 </xsd:complexType>
  <xsd:complexType name="Metadata">
  <xsd:sequence>
   <xsd:element name="Code2" type="xsd:string"/>
 </xsd:sequence>
 </xsd:complexType>
 
 
 
 
</xsd:schema>


Mime
View raw message