Page 1 of 1

WCF Services in PHP

Posted: Tue Apr 08, 2008 6:38 am
by lincy.chandy
Was trying to consume WCF services in php. Followed teh steps that was mentioned in

http://weblogs.asp.net/gunnarpeipman/ar ... entmessage
after creating a WCf service ( simple an add function) and hosted in teh IIS on a differnet machine in the same network.

The php code written was :

Code: Select all

<?php
header('Content-Type: text/plain');
 
echo  "Math Test ";
$client = new SoapClient('http://aditidt722.aditi.tech/MathService/Service.svc?wsdl');
$obj->value = 2;
 
$obj->value1 = 3;
 
$retval = $client->Add($obj);
echo "The Result is : ";
 
?>
But when i run this application i get this error:

Code: Select all

 
Math Test 
Fatal error: Uncaught SoapFault exception: [HTTP] Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'. in C:\Documents and Settings\lincyc\My Documents\PHPDocument1.php:10 
Stack trace: 
#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://aditidt7...', 'http://tempuri....', 1, 0) 
#1 [internal function]: SoapClient->__call('Add', Array) 
#2 C:\Documents and Settings\lincyc\My Documents\PHPDocument1.php(10): SoapClient->Add(Object(stdClass)) 
#3 D:\Program Files\Zend\ZendStudio-5.5.1\bin\php5\dummy.php(1): include('C:\Documents an...') 
#4 {main} 
thrown in C:\Documents and Settings\lincyc\My Documents\PHPDocument1.php on line 10
 
Can someone help me with this. One more info i need to share as i told WCf service is in IIS but the php is run using apache server.


Regards

Lincy

Re: WCF Services in PHP

Posted: Sat Apr 12, 2008 7:15 am
by Weirdan
it seems your webservice is misconfigured. You will need to reconfigure it to send responses with proper 'application/soap+xml' content type. It should be possible, as (according to SOAP specs):
Conforming implementations of this binding:

1. MUST be capable of sending and receiving messages serialized using media type "application/soap+xml" whose proper use and parameters are described in A. The application/soap+xml Media Type.