SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: soap and php

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2006
    Location
    Dundee, Scotland
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    soap and php

    Sorry if this is posted on the wrong section but this is to do with web services but it is specifically php.

    I am thinking of creating a few scripts that use soap but I cannot be guaranteed that someone will be using php 4 or php 5 nor can I guarantee they have php with soap support built in (php 5). I therefore should support a package I can have with my script and that is most likely to be nusoap. I have noticed however that nusoap cannot be used on a php 5 server that has soap built in as it uses classes with the same name (so obviously an error occurs stating I cannot redeclare an already existing class).

    1 approach I have thought about is to use my own class that will check which it should use then forward requests to the relevant class (be it nusoap or the built in soap extension). I would then format the results so that regardless of which 1 is used the output is the same (nusoap outputs an array, the php soap extension uses objects). Does this sound like the best way to go?

    Also when I was looking into it (i used the amazon web service) I noticed the title of 1 of the resultant books was 'Les déicides: Roman' (notice the e with the diagonal line above it, can't remember what the char is called, that is what amazon displays it as) but in php's built in soap it returns 'Les déicides: Roman' (A with a carat above it and a copyright symbol) all I have done is used print_r() on the results in zend studio (nusoap displayed it fine and was running under php 4.4.1 and php with soap extension was running php 5.1.1). Presumably there is a simple reason for this does anyone know what it is?

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by filth
    1 approach I have thought about is to use my own class that will check which it should use then forward requests to the relevant class (be it nusoap or the built in soap extension). I would then format the results so that regardless of which 1 is used the output is the same (nusoap outputs an array, the php soap extension uses objects). Does this sound like the best way to go?
    Yes, that's the adapter pattern actually. That's the best way to go.

    Quote Originally Posted by filth
    Also when I was looking into it (i used the amazon web service) I noticed the title of 1 of the resultant books was 'Les déicides: Roman' (notice the e with the diagonal line above it, can't remember what the char is called, that is what amazon displays it as) but in php's built in soap it returns 'Les déicides: Roman' (A with a carat above it and a copyright symbol) all I have done is used print_r() on the results in zend studio (nusoap displayed it fine and was running under php 4.4.1 and php with soap extension was running php 5.1.1). Presumably there is a simple reason for this does anyone know what it is?
    You can always use utf8 encoding to avoid encoding problems.
    Saul

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2006
    Location
    Dundee, Scotland
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by php_daemon
    Yes, that's the adapter pattern actually. That's the best way to go.
    cool, i've never looked into patterns properly yet, not long been getting into oop in php. Looks like I know some patterns without even realizing it hehe.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •