Consuming a .net web service (.net 2.0), created a stub using
WSDL2Java (axis2 1.0).  Part of the data returned uses attributes.
Relevant schema looks like:

<xs:complexType name="NameValueType">
   <xs:attribute name="Name" type="xs:string" use="required"/>
   <xs:attribute name="Value" type="xs:string" use="required"/>
 </xs:complexType>

Data returned looks good:

<Report Name="name" Value="value" />

The Problem: Examining the stub generated code, it looks like the stub
checks and gets the attributes but then looks for "Name" and "Value"
elements, too.  Since they are not there the stub throws a "Unexpected
subelement" error.

If I simply comment out the section of code that is looking for the
"Name" and "Value" elements, everything works fine.

Any suggestions on avoiding this problem?  The schema doesn't seem to
indicate that a element should be expected, why does the stub look for
one?  Thanks in advance!

[Full WSDL and XML Schemas to follow]

---------------------------------------WSDL-------------------------------------------------
<!--WSDL generated by thinktecture WSCF; version 0.6.6034.1-->
<!--Wednesday, 05-07-2006 - 03:28 PM-->
<definitions xmlns:tns="urn:service:v1"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:import1="urn:data:v1" xmlns:import0="urn:messages:v1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
name="ReportExpertService" targetNamespace="urn:service:v1"
xmlns="http://schemas.xmlsoap.org/wsdl/";>
 <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; />
 <types>
   <xsd:schema>
     <xsd:import schemaLocation="RXMessages.xsd" namespace="urn:messages:v1" />
     <xsd:import schemaLocation="RXReportFactors.xsd"
namespace="urn:data:v1" />
   </xsd:schema>
 </types>
 <message name="getReportFactorsIn">
   <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; />
   <part name="messagePart" element="import0:getReportFactors" />
 </message>
 <message name="getReportFactorsOut">
   <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; />
   <part name="messagePart" element="import0:getReportFactorsResponse" />
 </message>
 <portType name="ReportExpertServiceInterface">
   <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; />
   <operation name="getReportFactors">
     <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; />
     <input message="tns:getReportFactorsIn" />
     <output message="tns:getReportFactorsOut" />
   </operation>
 </portType>
 <binding name="ReportExpertService" type="tns:ReportExpertServiceInterface">
   <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; />
   <operation name="getReportFactors">
     <soap:operation soapAction="urn:service:v1:getReportFactorsIn"
style="document" />
     <input>
       <soap:body use="literal" />
     </input>
     <output>
       <soap:body use="literal" />
     </output>
   </operation>
 </binding>
 <service name="ReportExpertServicePort">
   <port name="ReportExpertServicePort" binding="tns:ReportExpertService">
     <soap:address location="" />
   </port>
 </service>
</definitions>
--------------------------RXReportFactors.xsd---------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="RXReportFactors"
         targetNamespace="urn:data:v1"
         elementFormDefault="qualified"
         attributeFormDefault="qualified"
         xmlns="urn:data:v1"
         xmlns:mstns="urn:data:v1"
         xmlns:xs="http://www.w3.org/2001/XMLSchema";>

 <xs:complexType name="RXReportFactors">
   <xs:sequence>
     <xs:element name="Server" type="xs:string" />
     <xs:element name="ReportNames" type="ReportType" />
     <xs:element name="ParameterSets" type="ParameterSetType" />
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="ReportType">
   <xs:sequence>
     <xs:element name="Report" type="NameValueType" maxOccurs="unbounded" />
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="ParameterSetType">
   <xs:sequence>
     <xs:element name="ParameterSet" type="NameValueType"
maxOccurs="unbounded" />
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="NameValueType">
   <xs:attribute name="Name" type="xs:string" use="required"/>
   <xs:attribute name="Value" type="xs:string" use="required"/>
 </xs:complexType>
</xs:schema>
------------------------------RXMessages.xsd--------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="RXMessages" targetNamespace="urn:messages:v1"
           elementFormDefault="qualified"
           attributeFormDefault="qualified"
           xmlns="urn:messages:v1"
           xmlns:mstns="urn:messages:v1"
           xmlns:xs="http://www.w3.org/2001/XMLSchema";
           xmlns:importns="urn:data:v1">
 <xs:import id="RXReportFactorsData"
schemaLocation="RXReportFactors.xsd" namespace="urn:data:v1" />
 <xs:element name="getReportFactors">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="search" type="xs:string" />
     </xs:sequence>
   </xs:complexType>
   </xs:element>
 <xs:element name="getReportFactorsResponse">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="factors" type="importns:RXReportFactors">
       </xs:element>
     </xs:sequence>
   </xs:complexType>
 </xs:element>
</xs:schema>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to