You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Fred Preston (JIRA)" <ax...@ws.apache.org> on 2005/09/29 16:31:49 UTC

[jira] Commented: (AXISCPP-843) Serialiser is using namespaces without first assigning them in the XML

    [ http://issues.apache.org/jira/browse/AXISCPP-843?page=comments#action_12330808 ] 

Fred Preston commented on AXISCPP-843:
--------------------------------------

Q: Because the targetNamespace in the WSDL is set to SimpleNonBaseType, is everything assumed to be from that namespace?

The SampleBean type has a different namespace, 'SimpleType'.  But, also has some components that belong to SimpleNonBaseType.  Thus it is a hybrid of the two namespaces.  I assume that there could be any number of different namespaces used to make up a compound/complex type so these should be declared in the element that names the type in the XML (in this case '<Element>'?).  If this is so, then the Axis_Serialize_<type> stub method needs to include processing for any other namespace references that will be used within that type and add them as attribute declarations.  This is fine, as on entry, the method has an opportunity to add attributes before the closing element brace ('>').  Thus, <Element> would become <Element  xmlns:ns2="SimpleType">.

> Serialiser is using namespaces without first assigning them in the XML
> ----------------------------------------------------------------------
>
>          Key: AXISCPP-843
>          URL: http://issues.apache.org/jira/browse/AXISCPP-843
>      Project: Axis-C++
>         Type: Bug
>  Environment: n/a
>     Reporter: Fred Preston
>     Priority: Blocker

>
> I have the following xsd and wsdl files:-
> SimpleType.xml
> ----------------------
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsd:schema targetNamespace="SimpleType" xmlns:ns1="SimpleNonBaseType" xmlns:tns="SimpleType" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <xsd:import namespace="SimpleNonBaseType" schemaLocation="SimpleNonBaseType.xsd"/>
>  
>  <xsd:complexType name="SampleBean">
>   <xsd:sequence>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Time" nillable="true" type="ns1:TimeArray"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Boolean" nillable="false" type="xsd:boolean"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Byte" nillable="false" type="xsd:byte"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Calendar" nillable="true" type="xsd:dateTime"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Double" nillable="false" type="xsd:double"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Float" nillable="false" type="xsd:float"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Int" nillable="false" type="xsd:int"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Long" nillable="false" type="xsd:long"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Short" nillable="false" type="xsd:short"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="String" nillable="true" type="xsd:string"/>
>   </xsd:sequence>
>  </xsd:complexType>
>  
>  <xsd:complexType name="SampleBeanArray">
>   <xsd:sequence>
>    <xsd:element form="qualified" maxOccurs="unbounded" name="Array" nillable="true" type="tns:SampleBean"/>
>   </xsd:sequence>
>  </xsd:complexType>
> </xsd:schema>
> SimpleNonBaseType.xml
> -----------------------------------
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsd:schema targetNamespace="SimpleNonBaseType" xmlns:tns="SimpleNonBaseType"
>             xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>  <xsd:complexType name="Time">
>   <xsd:sequence>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Hours"   nillable="false" type="xsd:int"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Minutes" nillable="false" type="xsd:int"/>
>    <xsd:element form="qualified" maxOccurs="1" minOccurs="1" name="Seconds" nillable="false" type="xsd:int"/>
>   </xsd:sequence>
>  </xsd:complexType>
>  
>  <xsd:complexType name="TimeArray">
>   <xsd:sequence>
>    <xsd:element form="qualified" maxOccurs="unbounded" name="Time" nillable="true" type="tns:Time"/>
>   </xsd:sequence>
>  </xsd:complexType>
> </xsd:schema>
> SimpleService.wsdl
> ---------------------------
> <?xml version="1.0" encoding="UTF-8" ?>
> <definitions targetNamespace="SimpleNonBaseType" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="SimpleNonBaseType" xmlns:ns2="SimpleType" xmlns:ns3="Type2"                   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="SimpleNonBaseType" xmlns:wsi="http://ws-i.org/schemas/conformanceClaim/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="XMLSchema">
>  <types>
>   <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>   	<xsd:import namespace="SimpleType" schemaLocation="SimpleType.xsd"/>
>   	<xsd:import namespace="SimpleNonBaseType" schemaLocation="SimpleNonBaseType.xsd"/>
>    <xsd:element name="aBeanElement">
>     <xsd:complexType>
>      <xsd:sequence>
>       <xsd:element maxOccurs="1" minOccurs="1" name="aBean" nillable="true" type="ns2:SampleBean"/>
>      </xsd:sequence>
>     </xsd:complexType>
>    </xsd:element>
>   </xsd:schema>
>     </types>
>  <message name="aBeanInput">
>   <part name="parameters" type="ns2:SampleBeanArray"/>
>  </message>
>  <message name="bBeanInput">
>  	<part name="bBeanInput" element="tns:aBeanElement"/>
>  </message>
>  <portType name="TestServicePortType">
>   <operation name="aBeanPortType">
>    <input message="tns:bBeanInput"/>
>   </operation>
>  </portType>
>  <binding name="ServiceBinding" type="tns:TestServicePortType">
>   <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>   <operation name="aBeanPortType">
>    <soap:operation soapAction="" style="document"/>
>    <input>
>     <soap:body use="literal"/>
>    </input>
>   </operation>
>  </binding>
>   <service name="SimpleService">
>     <port binding="tns:ServiceBinding" name="ServiceBinding">
>       <soap:address location="http://tempuri.org" /> 
>     </port>
>   </service>
> </definitions>
> -----------------------------------------------------------------------------------------------------------------------
> When I build a stub using WSDL2Ws and then create a client as follows:-
> #include "TestServicePortType.hpp"
> void main()
> {
> 	TestServicePortType *	pWS = new TestServicePortType( "http://localhost:port/WebService", APTHTTP1_1);
> 	SampleBean	sSB;
> 	pWS->aBeanPortType( &sSB);
> 	delete pWS;
> }
> -----------------------------------------------------------------------------------------------------------------------
> The request message produced by the stub is as follows:-
> POST /AxisBench/services/AxisBenchSoapImpl HTTP/1.1
> Host: <localhost>:<port>
> Content-Type: text/xml; charset=UTF-8
> SOAPAction: ""
> Content-Length: 679
> <?xml version='1.0' encoding='utf-8' ?>
> <SOAP-ENV:Envelope 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">
> <SOAP-ENV:Body>
> <ns1:aBeanElement xmlns:ns1="SimpleNonBaseType">
> <aBean>
> <ns2:Time xsi:nil="true"></ns2:Time>
> <ns2:Boolean>false</ns2:Boolean>
> <ns2:Byte>0</ns2:Byte>
> <ns2:Calendar xsi:nil="true"></ns2:Calendar>
> <ns2:Double>0.000000</ns2:Double>
> <ns2:Float>0.000000</ns2:Float>
> <ns2:Int>0</ns2:Int>
> <ns2:Long>0</ns2:Long>
> <ns2:Short>0</ns2:Short>
> <ns2:String xsi:nil="true"></ns2:String>
> </aBean>
> </ns1:aBeanElement>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> -----------------------------------------------------------------------------------------------------------------------
> Notice how namespace, 'ns2' has been used without being defined!  There is obviously something wrong with either the generated stub code or the serialisation of the message...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira