[
http://issues.apache.org/jira/browse/AXISCPP-843?page=comments#action_12331122
]
Samisa Abeysinghe commented on AXISCPP-843:
-------------------------------------------
As far as my understanding goes, this problem comes from the serializer. It is
the serializer that constructs the namespace prefixes starting with 'ns1' in
sequence (ns1, ns2, ...., nsn)
For e.g see code below:
const AxisChar * SoapSerializer::getNamespacePrefix( const AxisChar *
pNamespace)
{
if( m_NsStack.find( pNamespace) == m_NsStack.end())
{
m_nCounter++;
AxisSprintf(m_Buf, 8, "ns%d", m_nCounter);
m_NsStack[pNamespace] = m_Buf;
}
return m_NsStack[pNamespace].c_str();
}
Hence if the namespace is defined as 'xmlns:ns99="SimpleType"' and referenced
as 'type="ns99:SampleBean"' it still would have been defined as ns2.
Hence, we would have to revisit the namespace handling mechanism here. See how
the serializer handles the namespaces and prefixes and how it maps this with
the generated code as it is the generated code that has knowlege on what
namespaces have been defined in the WSDL and XSDs imported.
To myknowlege there is no validation of the mapping between namespaces and
prefixes in the serializer. Also we cannot set a prefix to a namespace in
serializer. We do not have a SoapSerializer::setNamespacePrefix
> 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