I have to use a SOAP web service in a VPN network (so you couldn't test it), written in Java (JAX-WS webservice). I don't have access at server side. When i try to call a web method from a C# 4.0 client I get this exception:
The CustomBinding on the ServiceEndpoint with contract 'ServicesSoap' lacks a TransportBindingElement. Every binding must have at least one binding element that derives from TransportBindingElement.
at System.ServiceModel.Channels.Binding.EnsureInvariants(String contractName)
at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
at System.ServiceModel.ChannelFactory.CreateFactory()
at System.ServiceModel.ChannelFactory.OnOpening()
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ChannelFactory.EnsureOpened()
at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
at System.ServiceModel.ClientBase`1.CreateChannel()
at System.ServiceModel.ClientBase`1.CreateChannelInternal()
at System.ServiceModel.ClientBase`1.get_Channel()
at GatewayClient.Lotto.ServicesSoapClient.GatewayClient.Lotto.ServicesSoap.InfoRequest(InfoRequestRequest request)
at GatewayClient.Lotto.ServicesSoapClient.InfoRequest(infoDataIn request)
at GatewayClient.MainWindow.InfoRequestButton_Click(Object sender, RoutedEventArgs e)
This is my app.config:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="ServicesSoapPortBinding">
<textMessageEncoding messageVersion="Soap12" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://xxx.yyy/Services"
binding="customBinding" bindingConfiguration="ServicesSoapPortBinding"
contract="ServiceReference1.ServicesSoap" name="ServicesSoapPort" />
</client>
</system.serviceModel>
Any help?
I've solved the issue adding httpTransport in the binding tag, in the app.config:
<binding name="ServicesSoapPortBinding">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport/>
</binding>
I have to add the service reference within Visual Studio "Service References" feature. Trying to use svcutil, I get another different exception.