How to define a SoapVar namespace?

前端 未结 3 1707
情话喂你
情话喂你 2021-02-14 10:14

I need to have this node in my SOAP Request (using 1.1):

ricky@e         


        
3条回答
  •  我寻月下人不归
    2021-02-14 10:41

    I had the same problem and found out that if you map a dummy class to the credential complex type from your WSDL, PHP will output something like:

    
    
        
            
                ricky@email.net
                password
            
        
        
            
        
    
    

    This is not exactly what was requested but although more verbose, it is equivalent.

    The code goes like this:

    $client = new SoapClient("https://exdev.www.example.com/Services/example.asmx?WSDL", 
        array(
            "trace"         => 1,
            "exceptions"    => 0,
            "cache_wsdl"    => 0,
            "soap_version"  => SOAP_1_1,
            "classmap"      => array(
                'credential_complex_type'   => 'CredentialObject',
            ),
        )
    );
    
    class CredentialObject {}
    
    $credentialObject = new CredentialObject();
    $credentialObject->Email = 'ricky@email.net';
    $credentialObject->Password = 'password';
    

提交回复
热议问题