471,601 Members | 1,203 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,601 software developers and data experts.

Adding own HTTP header fields along with a SOAP request in PHP

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>


Sep 21 '05 #1
0 3246

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Daniel Albisser | last post: by
4 posts views Thread by Mark | last post: by
7 posts views Thread by Mullin Yu | last post: by
reply views Thread by IT Drone | last post: by
reply views Thread by | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.