[英]Configuration to an binding using soap 1.2 in a WCF Project to be consumed for a non C# client
i have study and read about it a little, but i can't do this yet so i post this question. 我已经学习并了解了一点,但是我还不能做到这一点,所以我发布了这个问题。 Here is my binding configuration:
这是我的绑定配置:
<bindings> <customBinding> <binding name="httpSoap12"> <textMessageEncoding messageVersion="Soap12"/> <httpTransport /> </binding> </customBinding> </bindings> <services> <service name="Service.OnOffService"> <host> <baseAddresses> <add baseAddress = "http://192.168.0.14:5554/Service/OnOffService" /> </baseAddresses> </host> <endpoint address="soap12" binding="customBinding" bindingConfiguration="httpSoap12" contract="Service.IOnOffService">
and this is my contract: 这是我的合同:
[ServiceContract(Namespace = "http://testeService")]
public interface IOnOffService
{
[OperationContract]
string OnOff(string Usuario);
}
and here i build the Envelope to consume this service: 在这里,我构建了信封来使用此服务:
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>"
the problem is, i've received a 400 bad request error.... 问题是,我收到了400错误的请求错误...。
I think you must binding="basicHttpBinding" on endpoint. 我认为您必须在终结点上绑定=“ basicHttpBinding”。
App.config of my project . 我的项目的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>
Also you can look my web site about soap but my web is turkish . 您也可以浏览我的肥皂网站,但我的网站是土耳其语。 There are codes in there .
里面有密码。 cihanasan.com
cihanasan.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.