SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Soap error

  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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:

    PHP Code:
    <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:
    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:
    Code:
    <?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.

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2005
    Location
    London, UK
    Posts
    506
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I now have slightly modified php code to this:

    PHP Code:
    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."\n<br />";
                
                echo 
    "EXCEPTION:\n";
                
    print_r($fault);
                
                echo 
    "REQUEST:\n";
                echo 
    htmlentities($client->__getLastRequest());
                echo 
    "<br />";
                
                echo 
    "REQUEST HEADERS:\n";
                echo 
    $client->__getLastRequestHeaders();
                
                
                echo 
    "RESPONSE HEADERS:\n";
                echo 
    $client->__getLastResponseHeaders();
                
                echo 
    "RESPONSE:\n";
                echo 
    htmlentities($client->__getLastResponse());
                
                print(
    '</pre>');
            }
            
            if (
    $error == 0) {       
            
                
    $res $client->RESULT;
                
                
    var_dump($res);
            }
            
        } 
    the xml envelop being sent is now correct:
    Code:
    <?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?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •