Jump to content

Recommended Posts

Hi,

 

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!

<?php
header('Content-type: application/xml');
try{
   $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){
   var_dump($e);
}
?>

 

  1. <?php
    //ini_set("soap.wsdl_cache_enabled","0");
    $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;
    }
    
    $server->AddFunction("Register");
    $server->handle();
    ?>
    
    

     

     

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
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.

Guest
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.