Jump to content

SOAP - How to get access to SoapVar object


Recommended Posts



I can send SoapVar from my client to my server and from my server to my client - it works ok. The SOAP requests and responses seem to be ok. Everything is ok, until i try make it more "dynamic". How can I access to "Identifier" and "Status"  ? Below is the code for client and server.


Thanks for your time!

header('Content-type: application/xml');
   $sClient = new SoapClient('mywsdl.wsdl', array('trace'=>1));
   $Identifier = "123456";
   $Status = "Hey, how are you today?";

   $part_request = array();
   $part_request[] = new SoapVar($Identifier,XSD_STRING,NULL,NULL,"Identifier");
   $part_request[] = new SoapVar($Status,XSD_STRING,NULL,NULL,"Status");
   $request = new SoapVar($part_request, SOAP_ENC_OBJECT, NULL, NULL,"RegisterRequest");
   $response = $sClient->Register($request);
   print_r ($sClient->__getLastRequest());
   print_r ($sClient->__getLastResponse());
} catch(SoapFault $e){


  1. <?php
    $server = new SoapServer("wsdl.wsdl");
    function Register($request)
    /*	How to access to "Identifier and Status?" 
    $request->Identifier or $request->RegisterRequest->Identifier dont work ;/  */
            /* BELOW THIS EVERYTHING WORKS, but it's static */
    	$ResponseId = "1234";
            $Status = "Fine";
    	$part_response = array();
    	$part_response[] = new SoapVar($ResponseId,XSD_STRING,NULL,NULL,"ResponseId");
    	$part_response[] = new SoapVar($Status,XSD_STRING,NULL,NULL,"Status");
    	$response = new SoapVar($part_response,SOAP_ENC_OBJECT,NULL,NULL,"RegistrationResponse");
      return $response;



Link to comment
Share on other sites

I can't do like this - my WSDL file orders me to have one object as input. When i try yours idea,  I've got this SOAP fault:

Error, cannott find parameter

Here is function prototype:

RegisterResponse Register(Register $parameters)
Edited by immortallch
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.