axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dushshantha Chandradasa (JIRA)" <axis-c-...@ws.apache.org>
Subject [jira] Commented: (AXISCPP-843) Serialiser is using namespaces without first assigning them in the XML
Date Fri, 28 Oct 2005 05:03:57 GMT
    [ http://issues.apache.org/jira/browse/AXISCPP-843?page=comments#action_12356171 ] 

Dushshantha Chandradasa commented on AXISCPP-843:
-------------------------------------------------

Hi All,

Above problem can be avoided by including the namespace definition in serialization code of
 the particular type. The following change will be doing this.

int Axis_Serialize_SampleBean(SampleBean* param, IWrapperSoapSerializer* pSZ, bool bArray
= false)
{
	if ( param == NULL )
	{
	 /* TODO : may need to check nillable value - Now done*/
		pSZ->serializeAsAttribute( "xsi:nil", 0, (void*)&(xsd_boolean_true), XSD_BOOLEAN);
		pSZ->serialize( ">", NULL);
		return AXIS_SUCCESS;
	}

	/* first serialize attributes if any*/
	pSZ->serialize( " xmlns:", pSZ->getNamespacePrefix("SimpleType"), "=\"",
                       "SimpleType\" ",
                               " >", 0);   <------------------------------------------------------------------------Namespace
of the type is defined here. 

	/* then serialize elements if any*/
...
}

This change will define the namespace of a complex type in every time it serializes. The good
thing of this is that, we can have different elements which are using different namespaces
in a single type. The bad thing is that, when we use the same namespace for different types,
it will define the namespace over and over again using different prefixes. 

Please provide some ideas...

> 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
>   Components: WSDL processing - Doc
>     Versions: 1.5 Final
>  Environment: n/a
>     Reporter: Fred Preston
>     Assignee: Dushshantha Chandradasa
>     Priority: Blocker
>      Fix For: 1.6 Alpha

>
> 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


Mime
View raw message