473,396 Members | 2,158 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,396 software developers and data experts.

SOAP and Accept-Encoding

JW
Hello. I'm trying to make a SOAP request, and enable compression in
the response (by sending the Accept-Encoding header). To do this, I'm
sending 'compression' =SOAP_COMPRESSION_ACCEPT |
SOAP_COMPRESSION_GZIP in the SoapClient constructor's options.

But when I print the request headers, I don't see the Accept-Encoding
header. Am I doing something wrong?

I also tried SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9 to
set the compression level, as I've seen in some examples.

I just downloaded and compiled php 5.2.1 with --enable-soap on Mac OS
10.4.9.

The full example is below:
$o_client = new SoapClient($wsdlURL, array(
'trace' =true,
'compression' =SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP,
'login' =$login,
'password' =$password
));
$o_result = $o_client->acknowledge();
echo $o_client->__getLastRequestHeaders();

Apr 29 '07 #1
2 7498
JW wrote:
I also tried SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 9 to
set the compression level, as I've seen in some examples.
I don't see anything wrong with the way you're trying to use
compression, but setting the compression level like this bothers me.
It doesn't make much sense, binary operators shouldn't work like that.

When you pass flags with the pipe, the flags are powers of two so that
they each have a one in a different place in the binary byte, for
example whichever flag was given the value of 2 would be 00000010, the
next flag would be given the value of 4 (00000100), the next would be
8 (00001000). The binary or operator (|) will return a number that has
ones in all places on the other numbers where there is a one, IE:

<?php
define( 'SOAP_COMPRESSION_ACCEPT', 2 ); // 00000010
define( 'SOAP_COMPRESSION_GZIP', 4 ); // 00000100
define( 'SOME_OTHER_CONSTANT', 16 ); // 00010000

echo SOAP_COMPRESSION_ACCEPT |
SOAP_COMPRESSION_GZIP |
SOME_OTHER_CONSTANT;
?>

the flags are combined, yielding 00010110, which is binary for 22, so
it will echo the number 22. Now, when you also combine in the number
9, which is 00001001, you will get 00011111. This messes things up
because normally the receiving function, something like this...

function doStuff( $flags )
{
if( $flags & SOME_OTHER_CONSTANT )
doIt();
}

....might get confused. The function will be checking to see where the
ones are (with the & operator), and an arbitrary number could throw in
a one anywhere, so it's left with complete BS. It will then have
unexpected consequences because it will see the one somewhere that
some unrelated flag would normally put a one. So there goes the
setting compression level thing.

BTW, where did you see those contrary examples?

-Mike PII

Apr 30 '07 #2
JW
On Apr 30, 4:23 pm, Mike P2 <sumguyovrt...@gmail.comwrote:
Now, when you also combine in the number
9, which is 00001001, you will get 00011111. This messes things up
Mike,

I'm assuming that the flags were designed with that in mind, so the
SOAP_COMPRESSION_ flags are large enough numbers that they don't
interfere with the compression-level number. I agree that it's a weird
design. The compression level isn't documented, but I found a
reference to it in this bug:
http://bugs.php.net/bug.php?id=36283&edit=2
I'm not sure whether that's been incorporated into PHP 5.2.1, though.

Jacob

May 1 '07 #3

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

Similar topics

0
by: olafmol | last post by:
Hello, i have a problem using a .NET WSDL Webservice from PHP. Using both the NuSOAP lib for PHP4, and the build-in SOAP lib for PHP5 it seems that the SOAP client cannot pass a variable amount...
15
by: MR | last post by:
i need to develop a SOAP client, Since I have never personally done one I would like to make sure that I am going about it correctly. The client is a Windows (probably 2k3) application that...
0
by: Hans Kesting | last post by:
Hi, I'm trying to create a client for some webservice. BUT I have only limited information: * no WSDL available ("expected Q1-06") (it seems to be written in Java) * I don't have access (yet)...
2
by: Wee Bubba | last post by:
i have created a web service with one method which returns a code. i am currently trying to access the return value of this method through a page which has not got the proxy.dll referenced. i.e. as...
4
by: Kaush | last post by:
Hi all, I am creating a webservice to accept SOAP messages, parse the message and send a SOAP response back to the client accessing my web service using WSE-2 in ASP.NET. I am creating a class...
0
by: Kaush | last post by:
Hi all, I am implementing a web service server to accept SOAP messages from my client and send a SOAP response back. Actually I am using .NET's WSE-2 for receiving and sending SOAP messages. The...
1
by: Julio Delgado | last post by:
Hi, Again sorry for my ignorance first time interfacing to a remote server that is not a web service but it uses SOAP protocol to talk through a particular TCP port. I need to develop a VB.NET...
6
by: J. Dudgeon | last post by:
Is it possible to configure a .NET 2.0 ASMX Web service to accept namespace qualified messages? For instance, instead of: <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"...
6
by: Brybot | last post by:
I am trying to allow HTTP POST file uploads to my web service. Currently I have it working perfectly for a SOAP/XML request reading in a byte using MemoryStream/FileStream but I cannot figure out...
1
by: Paul van Brouwershaven | last post by:
Hi All, I'm struggling with the WDSL restrictions in PHP/SOAP for a while know. I would like to create some simple restrictions in my WDSL file. The script are running both on the same server...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
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...
0
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...
0
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...
0
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,...

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.