[
http://issues.apache.org/jira/browse/AXISCPP-843?page=comments#action_12356055
]
Dushshantha Chandradasa commented on AXISCPP-843:
-------------------------------------------------
when serializing a complex parameter, the namespace is not set in the
SoapSerializer::addOutputCmplxParam method. And also Param::serialize method
doent use this namespace value to set to assing the namespace. We can can fix
this by making the following changes to above mensioned methods.
int SoapSerializer::addOutputCmplxParam( void * pObject,
void * pSZFunct,
void * pDelFunct,
const AxisChar * pName,
const AxisChar * pNamespace)
{
int iSuccess = AXIS_SUCCESS;
Param * pParam = new Param();
pParam->m_Value.pCplxObj = new ComplexObjectHandler;
pParam->m_Value.pCplxObj->pObject = pObject;
pParam->m_Value.pCplxObj->pSZFunct = (AXIS_SERIALIZE_FUNCT) pSZFunct;
pParam->m_Value.pCplxObj->pDelFunct = (AXIS_OBJECT_DELETE_FUNCT) pDelFunct;
pParam->m_Value.pCplxObj->m_URI = pNamespace;
<--------------------------------------------------setting the namespace
if( m_pSoapEnvelope &&
(m_pSoapEnvelope->m_pSoapBody) &&
(m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod))
{
m_pSoapEnvelope->m_pSoapBody->m_pSoapMethod->addOutputParam( pParam);
}
pParam->setURI(pNamespace);
pParam->setName( pName);
return iSuccess; // Can it only be successful?
}
int Param::serialize (SoapSerializer &pSZ)
{
.......
case USER_TYPE:
if (RPC_ENCODED == pSZ.getStyle ())
{
TRACE_SERIALIZE_FUNCT_ENTRY(m_Value.pCplxObj->pSZFunct,
m_Value.pCplxObj->pObject, &pSZ, false);
int stat = AXIS_FAIL;
stat = m_Value.pCplxObj->pSZFunct (m_Value.pCplxObj->pObject,
&pSZ, false);
TRACE_SERIALIZE_FUNCT_EXIT(m_Value.pCplxObj->pSZFunct, stat);
}
else
{
ATprefix =
pSZ.getNamespacePrefix (m_Value.pArray->m_URI.c_str ());
pSZ.serialize ("<", m_sName.c_str ()," xmlns:", ATprefix.c_str
(), "=\"",
m_Value.pCplxObj->m_URI.c_str (), "\" ", NULL);
<-------------------------------------- namespace is
defined
.....
}
This changes lead us to get the following request message.
POST /axis/NamespaceTest HTTP/1.1
Host: localhost:8080
Content-Type: text/xml; charset=UTF-8
SOAPAction: ""
Content-Length: 693
<?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:anElement xmlns:ns1="SimpleNonBaseType">
<Element xmlns:ns2="SimpleType" ><ns3:Time
xsi:nil="true"></ns3:Time><ns3:Boolean>false</ns3:Boolean>
<ns3:Byte>0</ns3:Byte>
<ns3:Calendar xsi:nil="true"></ns3:Calendar>
<ns3:Double>0.000000</ns3:Double>
<ns3:Float>0.000000</ns3:Float>
<ns3:Int>0</ns3:Int>
<ns3:Long>0</ns3:Long>
<ns3:Short>0</ns3:Short>
<ns3:String xsi:nil="true"></ns3:String>
</Element>
</ns1:anElement>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Now, the namespace for Elemint is defined as ns2. But when we serialize the
complex element with same namespace, SoapSerializer::getNamespacePrefix gives
the prefix for the namespace as ns3. That means
SoapSerializer::getNamespacePrefix doest identify "SimpleType" as a predefined
namespace.
> 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