+ Reply to Thread
Results 1 to 3 of 3

Thread: Consuming WCF service with PHP

  1. #1
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Consuming WCF service with PHP

    I'm trying to use a SOAP WCF (at least I hope that's what it is!) I have in one domain, in another domain using PHP.

    I got it working on another domain using .NET by adding a service reference in VWD and uploading the files it generated and then using the respective namespace.

    But I can't get it to work with PHP, and am a complete noob with PHP. I've basically just copied the example from Using WCF Services with PHP - Gunnar Peipman's ASP.NET blog and Using WCF Services With PHP 5 Geers’ Blog
    PHP Code:
    <?php
    header
    ('Content-Type: text/plain');

    echo 
    "WCF Test\r\n\r\n";

    $client = new SoapClient('http://www.mydomain.com/webservices/mysoapEmailService.svc?wsdl');
    $obj->loc "none";
    $obj->emailTo "myemail@mydomain.com";
    $obj->emailFrom "myemail@myotherdomain.com";
    $obj->subject "test";
    $obj->message "test message";
    $retval $client->SendEmail($obj);

    echo 
    "Message: " $retval->message;
    ?>
    And All I get when I run it is 500 - Internal Server Error.

    I installed PHP on my windows 2008 IIS7 server using the Web Platform Installer and I have run a simple PHP page, echo "Some Text" sort of thing. I've also commented out the code above on the $retval variable line and it runs fine, so it's obviously the call to the method that's wrong.

    Any ideas how I go about debugging / solving this problem?

  2. #2
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    Oh...I've tried changing the PHP.ini file to display_errors = On etc. and still get the 500 error

  3. #3
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    OK. I think I've got somewhere.

    It seems PHP doesn't like wsHttpBinding and you have to use basicHttpBinding for the endpoint.

    Also, my ServiceContract only had a WebGetAttribute. I added a WebInvoke Method="POST" attribute and it is calling the web service now...w00t...

+ Reply to Thread

Similar Threads

  1. Web Service is undefined
    By richyrich in forum .NET Development
    Replies: 7
    Last Post: June 10th, 2009, 10:49 AM
  2. Web service returning XML string
    By richyrich in forum JavaScript Programming
    Replies: 2
    Last Post: June 9th, 2009, 07:04 AM
  3. Returning XML document from Web Service
    By richyrich in forum .NET Development
    Replies: 8
    Last Post: April 17th, 2009, 09:24 AM
  4. Accessing a Public Property in a web service
    By richyrich in forum .NET Development
    Replies: 0
    Last Post: May 23rd, 2008, 09:42 AM
  5. windows service send emails every 10 days
    By peebman2000 in forum .NET Development
    Replies: 8
    Last Post: May 20th, 2008, 05:00 PM

Tags for this Thread

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

SEO by vBSEO