Hi Guys,

I'm using CakePHP and trying to connect to a WSDL SOAP Server created using
.NET but until now I'm not able to authenticate by the header.

There is any specif way that Cake helps to do that ?

Using the SoapUI tool, I'm able to connect and get the results as expected
based on this XML input:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope";
xmlns:tem="http://tempuri.org/";>
   <soap:Header>
      <tem:ValidationHeader>
         <!--Optional:-->
         <tem:User>MyUsername</tem:User>
         <!--Optional:-->
         <tem:Password>MyPass</tem:Password>
      </tem:ValidationHeader>
   </soap:Header>
   <soap:Body>
      <tem:listExamples/>
   </soap:Body>
</soap:Envelope>

Into my controller class, I'm trying

public function testSOAP() {

           $username = "";
            $password = "";

            $wsdl="https://myURL?WSDL";;

            // Setting "trace" will allow us to view the request that we
are making, after we have made it.
            $objClient = new SoapClient($wsdl, array('trace' => true));

            //Body of the Soap Header.
            $headerbody = array('User' => $username,
                                'Password' => $password);

            //Create Soap Header.
            $header = new SOAPHeader($wsdl, 'ValidationHeader',
$headerbody);

            //set the Headers of Soap Client.
            $objClient->__setSoapHeaders($header);

            // Invoke the remote call "login()".
            $Response =  $objClient->listExample();

            debug($Response);

But I'm getting the follow response:

System.Web.Services.Protocols.SoapException: Server was unable to process
request. ---> System.Exception: ServiceX webservice authentication failed.
   at ServerX2.WebServices.ServerX.listExample() in C:\file.asmx.cs:line 45
   --- End of inner exception stack trace ---

Using the SoapUI if I change the username and password (to an invalid
value) I get the same error message, it means the https protocol is working
fine (the client is able to connect to the server) but the SOAP
authentication header fails.

Any suggestions ?

Thanks in advance,

-- 
Best Regards,
Felipe Roman
Phone 55 51 8454 8110
LinkedIn http://au.linkedin.com/in/feliperoman

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to