axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tao Yang <ty...@simdesk.com>
Subject AxisC++ 1.5 fail retrieve string arrays in SOAP message?
Date Tue, 21 Feb 2006 19:02:17 GMT
Hi,

Again with my Axis C++ 1.5 client running against the Axis JAVA 1.3 
server experiment:
I have a webservice has interface : String[] search(String getIgnored)
the java client handle it perfectly by the way.

My c++ client is a bit funky though. The stub generated has following 
code (I add some
debuging output):
xsd__string_Array Search::search(xsd__string Value0)
{
    xsd__string_Array RetArray = {NULL, 0};
    const char* pcCmplxFaultName;
    try
    {
        if (AXIS_SUCCESS != m_pCall->initialize(CPP_RPC_PROVIDER))
            return RetArray;
    if (NULL==m_pCall->getTransportProperty("SOAPAction",false))
    {
        m_pCall->setTransportProperty(SOAPACTION_HEADER , "");
    }
        m_pCall->setSOAPVersion(SOAP_VER_1_1);
        m_pCall->setOperation("search", "http://ws.search.simdesk.com");
        applyUserPreferences();
        m_pCall->addParameter((void*)Value0, "criteria", XSD_STRING);
        if (AXIS_SUCCESS == m_pCall->invoke())
        {
            if(AXIS_SUCCESS == m_pCall->checkMessage("searchResponse", 
"http://ws.search.simdesk.com"))
            {
                // tyang changed following line - it complains about 
type conversion is invalid
                //RetArray = 
(xsd__string_Array&)m_pCall->getBasicArray(XSD_STRING, "searchReturn", 0);
                Axis_Array arr = m_pCall->getBasicArray(XSD_STRING, 
"searchReturn", 0);
                xsd__string_Array sarr = { (xsd__string *) arr.m_Array, 
arr.m_Size };
                RetArray.m_Array = (xsd__string *) arr.m_Array;
                RetArray.m_Size = arr.m_Size;
                std::cout << "result.size = " << RetArray.m_Size << endl;
                std::cout << "result: ";
                for (int i = 0; i < RetArray.m_Size; i++)
                {
                    std::cout << RetArray.m_Array[i] << "; 
";                std::cout << endl;
            }
        }
    m_pCall->unInitialize();
        return RetArray;
    }
    catch(AxisException& e)
    {
        int iExceptionCode = e.getExceptionCode();
        if(AXISC_NODE_VALUE_MISMATCH_EXCEPTION != iExceptionCode)
        {
            throw SoapFaultException(e);
        }
        ISoapFault* pSoapFault = (ISoapFault*)
            
m_pCall->checkFault("Fault","http://172.16.53.33:8080/simdesk/services/Search" 
);
        if(pSoapFault)
        {
            m_pCall->unInitialize();
            throw SoapFaultException(e);
        }
        else throw;
    }
}

Plus, the SOAPMonitor reporting following request:
<?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:search xmlns:ns1="http://ws.search.simdesk.com">
      <criteria xsi:type="xsd:string">asdr</criteria>
    </ns1:search>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

And following response:<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
    <ns1:searchResponse 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:ns1="http://ws.search.simdesk.com">
      <searchReturn soapenc:arrayType="soapenc:string[6]" 
xsi:type="soapenc:Array" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
        <searchReturn xsi:type="soapenc:string">eqre.pdf</searchReturn>
        <searchReturn xsi:type="soapenc:string">another.txt</searchReturn>
        <searchReturn xsi:type="soapenc:string"></searchReturn>
        <searchReturn xsi:type="soapenc:string">~/blah.h</searchReturn>
        <searchReturn xsi:type="soapenc:string">asdf</searchReturn>
        <searchReturn xsi:type="soapenc:string" xsi:nil="true"/>
      </searchReturn>
    </ns1:searchResponse>
  </soapenv:Body>
</soapenv:Envelope>

What have I done wrong? :-(

Thanks for any help or advice in advance!
Tao



Mime
View raw message