Structure of Server responce in NuSoap

Anonymous
2011-06-11
2013-06-06

  • Anonymous
    2011-06-11

    Hi,

    I need that response from NuSoap server will be look as:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Body>
          <GetBARSpecificReferenceDataResponse xmlns="http://www.someone.eu/">
             <GetBARSpecificReferenceDataResult>
                <string>ABERDEEN</string>
                <string>ABOYNE</string>
                <string>AIRDRIE</string>
                <string>ALEXANDRIA</string>
             </GetBARSpecificReferenceDataResult>
          </GetBARSpecificReferenceDataResponse>
       </soap:Body>
    </soap:Envelope>


    But my the response look still as:


    <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" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
       <SOAP-ENV:Body>
          <GetBARSpecificReferenceDataResponse xmlns="http://www.someone.eu/">
             <return>
                <GetBARSpecificReferenceDataResult>
                   <item>ABERDEEN</item>
                   <item>ABOYNE</item>
                   <item>AIRDRIE</item>
                   <item>ALEXANDRIA</item>
                </GetBARSpecificReferenceDataResult>
             </return>
          </GetBARSpecificReferenceDataResponse>
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>


    Code of my server is:

    require_once("lib/nusoap.php");
    $adresaServeru='www.someone.eu/';
    mb_internal_encoding("utf-8");
    $ns="http://$adresaServeru";
    $server = new soap_server();
    $server->configureWSDL("BARProviderQuery", "http://$adresaServeru", '', 'document');
    $server->wsdl->schemaTargetNamespace = "http://$adresaServeru";
    $server->decode_utf8 = true;
    $server->soap_defencoding = 'utf-8';
    $server->wsdl->addComplexType('GetBARSpecificReferenceDataResponse',
    'complexType',
    'struct',
    'sequence',
    '',
    array(
    'GetBARSpecificReferenceDataResult' => array('name' => 'string', 'type' => 'tns:ArrayOfString')
    ));
    $server->wsdl->addComplexType('ArrayOfString',
    'complexType',
    'array',
    'sequence',
    '',
    array(
    'string' => array('name' => 'string', 'type' => 'xsd:string')
    )
    );
    $server->wsdl->addSimpleType('ReferenceDataTypes',
    'xsd:string',
    'simpleType',
    'scalar',
    array('Unknown',
      'Countries',
      'PracticeArea'
    )
    );

    $server->register('GetBARSpecificReferenceData',
    array('BARProviderID' => 'xsd:string', 'refType' => 'tns:ReferenceDataTypes'), // input parameters
    array('return' => 'tns:GetBARSpecificReferenceDataResponse'),
    $ns, // namespace
        "$ns#GetBARSpecificReferenceData",    // soapaction
        'document',                              // style
        'literal',                          // use
        '' // documentation
    );

    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : "";
    $server->service($HTTP_RAW_POST_DATA);
    exit();

    function…..


    Can help me someone to correct server answer?
    First I need remove the <result> in answer and rename <item> to <string>

    Robert