This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.ServiceModel; | |
namespace WcfServiceLibrary1 | |
{ | |
[ServiceContract(Namespace = "http://tempuri.org")] | |
public interface IService1 | |
{ | |
[OperationContract] | |
string GetData(int value); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.ServiceModel; | |
namespace WcfServiceLibrary1 | |
{ | |
[ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)] | |
public class Service1 : IService1 | |
{ | |
public string GetData(int value) | |
{ | |
return string.Format("You entered: {0}", value); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8" ?> | |
<configuration> | |
<system.web> | |
<compilation debug="true" /> | |
</system.web> | |
<system.serviceModel> | |
<services> | |
<service name="WcfServiceLibrary1.Service1"> | |
<host> | |
<baseAddresses> | |
<add baseAddress = "http://localhost:8733/test/WcfServiceLibrary1/Service1/" /> | |
</baseAddresses> | |
</host> | |
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1" contract="WcfServiceLibrary1.IService1"> | |
<identity> | |
<dns value="localhost"/> | |
</identity> | |
</endpoint> | |
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> | |
</service> | |
</services> | |
<bindings> | |
<wsHttpBinding> | |
<binding name="WSHttpBinding_IService1" openTimeout="00:10:00" | |
closeTimeout="00:10:00" | |
receiveTimeout="00:10:00" | |
sendTimeout="00:10:00" | |
maxReceivedMessageSize="2147483647" | |
maxBufferPoolSize="2147483647"> | |
<security mode="None" /> | |
<reliableSession enabled="false" /> | |
</binding> | |
</wsHttpBinding> | |
</bindings> | |
<behaviors> | |
<serviceBehaviors> | |
<behavior> | |
<serviceMetadata httpGetEnabled="True" httpGetUrl="http://localhost:8733/test/WcfServiceLibrary1/Service1/"/> | |
<serviceDebug includeExceptionDetailInFaults="False" /> | |
</behavior> | |
</serviceBehaviors> | |
</behaviors> | |
</system.serviceModel> | |
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$params = array("soap_version"=> SOAP_1_2, | |
"trace"=>1, | |
"exceptions"=>0, | |
); | |
$client = new SoapClient('http://localhost:8733/test/WcfServiceLibrary1/Service1/?wsdl',$params); | |
$actionHeader = new SoapHeader('http://www.w3.org/2005/08/addressing','Action','http://tempuri.org/IService1/GetData',true); | |
$client->__setSoapHeaders($actionHeader); | |
$params = new StdClass; | |
$params->value = 2; | |
$retval = $client->GetData($params); | |
if (is_soap_fault($retval)) { | |
trigger_error("SOAP Fault: (faultcode: {$retval->faultcode}, faultstring: {$retval->faultstring})", E_USER_ERROR); | |
} | |
else{ | |
echo $retval->GetDataResult; | |
} | |
} catch (Exception $e) { | |
echo 'Caught exception: ', $e->getMessage(), "\n"; | |
} | |
?> |