|
Posted by ramas on 09/21/05 12:38
Hi,
I am new to PHP scripting and i am trying to connect to a soap server
(as mentioned below) using the SOAP extension comesup with PHP. Now my
requirement is to add my HTTP header fields along with my SOAP request,
so that the SOAP server will receive it and does some high level
processing. Is it possible to add our own HTTP header fields in PHP?
If i use the header() function to add the field into the HTTP header
and it neither reports an error nor adds it to the headers list.
Can anybody suggest me a solution for the problem I face?
Thanks,
Ramas
<?php
header("X-Test: foo");
setcookie('foo', 'bar');
/* Define a custom response header */
header("X-Sample-Test: foo");
$client = new SoapClient(NULL,
array(
"location" => "http://127.0.0.7:3490",
"uri" => "urn:calc",
"style" => SOAP_RPC,
"use" => SOAP_ENCODED,
"trace" => 1
));
$client->__setCookie("Auth",$tem);
echo ($client->__call(
"add",
array(
new SoapParam(
10,"a"),new SoapParam(22,"b")
),
array(
"uri" => "urn:calc",
"soapaction" => "add"
)). "\n");
//echo $client->requestheaders();
var_dump(headers_list());
?>
Request received at Soap server:
==================================
POST HTTP/1.1
Host: 127.0.0.7:3490
Connection: Keep-Alive
User-Agent: PHP SOAP 0.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "urn:calc"
Content-Length: 490
Cookie: Auth=Valid USER;
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:calc" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:add><a
xsi:type="xsd:int">10</a><b
xsi:type="xsd:int">22</b></ns1:add></SOAP-ENV:Body></SOAP-ENV:Envelope>
>
Navigation:
[Reply to this message]
|