Soap error

Folks,

I’m making a soap call to: http://api5.silverpop.com/SoapApi?wsdl

The xml soap request I’m trying to invoke is this:


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sil="SilverpopApi:EngageService.SessionMgmt.Login">
   <soapenv:Header/>
   <soapenv:Body>
      <sil:Login>
         <sil:USERNAME>?</sil:USERNAME>
         <sil:PASSWORD>?</sil:PASSWORD>
      </sil:Login>
   </soapenv:Body>
</soapenv:Envelope>

My php code:


public function loginRequest(){

$client = new SoapClient('http://api5.silverpop.com/SoapApi?wsdl', array("trace"=> 1));
	

$error = 0;
	

try {
           
$login = $client->__call('Login', array('USERNAME'=>'xxx', 'PASSWORD'=>'xxx'));


} catch (SoapFault $fault) {

$error = 1;

print('<pre>');
	
echo htmlentities($client->__getLastRequest());

echo htmlentities($client->__getLastResponse());

print('</pre>');

}
        
if ($error == 0) {       
        
$res = $client->RESULT;
    
var_dump($res);

}

}

But I keep getting this error:


<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="SilverpopApi:EngageService.SessionMgmt.Login"><SOAP-ENV:Body><ns1:Login/><param1>Ma201dqdq!</param1></SOAP-ENV:Body></SOAP-ENV:Envelope>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> 
     <soap:Body>
         <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>Schema Validation processing failed </faultstring>
            <faultactor></faultactor>
            <detail>
                  <source>
                    <errorcode>324002</errorcode>
                    <trace>
                        Fault Name: SchemaValidationError
                        Error Type: SchemaValidationFailure
                        Description: Schema Validation processing failed 
                        Root Cause Code: -19719
                        Root Cause : XMLSchema Validation Error: Expecting a child element but found none
                        Root Cause Additional Info : [0] XML Parsing Error: XMLSchema Validation Error: Expecting a child element but found none (XMLSCHEMA_ErrChildElemMissing)
                        [1] Parser Error Trace: //SOAP-ENV:Envelope[0]/SOAP-ENV:Body[0]/ns1:Login[0]
                        [2] XMLSchema Validation Error: Expecting a child element but found none (XMLSCHEMA_ErrChildElemMissing)
                        Service: EngageApiService
                        Endpoint: EngageSoapApiClientService
                        Operation (Client):Login
                        FlowTransitionState : Client_Request_System_Error
                        Policy : SystemFirst
                        GenericSystemAssertion
                    </trace>
                </source> 
            </detail>
        </soap:Fault>
    </soap:Body>
</soap:Envelope>

I’ve been scratching my head for days now without any joy. any help much much appreciated.

I now have slightly modified php code to this:


public function loginRequest(){
		
	$client = new SoapClient('http://api5.silverpop.com/SoapApi?wsdl', array("trace"=> 1, 'cache_wsdl' => WSDL_CACHE_NONE, 'soap_version'=>SOAP_1_1, 'Content-Type'=> 'text/plain'));
	
			
	$error = 0;
    
	try {
           $login = $client->Login(array('USERNAME'=>'xxxx', 'PASSWORD'=>'xxxx'));
		       
	} catch (SoapFault $fault) {
         
			$error = 1;
			print('<pre>');
			echo "GENERAL EXCEPTION:<br />".$fault->faultcode."-".$fault->faultstring."\
<br />";
			
			echo "EXCEPTION:\
";
			print_r($fault);
			
			echo "REQUEST:\
";
			echo htmlentities($client->__getLastRequest());
			echo "<br />";
			
			echo "REQUEST HEADERS:\
";
			echo $client->__getLastRequestHeaders();
			
			
			echo "RESPONSE HEADERS:\
";
			echo $client->__getLastResponseHeaders();
			
			echo "RESPONSE:\
";
			echo htmlentities($client->__getLastResponse());
			
			print('</pre>');
		}
        
        if ($error == 0) {       
        
			$res = $client->RESULT;
            
			var_dump($res);
		}
		
	}

the xml envelop being sent is now correct:


<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="SilverpopApi:EngageService.SessionMgmt.Login">
<env:Body>
<ns1:Login>
<ns1:USERNAME>xxxx</ns1:USERNAME>
<ns1:PASSWORD>xxxxx</ns1:PASSWORD>
</ns1:Login>
</env:Body>
</env:Envelope>

But now I get a HTTP/1.1 500 Internal Server Error Response

RESPONSE HEADERS:
HTTP/1.1 500 Internal Server Error
Connection: close
Content-Length: 593
Content-Type: text/plain; charset=UTF-8

Anyone know why? Somebody please?