unable to create attribute in soap request packet using nusoap lib in php

Discussion in 'PHP' started by macky_shak, Jun 20, 2012.

  1. #1
    Hi All,

    I am trying to consume a soap based web services using nusoap lib in php but i am not able to set attribute in request packet
    my request packet is

    <SOAP-ENV:Body>
    <MSI-MeT-Request xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:anyType[3]">
    <callback-endpoint-url xsi:type="xsd:string">http://abc.com/crs/test/callback_actualResponse.php</callback-endpoint-url>
    <response-email xsi:type="xsd:string">abc@gmail.com</response-email>
    <MSI>
    <MSI-package id="r5" xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:anyType[3]">
    <MSI-package-metadata>
    <version xsi:type="xsd:string">2.3</version>
    <version1 xsi:type="xsd:string">2.3</version1>
    <version2 xsi:type="xsd:string">2.3</version2>
    </MSI-package-metadata>
    </MSI-package>
    </MSI>
    </MSI-MeT-Request>
    </SOAP-ENV:Body>


    and my php code which is generating this request packet is as -
    require_once('lib/nusoap.php');
    $version = new soapval('version', 'version', '2.3', false, false);
    $version1 = new soapval('version1', 'version1', '2.3', false, false);
    $version2 = new soapval('version2', 'version2', '2.3', false, false);
    $v = array($version, $version1, $version2);
    
    $MSI_package_metadata = new soapval('MSI-package-metadata', 'MSI-package-metadata', $v, false, false);
    $MSI_package = new soapval('MSI-package', 'MSI-package', $MSI_package_metadata, false, false, array('id' => 'r5'));
    $MSI = new soapval('MSI', 'MSI', $MSI_package, false, false);
    
    $jobArray = array(
        new soapval('callback-endpoint-url', 'callback-endpoint-url', 'http://abc.com/crs/test/callback_actualResponse.php'),
        new soapval('response-email', 'response-email', 'abc@abc.com'),
        $CDES
        
        );
    
    $msg = new soapval('MSI-MeT-Request', 'MSI-MeT-Request', $jobArray, false, false);
    $xmlout = $msg->serialize();
    
    try {
    
        $client = new nusoap_client('https://abc.com:5502/msi/services/msi_ws?wsdl', 'WSDL');
        $client->setCredentials('xxx', 'xxx', 'basic');
        $result = $client->call('MSI-MeT-Request', $xmlout);
        
    } catch (Exception $e) {
    
        die($e->getMessage() . '<pre>' . $e->getTraceAsString() . '</pre>');
    }
                                      
    PHP:
    but i need to create this packet even i have try to pass structured object in my soap request eg . $reqObj = array('id' => array('test' => array().....))

    <SOAP-ENV:Body>
    <MSI-MeT-Request>
    <callback-endpoint-url">http://abc.com/crs/test/callback_actualResponse.php</callback-endpoint-url>
    <response-email>abc@gmail.com</response-email>
    <MSI>
    <MSI-package id="r5">
    <MSI-package-metadata>
    <version>2.3</version>
    <version1>2.3</version1>
    <version2>2.3</version2>
    </MSI-package-metadata>
    </MSI-package>
    </MSI>
    </MSI-MeT-Request>
    </SOAP-ENV:Body>



    Is there any suggestion to do this

    Please suggest me

    Thanks,
    Macky
     
    macky_shak, Jun 20, 2012 IP
  2. macky_shak

    macky_shak Peon

    Messages:
    8
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    any give me the suggestion ?
     
    macky_shak, Jun 21, 2012 IP