473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

PHP 5 soap and XML custom soap header

Hello,
I am having a problem getting a custom soap header to work with PHP5.
What I require is something like this:
<SOAP-ENV:Header>
<USER>myusername</USER>
<PASSWORD>mypassword</PASSWORD>
</SOAP-ENV:Header>

What I get is :
<SOAP-ENV:Header>
<ns2:auth>
<USER>myusername</USER>
<PASSWORD>mypassword</PASSWORD>
</ns2:auth>
</SOAP-ENV:Header>

I would like to remove the namespace tags.
The code I use to get this is:
class Authstuff {
public $USER;
public $PASSWORD;
public function __construct($user, $pass) {
$this->USER = $user;
$this->PASSWORD = $pass;
}
}

$auth = new Authstuff('myusername', 'mypassword');
$param = array('Authstuff' => $auth);
$authvalues = new SoapVar($auth,SOAP_ENC_OBJECT);
$header = new
SoapHeader('http://soapinterop.org/echoheader/',auth,$authvalues);
I have tried several other ways to do this but to no avail, using a
"null" in the namespace field returns an error.
Any help on how to do this would be great. Also could anyone recommend
a programmer for hire to help out on these problems as I will be having
quite a few in the comming weeks, not on a full time basis but to help
out with this type of question(s).

Cheers,
Harv

Sep 15 '05 #1
4 7810
Did you modify the envelope? Your reference to the namespace brings up
a page (with tons of popups) and not your namespace.

Did you try

new SoapClient(null,

or

new SoapClient("null",

The first one is the correct one.

Sep 15 '05 #2
That should have been "Your reference to the envelope" :)

Sep 15 '05 #3
I thank you for your reply, Sorry about the popup page, not sure how
that got in there.
I am currently using the following:
$param = array('Authstuff' => $auth);
$auth = new authstuff('myuser','mypassword');
$authvalues=new SoapVar($auth,SOAP_ENC_OBJECT);
$header = new
SoapHeader("http://schemas.xmlsoap.org/soap/envelope/",notneeded,$authvalues);

$client = new SoapClient(null,
array(
"location" => "http://localhost:8181/devserv",
"uri" => "",
"style" => SOAP_RPC,
"use" => SOAP_ENCODED
));
and getting:
<SOAP-ENV:Header>
<SOAP-ENV:notneeded>
<USER>myuser</USER>
<PASSWORD> mypassword</PASSWORD>
</SOAP-ENV:notneeded>
</SOAP-ENV:Header>

Any idea how to get rid of the ":notneeded" parts, if I put them as
null I get:
Fatal error: SoapHeader::__construct(): Invalid parameters. Invalid
header name.

any help appreciated

Sep 16 '05 #4
hmmm, null has worked for me in the past. My current host doesn't have
soap so.....

Maybe the following will work

SoapHeader("http://schemas.xmlsoap.org/soap/envelope/", ,$authvalues)

Sep 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ramas | last post by:
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...
4
by: Mark | last post by:
i have a very simple web servive Imports System.Web.Services <System.Web.Services.WebService(Namespace:="urn:Example1")> _ Public Class Example1 Inherits System.Web.Services.WebService
6
by: john deviney | last post by:
I have a C#/.Net 1.1 client talking to a Java based web service. I need to insert a soap header on the client side which is expected on the server side. Currently, the Java ws provider, Axis, does...
1
by: Stu | last post by:
Hi, Im using vis studio 2003 and I think wse is out of the question as clients could be using java which doesnt support it. So I managed to find some code which allows you to develop a custom...
1
by: Peter van der veen | last post by:
Hi I have a problem in VB.net 2.0 We are using a third party webservice. I have loaded the wsdl file and can access the functions the service has. Now this party wants that we add a SOAP...
2
by: Kevin Eldridge | last post by:
Hi, I'm trying to call a java web service and i need some help in creating a custom SOAP header in c#. I need to access to a Web service that implements authorization policy, by using a session...
0
by: =?Utf-8?B?ZWQ=?= | last post by:
I had this exact problem using a vb.net client accessing a Java web service. The solution takes 3 steps: 1.) Create custom ClientOutputFilter 2.) Create a custom Assertion that uses filter from...
0
by: sskvp | last post by:
There are millions of samples in the internet explain how to insert a multi node SOAP Header. What I mean is that there are plenty of examples in the internet show how to do the following:...
0
by: sskvp | last post by:
There are millions of samples in the internet that explains how to insert a multi node SOAP Header. What I mean is that there are plenty of examples in the internet show how to do the following:...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.