disable codeigniter session cookie for php soap server

1.8k views Asked by At

I am creating a soap server in codeigniter using php native soap server class. The soap server is working great but I have a problem with the codeiginter session cookie. The session cookie is being sent with every response from the soap server. I need the session cookie for other parts of the application excluding the soap server. Is there a way I can disable the session cookie just for the soap server which is a controller in the application? I have searched stackoverflow and other website for information but have not found anything useful.

It may be I am missing something obvious.

Please point me in the right direction.

Edit:

this is the http response for the soap request:

HTTP/1.1 200 OK
Date: Fri, 10 Jan 2014 07:05:56 GMT
Server: Apache/2.2.3 (CentOS) DAV/2 PHP/5.3.3
X-Powered-By: PHP/5.3.3
Set-Cookie: fgdstagecookie=a%3A4%3A%7Bs%3A10%3A%22session_id%22%3Bs%3A32%3A%22076ceb992c6dff61e46d04d0c3d73d03%22%3Bs%3A10%3A%22ip_address%22%3Bs%3A13%3A%22116.90.236.34%22%3Bs%3A10%3A%22user_agent%22%3Bs%3A34%3A%22Apache-HttpClient%2F4.1.1+%28java+1.5%29%22%3Bs%3A13%3A%22last_activity%22%3Bi%3A1389337556%3B%7D7e8bb59c2753934d5a6265ab7964064c; path=/
Content-Length: 382
Cache-Control: no-store, no-cache, must-revalidate, private, max-age=0
Pragma: no-cache
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Connection: close
Content-Type: text/xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><ns2:responseType xmlns:ns2="http://tempuri.org/response"><code>4</code><message>transaction does not exist or is not available</message><responseBody><responseStr>4</responseStr></responseBody></ns2:responseType></SOAP-ENV:Body></SOAP-ENV:Envelope>

The part I want to remove is the Set-Cookie part.

1

There are 1 answers

0
Sundar On BEST ANSWER

Before returning the response or request use the header_remove(); function

Reference http://www.php.net/manual/en/function.header-remove.php

<?php
 header("X-Foo: Bar");
 header("X-Bar: Baz");

 //remove specific header
 header_remove("X-Foo"); 

 //remove all headers
 header_remove(); 
?>