在WCF项目中使用soap 1.2对绑定进行配置,以供非C#客户端使用
我已经研究并阅读了一点,但我还不能做这件事,所以我发布了这个问题。 以下是我的绑定配置:在WCF项目中使用soap 1.2对绑定进行配置,以供非C#客户端使用,c#,wcf,soap,C#,Wcf,Soap,我已经研究并阅读了一点,但我还不能做这件事,所以我发布了这个问题。 以下是我的绑定配置: 这是我的合同: [ServiceContract(Namespace = "http://testeService")] public interface IOnOffService { [OperationContract] string OnOff(string Usuario); } 在这里,我构建了使用此服务的信封: sEnv = sEnv & "<soap:En
这是我的合同:
[ServiceContract(Namespace = "http://testeService")]
public interface IOnOffService
{
[OperationContract]
string OnOff(string Usuario);
}
在这里,我构建了使用此服务的信封:
sEnv = sEnv & "<soap:Envelope xmlns:soap=""http://www.w3.org/2003/05/soap- envelope"" xmlns:tem=""http://testeService/"">"
sEnv = sEnv & " <soap:Header xmlns:wsa=""http://www.w3.org/2005/08/addressing"">"
sEnv = sEnv & " <wsa:Action>http://testeService/IOnOffService/OnOff</wsa:Action>"
sEnv = sEnv & " <wsa:To>http://192.168.0.14:5554/Service/OnOffService</wsa:To>"
sEnv = sEnv & " </soap:Header>"
sEnv = sEnv & " <soap:Body>"
sEnv = sEnv & " <tem:OnOff>"
sEnv = sEnv & " <tem:Usuario>A</tem:Usuario>"
sEnv = sEnv & " </tem:OnOff>"
sEnv = sEnv & " </soap:Body>"
sEnv = sEnv & "</soap:Envelope>"
sEnv=sEnv&“
sEnv=sEnv&“
sEnv=sEnv&“http://testeService/IOnOffService/OnOff"
sEnv=sEnv&“http://192.168.0.14:5554/Service/OnOffService"
sEnv=sEnv&“
sEnv=sEnv&“
sEnv=sEnv&“
sEnv=sEnv&“A”
sEnv=sEnv&“
sEnv=sEnv&“
sEnv=sEnv&“
问题是,我收到了一个400错误请求….我认为您必须在端点上绑定=“basicHttpBinding”
我的项目的App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="WcfServiceLibrary1.Service1">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8733/Design_Time_Addresses/WcfServiceLibrary1/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address="" binding="basicHttpBinding" contract="WcfServiceLibrary1.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
URI中有一个空格,用于xmlns:soap
命名空间-”http://www.w3.org/2003/05/soap- 信封“
-那是打字错误吗?如果不是,则应为xmlns:soap=“”http://www.w3.org/2003/05/soap-envelope“
,我相信。