[PHP] A few questions about PHP's SOAP module

2008-08-07 Thread Christoph Boget
* I'm trying to better understand the 'classmap' option for the
SoapClient class.  Is it used to define the class of an instantiated
object which will be passed as an argument to the server's function
call?  So, as a very simplistic example, it might go something like
this:

?php
  class MyClass
  {
public $sStockSymbol ;
public function __construct( $sStockSymbol )
{
  $this-sStockSymbol = $sStockSymbol;
}
  }

  $oObj = new MyClass( 'ibm' );
  $oClient = new SoapClient( $sWSDL_URI, array( 'classmap' = array(
'StockSymbol' = 'MyClass' )));

  $oClient-getStockValue( $oObj );
?

Am I even close?  Now, what happens if one of the required arguments
to the server function is a variable that has a hyphen in it?  Is
there any way I can get around that since PHP doesn't allow you to
define variables with hyphens?

* Whether using class/objects to pass parameters to a server function
(assuming I have the above correct) or arrays, how can you define
further attributes for each parameter?  Is that even possible?  So
here is an example of a SOAP message that the server is expecting:

?xml version=1.0?
soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
  soap:Body
ServerFuncName xmlns=urn:/joe/bob/briggs/types
  String1Var1 Value/String1
  String2live/String2
  Array1
SubArray1 status=complete
  SubArray2 xmlns= encoding= node-type=
SubArray3
  node name=attribute1Node Value/node
  node name=attribute2Node Value/node
  node name=attribute3Node Value/node
  node name=attribute4Node Value/node
  node name=attribute5Node Value/node
/SubArray3
  /SubArray2
  SubArray2 xmlns= encoding= node-type=/SubArray2
/SubArray1
  /Array1
/ServerFuncName
  /soap:Body
/soap:Envelope

How can I set up the attributes illustrated above?  Encoding,
node-type, etc?  Is that possible?

* Finally, is there a really good and/or comprehensive tutorial and/or
write-up on PHPs SOAP module?  The documentation is pretty spartan and
what I have found doesn't really go in to much depth.

Any help would be greatly appreciated!

thnx,
Christoph

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] A few questions about PHP's SOAP module

2008-08-07 Thread Nathan Nobbe
On Thu, Aug 7, 2008 at 1:29 PM, Christoph Boget [EMAIL PROTECTED] wrote:

 * I'm trying to better understand the 'classmap' option for the
 SoapClient class.  Is it used to define the class of an instantiated
 object which will be passed as an argument to the server's function
 call?  So, as a very simplistic example, it might go something like
 this:

 ?php
  class MyClass
  {
public $sStockSymbol ;
public function __construct( $sStockSymbol )
{
  $this-sStockSymbol = $sStockSymbol;
}
  }

  $oObj = new MyClass( 'ibm' );
  $oClient = new SoapClient( $sWSDL_URI, array( 'classmap' = array(
 'StockSymbol' = 'MyClass' )));

  $oClient-getStockValue( $oObj );
 ?

 Am I even close?


first off, let me recommend the phpt tests in the php source.  for the soap
stuff, you will find them under ext/soap/tests.  i was looking through a few
of them.  looks like if you have a chunk of wsdl, like this

xsd:complexType
name=book


xsd:all

xsd:element name=a
type=xsd:string/
xsd:element name=b
type=xsd:string/

/xsd:all

/xsd:complexType

you can map classes to it like this (which i gather you already got) w/ the
$options param in the SoapClient constructor

class book{
public $a=a;
public $b=c;
}

it looks like you can use contructors too though, im a bit too lazy to hash
out the details as i go through the phpt tests =/  but anyway, instead of
instantiating book ourselves, the SoapClient instance will do that for us,
as in

$sc = new SoapClient(
  $someWsdlAddr,
  array(
'classmap' = array(
  'book' = 'book'
 )
  )
);

$book = $sc-readBook($myFavBook);

so assuming there was a method defined in the wsdl, roughly like,

ns1:readBook
  res xsi:type=ns1:book
a xsi:type=xsd:stringLord of the Rings/a
b xsi:type=xsd:stringJRR Token/b
  /res
/ns1:readBook

we could then take the book instance the SoapClient created for us, and do

echo title: {$book-a}, author: {$book-b}; /// produces title: Lord of
the Rings, author: JRR Token

Now, what happens if one of the required arguments
 to the server function is a variable that has a hyphen in it?  Is
 there any way I can get around that since PHP doesn't allow you to
 define variables with hyphens?


soo, im guessing the wsdl might be something like

xsd:complexType
name=book


xsd:all

xsd:element name=a--
type=xsd:string/
xsd:element name=b
type=xsd:string/

/xsd:all

/xsd:complexType

normally, with variable variables, you could hack around this, as in

$varWHyphen = 'a--';
$$varWHyphen = 5;

however, instance variables cannot be created out of variable variables, so
i doubt thats possible in this context.

* Whether using class/objects to pass parameters to a server function
 (assuming I have the above correct) or arrays, how can you define
 further attributes for each parameter?  Is that even possible?


well, i think so.  basically, i think this feature is just a way to have the
SoapClient instantiate an object rather than just returning an array.  so
the examples in the phpt tests are simple, but you might have a class that
actually has methods and so forth, you just use a soap call to create it.
then you go on your way.  this could be a bit more desireable for some folks
than getting an array and using it to create an object themselves, i
suppose.

so for example in the book class above you might have,

public function __toString() {
  return title: {$this-a}, author: {$this-b};
}


 So
 here is an example of a SOAP message that the server is expecting:

 ?xml version=1.0?
 soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xmlns:xsd=http://www.w3.org/2001/XMLSchema;
  soap:Body
ServerFuncName xmlns=urn:/joe/bob/briggs/types
  String1Var1 Value/String1
  String2live/String2
  Array1
SubArray1 status=complete
  SubArray2 xmlns= encoding= node-type=
SubArray3
  node name=attribute1Node Value/node
  node name=attribute2Node Value/node
  node name=attribute3Node Value/node
  node name=attribute4Node Value/node
  node name=attribute5Node Value/node
/SubArray3
  /SubArray2
  SubArray2 xmlns= encoding= node-type=/SubArray2
/SubArray1
  /Array1
/ServerFuncName
  /soap:Body
 /soap:Envelope

 How can I set up the attributes illustrated above?  Encoding,
 node-type, etc?  Is that possible?


dunno, maybe scope the phpt tests and see if you can figure something out..
i might play around w/ the example later, but as i said im weak on the
actual xml structure of the soap spec.

* Finally, is there a really good and/or comprehensive tutorial and/or
 write-up on PHPs SOAP module?  The documentation is pretty spartan and
 what I have found doesn't really go in to much depth.


yea, well, i think we 

[PHP] A few questions about system requirements

2004-09-24 Thread Steven
Howdy,
 
I'm going to be writing an app for our company that handles
the day-to-day processes here and I have a question for the experienced
devs out here that would know the ins and outs of working with CMS and
good stats on what is needed for a server.
 
I want to integrate my system with an existing CMS so I can
have the username/password management and security features with the
notifications, ratings, and user calendars all bundled into one thing.
Obviously, there is going to be some kickback for the ones who
originally wrote all the goodies, but I need to know what will best suit
my company's needs.
 
There will be about 15,000 'files' entered in per year with
about 70 employees banging away at it daily, so I will probably need to
build a pretty hoss database server and front-end to handle all of the
php function calls.  The big thing though, is would it be feasible to
use a CMS system, could it handle that many people hammering away at it,
and easily hook in all of the CMS's features into my main app (such as
using smarty or somesuch)
 
Please advise and thanks in advance!
 
Steven A.


[PHP] A few questions...

2003-03-01 Thread The Head Sage
Hello all,

I've got several questions and i'm hoping i can find answers or links to 
places which contain the answers.

1. How can i set a script to run at a certain time?

For example, say i want to send a mass e-mail at 5:00pm every night which 
contains the latest updates to the website. I know how to generate the mail 
and then send it to everyone's e-mail in a MySQL table. But how do i set it 
to run automaticaly?

Answers for both Linux and Windows systems would be nice...

2. How do i open a HTML file, extract all the text and then break up the 
text into variables..

For example, i've got a HTML files which all have the same structure


Title: Magocracy
Author: TheHeadSage
E-Mail: [EMAIL PROTECTED]
Category: Comedy, Action
Keywords: Ilja, Magic, Ilkeria
Rating: PG-13
Spoilers: None, origional story.
Summary: [Sumary here]
Chapter Body

How would i get all the text and break it up into the variables $title, 
$author, $email
ect. So they can be insterted into the MySQL table under the approprate 
colums.

3. How do i open a Word Document and extract all the text?

As users would like to submit .doc files and i'd like the script to process 
them..

Thats all the questions so far, any tips, comments, ideas, questions even 
insults and flames are welcome!

Also please reply to the address: [EMAIL PROTECTED] as i dont 
trust hotmail.

Thanks in advance,

- Daniel TheHeadSage Spain
Founder of Voidsoft.
Server Administrator of The Void
Head of IRC Relations for Manga-Sketchbook.org
_
Hotmail now available on Australian mobile phones. Go to  
http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] A few questions...

2003-03-01 Thread Ernest E Vogelsinger
At 00:49 02.03.2003, The Head Sage said:
[snip]
1. How can i set a script to run at a certain time?

*nix: use cron (man crontab)
Windows: use the at command (help at)

2. How do i open a HTML file, extract all the text and then break up the 
text into variables..

For example, i've got a HTML files which all have the same structure


Title: Magocracy
Author: TheHeadSage
E-Mail: [EMAIL PROTECTED]
Category: Comedy, Action
Keywords: Ilja, Magic, Ilkeria
Rating: PG-13
Spoilers: None, origional story.
Summary: [Sumary here]

Chapter Body



How would i get all the text and break it up into the variables $title, 
$author, $email
ect. So they can be insterted into the MySQL table under the approprate 
colums.

Using the layout you are showing:
1) Read the file
2) Split headers from body (delimited by an empty line)
3) make an array from the headers, splitting each line by ': '

// Disclaimer: untested
// step 1
$hf = fopen($file, 'r') or die(Can't read $file);
$buffer=fread($hf, filesize($hf));
fclose($hf);

// step 2 - now you have the chapter ready
list($headers, $chapter) = preg_split(/(\n|\r|\r\n|\n\r){2,2}/s, $buffer);

// step 3
$headers = preg_split(/(\n|\r|\r\n|\n\r)/s, $headers);
$arkeywords = array(); // for the array method, see below
foreach ($headers as $line) {
list($var, $value) = preg_split('/:\s*/', $line, 2);
// you may rather use an associative array instead of variable names
// the variable method:
$$var = $value;
// the array method
$arkeywords[$var] = $value;
}

You now have the body text in $chapter, and either an associative
array, or the named variables of the header lines.

3. How do i open a Word Document and extract all the text?

You might try Word2X (see http://word2x.sourceforge.net/)
Disclaimer - never used it, just been told about it by my friend Google
(question was Winword conversion Linux).

Thats all the questions so far, any tips, comments, ideas, questions even 
insults and flames are welcome!

Nothing else?

Ok, you got something to work on now I believe... *grin*

- Daniel TheHeadSage Spain
Founder of Voidsoft.
Server Administrator of The Void

...hopefully not...


-- 
   O Ernest E. Vogelsinger
   (\)ICQ #13394035
^ http://www.vogelsinger.at/



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] A few questions on switching redoing site in PHP

2001-12-04 Thread Dan McCullough

If everyone could gather around for a minute or two.  We are looking at switching from 
a
propriatary JSP/JS/Java based system and going to PHP as our ecommerce system.  We 
currently have
Oracle db and hosted on Sun equiptment, which we are in for another 3 years, although 
upgrades are
planned.  We hate the current system, it was picked for us in a closed room 
environment.  We have
been looking to get off ever since we launched, actually even before we launched.  I 
have been
developing in PHP before I got this job and advised against the vendor that we had, 
now I want to
develop my own system.  This is the backend systems we have.  One system that I'm not 
to sure of
is MQ Series, can PHP tie into that, or would we have to work around that, MQ messages 
back and
forth with our legacy system to give a real-time connection to our actual customer and 
inventory
and order processing pieces, although some C++ code sits between that and the JS 
layer.  Another
concern is how well does Sun and PHP get along, we have these nice boxes that is 
actually
handleing the memory hog that we have now, and I know that we couldnt just dump the 
servers. 
Anyone have an idea on a site that processes between 150-250 orders and averages $65k 
a day, if
PHP and MySQL can handle that, or would I have to go to something like MSSQL (I know I 
know MS and
PHP .. hahahahahaha).  All and any suggestions are welcome.

dan mccullough
web technology 
603.823.5545 x 1119

There is no such thing as a problem, unless the servers are on fire.
Sometimes great opportunity comes brilliantly disguised as bad news.

__
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] A few questions...

2001-03-25 Thread Chris Cocuzzo

hey-

Alright I noticed that question about URL parsing. I could've sworn I saw
some article on PHPBuilder.com that said that instead of doing all that
modifying with apache, you could simply write something to change the URL
with '?' and '' and '=' so that they symbols could be represented using a
simple /, does anyone remember seeing it?...

In any case, I'll ask, what would be the best way to do this with
scripting, something like str_replace() or perhaps a regular expression to
both modify the URL and then allow pages using that modified URL to
recognized the variable/value pairs? Or is that even possible?

My other question is this: Sometimes I notice URL's where it looks like
this, http://www.whatever.com/?blah=blahd=d, or
http://www.whatever.com/local?name=named=d. How is that done, where there
is no file extension after the file name, or no file name at all, just a
question mark directly after the slash?

thanks
Chris


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] A few questions...

2001-03-25 Thread Jaxon

Chris,

a few answers :)

On 3/25/01 5:43 PM, "Chris Cocuzzo" [EMAIL PROTECTED] wrote:

 hey-
 
 Alright I noticed that question about URL parsing. I could've sworn I saw
 some article on PHPBuilder.com that said that instead of doing all that
 modifying with apache, you could simply write something to change the URL
 with '?' and '' and '=' so that they symbols could be represented using a
 simple /, does anyone remember seeing it?...

dunno - think it's in the php.ini?
 
 In any case, I'll ask, what would be the best way to do this with
 scripting, something like str_replace() or perhaps a regular expression to
 both modify the URL and then allow pages using that modified URL to
 recognized the variable/value pairs? Or is that even possible?

You could... I'm hacking through using:

$path_array = explode('/', $REQUEST_URI);

$last_item  =   array_pop($path_array);
$next_to_last_item  =   array_pop($path_array); / item

only drawback is the positional stuff is fixed.
now I am trying to figure out how to generate my hrefs in the page to have a
matching structure
 
 My other question is this: Sometimes I notice URL's where it looks like
 this, http://www.whatever.com/?blah=blahd=d, or
 http://www.whatever.com/local?name=named=d. How is that done, where there
 is no file extension after the file name, or no file name at all, just a
 question mark directly after the slash?

probably the a .htaccess  or apache.conf directive:

Location /local 
ForceType application/x-httpd-php3
/Location 

This would send everything to a script called "local".
This is from: http://phpbuilder.com/columns/tim19990117.php3

hth,

regards,
jaxon
 
 thanks
 Chris
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] A few questions...

2001-03-25 Thread Chris Cocuzzo

I think I just slightly unsure of how that explode() function works in this
situation...could you clarify further?

chris



-Original Message-
From: Jaxon [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 25, 2001 6:06 PM
To: [EMAIL PROTECTED]; PHP General List (E-mail)
Subject: Re: [PHP] A few questions...


Chris,

a few answers :)

On 3/25/01 5:43 PM, "Chris Cocuzzo" [EMAIL PROTECTED] wrote:

 hey-

 Alright I noticed that question about URL parsing. I could've sworn I saw
 some article on PHPBuilder.com that said that instead of doing all that
 modifying with apache, you could simply write something to change the URL
 with '?' and '' and '=' so that they symbols could be represented using a
 simple /, does anyone remember seeing it?...

dunno - think it's in the php.ini?

 In any case, I'll ask, what would be the best way to do this with
 scripting, something like str_replace() or perhaps a regular expression to
 both modify the URL and then allow pages using that modified URL to
 recognized the variable/value pairs? Or is that even possible?

You could... I'm hacking through using:

$path_array = explode('/', $REQUEST_URI);

$last_item  =   array_pop($path_array);
$next_to_last_item  =   array_pop($path_array); / item

only drawback is the positional stuff is fixed.
now I am trying to figure out how to generate my hrefs in the page to have a
matching structure

 My other question is this: Sometimes I notice URL's where it looks like
 this, http://www.whatever.com/?blah=blahd=d, or
 http://www.whatever.com/local?name=named=d. How is that done, where there
 is no file extension after the file name, or no file name at all, just a
 question mark directly after the slash?

probably the a .htaccess  or apache.conf directive:

Location /local
ForceType application/x-httpd-php3
/Location

This would send everything to a script called "local".
This is from: http://phpbuilder.com/columns/tim19990117.php3

hth,

regards,
jaxon

 thanks
 Chris



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] A few questions...

2001-03-25 Thread Jaxon

Chris,

 I think I just slightly unsure of how that explode() function works in this
 situation...could you clarify further?
 
 
 $path_array = explode('/', $REQUEST_URI);
 
 $last_item  =   array_pop($path_array);
 $next_to_last_item  =   array_pop($path_array); / item
 
$REQUEST_URI contains the non-domin path (the URI) - it's a predefined
variable like $PHP_SELF, etc

http://www.php.net/manual/en/language.variables.predefined.php

in this explode() example, the '/' is the devider, so if you have

http://www.somedomain.com/dir1/dir2/dir3/somepage3.php

The URI is: /dir1/dir2/dir3/somepage3.php

and 'exploding' divides that into array elements (dir1, dir2, dir3,
somepage.php)

regards,
jaxon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] A few questions...

2001-03-25 Thread Chris Cocuzzo

right. ok I understand that explode function. But what I'm asking is not so
much once I have a URL in the form of /something/something/something
...etc.., but more if I have a URL like /something?d=af=g, to make it like
/something/d/a/f/g  ... do you know what I mean?


Chris

-Original Message-
From: Jaxon [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 25, 2001 6:32 PM
To: [EMAIL PROTECTED]; PHP General List (E-mail)
Subject: Re: [PHP] A few questions...


Chris,

 I think I just slightly unsure of how that explode() function works in
this
 situation...could you clarify further?


 $path_array = explode('/', $REQUEST_URI);

 $last_item  =   array_pop($path_array);
 $next_to_last_item  =   array_pop($path_array); / item

$REQUEST_URI contains the non-domin path (the URI) - it's a predefined
variable like $PHP_SELF, etc

http://www.php.net/manual/en/language.variables.predefined.php

in this explode() example, the '/' is the devider, so if you have

http://www.somedomain.com/dir1/dir2/dir3/somepage3.php

The URI is: /dir1/dir2/dir3/somepage3.php

and 'exploding' divides that into array elements (dir1, dir2, dir3,
somepage.php)

regards,
jaxon


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] A few questions...

2001-03-25 Thread Jaxon

while a bit ugly, you could just use array_pop() to get each item into a
variable and then echo them back out into your variable assignment...

somewhat cleaner would be to create an assoc array of config vars:

$uri_items_num=count($path_array);
for ($i=1, $i = $uri_items_num, $i++)
{
$key=array_pop($path_array);
$value=array_pop($path_array);
config_array[$key] = $value
}

or something.

regards,
jaxon

On 3/25/01 6:54 PM, "Chris Cocuzzo" [EMAIL PROTECTED] wrote:

 right. ok I understand that explode function. But what I'm asking is not so
 much once I have a URL in the form of /something/something/something
 ...etc.., but more if I have a URL like /something?d=af=g, to make it like
 /something/d/a/f/g  ... do you know what I mean?
 
 
 Chris
 
 -Original Message-
 From: Jaxon [mailto:[EMAIL PROTECTED]]
 Sent: Sunday, March 25, 2001 6:32 PM
 To: [EMAIL PROTECTED]; PHP General List (E-mail)
 Subject: Re: [PHP] A few questions...
 
 
 Chris,
 
 I think I just slightly unsure of how that explode() function works in
 this
 situation...could you clarify further?
 
 
 $path_array = explode('/', $REQUEST_URI);
 
 $last_item  =   array_pop($path_array);
 $next_to_last_item  =   array_pop($path_array); / item
 
 $REQUEST_URI contains the non-domin path (the URI) - it's a predefined
 variable like $PHP_SELF, etc
 
 http://www.php.net/manual/en/language.variables.predefined.php
 
 in this explode() example, the '/' is the devider, so if you have
 
 http://www.somedomain.com/dir1/dir2/dir3/somepage3.php
 
 The URI is: /dir1/dir2/dir3/somepage3.php
 
 and 'exploding' divides that into array elements (dir1, dir2, dir3,
 somepage.php)
 
 regards,
 jaxon
 
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]