I've been trying to find out which version of SOAP 1.1/1.2 being using in WSDL generated using WCF BasicHTTPBinding. But I've not been able to pin-point.
I need to confirm this so that I can tell me clients that we are using specific version of SOAP. The requirement is to use SOAP 1.1. From what I read BasicHttpBinding uses SOAP1.1 but not being able to find or check.
Could someone please help.
e.g.
<wsdl:definitions name="MyService" targetNamespace="http://mydomain.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://spotless.com/isb/services" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
In your WSDL definition WCF includes namespaces for both SOAP 1.1. and SOAP 1.2. Namespace for SOAP 1.1 has prefix soap. SOAP 1.1 endpoint will use only this namespace:
<wsdl:binding name="SomeBinding" type="...">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="GetTime">
<soap:operation soapAction="..." style="..." />
<wsdl:input name="...">
<soap:body use="..." />
</wsdl:input>
<wsdl:output name="...">
<soap:body use="..." />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="...">
<wsdl:port name="..." binding="tns:SomeBinding">
<soap:address location="..." />
</wsdl:port>
</wsdl:port>
Do you see all these elements prefixed by soap? That means SOAP 1.1 because soap prefix is defined for SOAP 1.1 namespace. If it uses soap12 prefix instead it will mean SOAP 1.2.
If WCF service has multiple endpoints it will have multiple wsdl:port elements and each can refer to its ownwsdl:binding specification with different version of SOAP and different policies (I skipped policy references in the example).
BasicHttpBinding in WCF always uses SOAP 1.1.
Related
I have a WCF service that needs to be exposed over a SOAP endpoint (wsHttpBinding) and a REST endpoint (webHttpBinding). I have included Names and Namespaces on the relevant attributes to aid in versioning (tempuri.org should be completely eliminated from the WSDL). For some reason, if I don't add a bindingNamepace attribute on the webHttpBinding endpoint, it adds a tempuri.org namespace in the WSDL. Example WSDL output is below.
WSDL without bindingNamespace -
<wsdl:definitions name="State" targetNamespace="http://example.com/services/masterdat/state/2012/02/05"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:tns="http://example.com/services/masterdata/state/2012/02/05"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:i0="http://tempuri.org/"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
WSDL with bindingNamespace -
<wsdl:definitions name="State" targetNamespace="http://example.com/services/masterdata/state/2012/02/05"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:tns="http://example.com/services/masterdata/state/2012/02/05"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
Here is my web.Config for the endpoints. I am using WCFExtras to flatten my WSDLs (hence the behaviorConfiguration on the wsHttpBinding endpoint), but the behavior is the same without it.
<services>
<service name="MasterDataExample.Services.StateService">
<!-- bindingConfiguration="defaultWsBinding" -->
<endpoint address="soap"
behaviorConfiguration="flatWsdl"
binding="wsHttpBinding"
bindingNamespace="http://example.com/services/masterdata/state/2012/02/05"
contract="MasterDataExample.Services.IStateService"
name="soap" />
<!-- -->
<endpoint address="json"
behaviorConfiguration="json"
binding="webHttpBinding"
bindingNamespace="http://example.com/services/masterdata/state/2012/02/05"
contract="MasterDataExample.Services.IStateService"
name="ajax" />
</service>
</services>
I've loaded up WCFExtras in my solution and looked at the WsdlExporter to see if I can find the mention of tempuri.org with no success. I've also used XSharper.Core to dump the object graph to see if I could find it. It isn't there.
Has anyone experienced this before? As a work around, I'll include the bindingNamespace on the webHttpBinding endpoint to keep the WSDL clean, but I'd like to know why this is occurring.
Thanks!
It seems that the BindingNamespace is required in your endpoint configuration to remove the tempuri.org namespace completely from your WSDL. See this post (item 3).
I have a simple IIS hosted service that I need to expose both through a wsHttpBinding endpoint without throttling and a basicHttpBinding endpoint with throttling.
I configure my services as follows:
<service name="Calculator">
<endpoint address="http://localhost/WCFTwoEndpoints/Calculate.svc"
binding="wsHttpBinding" bindingConfiguration="" name="Calculator"
contract="WCFTwoEndpoints.ICalculate" />
</service>
<service name="ThrottledCalculator" behaviorConfiguration ="Throttled">
<endpoint address="http://localhost/WCFTwoEndpoints/ThrottledCalculate.svc"
binding="basicHttpBinding" bindingConfiguration="" name="ThrottledCalculator"
contract="WCFTwoEndpoints.ICalculate" />
</service>
This gives me two service endpoints, I can browse to each .svc individually and pull up the WSDL. Problem is, in each case the WSDL describes the service as using basicHttp binding, I would have expected wsHttp binding for the Calculate.svc.
I've pasted a section of the WSDL below:
<wsdl:binding name="BasicHttpBinding_ICalculate" type="tns:ICalculate">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Addition">
<soap:operation soapAction="http://tempuri.org/ICalculate/Addition" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Calculate">
<wsdl:port name="BasicHttpBinding_ICalculate" binding="tns:BasicHttpBinding_ICalculate">
<soap:address location="http://rb-t510/WCFTwoEndpoints/ThrottledCalculate.svc"/>
</wsdl:port>
</wsdl:service>
I think I've missed something obvious here but I can't spot it. Any ideas?
Many thanks
Rob.
I have service which should support SOAP and REST.
web.config
<system.web>
<webServices>
<protocols>
<add name="HttpGet" />
<add name="HttpPost" />
</protocols>
</webServices>
<httpRuntime executionTimeout="90" maxRequestLength="1048576" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100"/>
<compilation debug="true" targetFramework="4.0"/>
and contract
[OperationContract]
[WebInvoke(UriTemplate = "/GetData")]
List<FieldInfo> GetSerializedData();
When I invoke REST service in Fiddler Request builder I get result in JSON and XML clearly. But I can not find way to invoke soap endpoint,always get 404 error
Not Found
Not Found
HTTP Error 404. The requested resource is not found.
For me it is strange cause in WCF TEST Client return SOAP withou problem, so why Fiddler have problem. I invoke in Fiddler directly wcf service methods on bindings.
I've got a requirement to connect to a web service using a digital signature. I'm using .NET 4.0 and WCF (Service Reference), and X509 SSL certificate, but can't find any suitable instructions on how to properly accomplish the goal.
I've found hundreds and hundreds of posts and blogs, etc, on encrypting soap messages, signing data, and the lot, with numerous examples using everything from X509Certificate1, X509Certificate2, X509Certificate3, DSACryptoServiceProvider, RSACryptoServiceProvider, setting up config in the web.config, setting up the config in code, using basicHttpBinding, or wsHttpBinding, or using WSE, WSE2, WSE3, ad nauseum.
Basically, I've found all kinds of information that is completely useless to me, as I've not been able to find a single complete example of how to simply add a digital signature to a soap message.
It certainly sounds like it should be a simple process, by the reading of examples of what digital signatures are, but I can't find a single useful implementation.
Can someone please point me in the right direction?
I think it depends on the security setup in the WCF binding. If you're just looking for the structure of your SOAP message, create a client using .NET and turn message logging on for the service. That will record every message being sent back and forth. I had to do this once, and found that the data encoding WCF uses (TLSNego) is proprietary, so a non-WCF client won't work.
A bit of a late answer, but hopefully this might help someone who lands here...
Using WCF client to connect to a SOAP service that used WS-Security with digital signature on the messages means you have to use a custom client binding. Some of the details might vary depending on your service, for example, the service WSDL (or the service provider might tell you if you cannot get the WSDL) might define a different message security version, but I have made this work using a client configuration like this:
<bindings>
<customBinding>
<binding name="WSHttpBinding_IService">
<security defaultAlgorithmSuite="Default" authenticationMode="SecureConversation"
requireDerivedKeys="true" includeTimestamp="true" messageProtectionOrder="SignBeforeEncrypt"
messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
requireSignatureConfirmation="false" canRenewSecurityContextToken="true">
<secureConversationBootstrap defaultAlgorithmSuite="Default"
authenticationMode="MutualSslNegotiated" requireDerivedKeys="true"
includeTimestamp="true" messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
requireSignatureConfirmation="false">
<localClientSettings detectReplays="true" />
<localServiceSettings detectReplays="true" />
</secureConversationBootstrap>
<localClientSettings detectReplays="true" />
<localServiceSettings detectReplays="true" />
</security>
<textMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
i am trying to access a https wcf service from silverlight.
the clientaccesspolicy is placed on service root and i have validated through silverlightspy its showing it as valid and calls allowed.
i am able to call that webservice successfully from desktop client but when tries to call from silverlight it throws an error that call to .... service failed may be cross domain poliecy etc is not valid....
any ideas????
here is the service cross domain policy too:
<?xml version="1.0" encoding="utf-8"?>
<access-policy> <cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*" />
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/" />
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
You need a separate domain node for https:
<domain uri="https://*" />
From this post:
http://timheuer.com/blog/archive/2008/10/14/calling-secure-services-with-silverlight-2-ssl-https.aspx
This is a great source of silverlight + wcf info:
http://www.netfxharmonics.com/2008/11/Understanding-WCF-Services-in-Silverlight-2
If the service and the silverlight app are served from the same web site and you are using Silverlight 4, you can accomplish this without a cross domain policy file by:
Accessing the silverlight application through https
Using a relative address in the ServiceReferences.ClientConfig file to access the service
Using transport mode security in the BasicHttpBinding for the service.
Here's an example of the ServiceReferences.ClientConfig:
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMyService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<!--Transport mode security (setup the same way on the server):-->
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<!--Relative address (This is the part that requires SL4):-->
<endpoint address="../Services/MyService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyService"
contract="MyApplication.MyService" name="BasicHttpBinding_IMyService" />
</client>
</system.serviceModel>
</configuration>
Have you looked here?
Calling WCF Service from Silverlight