473,765 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>myusernam e</USER>
<PASSWORD>mypas sword</PASSWORD>
</SOAP-ENV:Header>

What I get is :
<SOAP-ENV:Header>
<ns2:auth>
<USER>myusernam e</USER>
<PASSWORD>mypas sword</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($us er, $pass) {
$this->USER = $user;
$this->PASSWORD = $pass;
}
}

$auth = new Authstuff('myus ername', 'mypassword');
$param = array('Authstuf f' => $auth);
$authvalues = new SoapVar($auth,S OAP_ENC_OBJECT) ;
$header = new
SoapHeader('htt p://soapinterop.org/echoheader/',auth,$authval ues);
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 7845
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("nul l",

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('Authstuf f' => $auth);
$auth = new authstuff('myus er','mypassword ');
$authvalues=new SoapVar($auth,S OAP_ENC_OBJECT) ;
$header = new
SoapHeader("htt p://schemas.xmlsoap .org/soap/envelope/",notneeded,$au thvalues);

$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::__c onstruct(): 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("htt p://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
3729
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 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...
4
7884
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
20290
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 not support automatic wsdl generation of custom headers so the wsdl has no information regarding the required header. I've read through a lot of material and managed to get a workable solution but it is far from ideal. I created a new...
1
6336
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 soap header called by using a http module. The problem Im having is I cannot seem to get the event to raise to fire off my authenticate method in the global.asax. The module is plumbed in to my web.config file Code Below:-
1
2112
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 header element named 'Vendor' so that they can distinguis which vendor called the webservice.
2
5003
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 token to be passed in the SOAP header. The header should be as the following: <env:Header>
0
2449
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 step 1 3.) Bind service to custom Assertion Step 1 Custom Filter(Called by Custom Assertion) Class ClientOutputFilter
0
1272
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: <SOAP-ENV:Header> < Security > <Username>AUSER</Username> < Password >APassword</Password> </Security> </SOAP-ENV:Header> But what I want to do is ,
0
1356
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: <SOAP-ENV:Header> < Security > <Username>AUSER</Username> < Password >APassword</Password> </Security> </SOAP-ENV:Header>
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.