none
How to consume WCF service from PHP client ? RRS feed

  • Question

  • Hi all,

    <system.serviceModel>
    		<bindings>
    			
    
    			<basicHttpBinding>
    				<binding name="legacy">
    					<security mode="Transport" >
    						<transport  clientCredentialType="None"/>
    					</security>
    				</binding>
    			</basicHttpBinding>
    
    
    		</bindings>
    
    
    		<behaviors>
    
    
    			<serviceBehaviors>
    				<behavior name="My.Services.WCFBehavior">
    					<serviceMetadata httpsGetEnabled="true"/>
    					<serviceDebug includeExceptionDetailInFaults="false"/>
    				</behavior>
    			</serviceBehaviors>
    
    
    			<endpointBehaviors>
    				<behavior name="WebBehavior">
    					<webHttp />
    				</behavior>
    			</endpointBehaviors>
    
    
    		</behaviors>
    
    
    		<services>
    			<service behaviorConfiguration="My.Services.WCFBehavior"
    					 name="My.Services.WCFServiceWCFService">
    						
    
    				<endpoint address=""
    						binding="basicHttpBinding"
    						bindingConfiguration="legacy"
    						contract="My.Services.WCFService.ISingleSignOnWCFService" />
    				
    
    				<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    			</service>
    
    
    			<service behaviorConfiguration="My.Services.WCFBehavior"
    					 name="My.Services.Security.ServicesSecurity">
    				
    
    				<endpoint address=""
    								binding="basicHttpBinding"
    								bindingConfiguration="legacy"
    								contract="My.Services.Security.IServiceSecurity" />
    				
    
    				<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    			</service>
    
    
    		</services>
    		<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
    	</system.serviceModel>

    For IIS 6 I added SSL certificate.And when I try use this service from browser I see WSDL by HTTPS  protocol.We have used custom authetication.

    https://localhost/ServicesSecurity.svc?wsdl 

    Also I have PHP and Apace server what using 82 port http://localhost:82/soap.php.In soap.php  I wrote next 

    <?php // $orig_error_reporting = error_reporting(); // error_reporting(0); $soap = new SoapClient("https://localhost/SingleSignOnWCFService.svc?wsdl", array('soap_version' => 'SOAP_1_2', 'location'=>'https://localhost/SingleSignOnWCFService.svc',

    'login' => 'TestUser',

    'Password'=> 'user")); $response = $soap->Authenticate() ; print $response->AuthenticateResult ; ?>

    I got error with soap:

    Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://localhost/SingleSignOnWCFService.svc?wsdl' : failed to load external entity "https://localhost/SingleSignOnWCFService.svc?wsdl" in C:\wamp\www\soap.php:7 Stack trace: #0 C:\wamp\www\soap.php(7): SoapClient->SoapClient('https://localho...', Array) #1 {main} thrown in C:\wamp\www\soap.php on line 7

    Is the above process is correct for consuming the WCF service in php client?

    Wednesday, February 5, 2014 6:23 PM

Answers