I feel like this has probably been answered and maybe I am not searching with the right terms.
I have a WCF service that acting like a proxy. It is a middle man for two services that normally can talk to each other, but now go through this new service.
Old: A -> B
New: A -> MM -> B
I need to expose the same contract as a service endpoint (for "A" to talk to "MM") and as a client endpoint (for "MM" to talk to "B").
Can these two share a binding configuration and just give the endpoints different names? Or is there a better way to handle this scenario?
(inside of <system.serviceModel>
tag)
<client>
<endpoint address="http://<remoteaddress>/" binding="basicHttpBinding"
bindingConfiguration="MyBinding" contract="IService" name="ToB" />
</client>
<services>
<service behaviorConfiguration="Behavior" name="Service">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="MyBinding" name="FromA" contract="IService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/MyService" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="MyBinding" closeTimeout="00:15:00" openTimeout="00:15:00"
receiveTimeout="00:15:00" sendTimeout="00:15:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2048000000" maxBufferPoolSize="2048000000"
maxReceivedMessageSize="2048000000" messageEncoding="Text"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="4065536" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None"
proxyCredentialType="None" realm="" />
<message clientCredentialType="UserName"
algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
Edit:
The error message with this setup is:
com.vsp.cal.webservice.external.SystemFault
Stack: Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
A change in name is not enough to uniquely define an endpoint. Instead goes back to the old "ABC" - address, binding, contract. At least one of those must be different to uniquely define a new endpoint. http://msdn.microsoft.com/en-us/library/ms733107(v=vs.100).aspx
Does this help?
Thank you to everyone who looked this over and tried to help!
In the end it was not the configuration, but a stupid coding error. The cryptic error message is the response from the other side (a Java web service). It wasn't happy because I was sending a null object due to a failed cast.
So the answer is that this configuration DOES WORK when you don't code like an idiot.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.