0

Using Visual Studio 2010, I developed a WCF service hosted on a web application for a third party to use. They're telling me that they cannot invoke it. For testing, they redirected me to Altova XmlSpy and pointed out that, when creating a new SOAP request, if they choose the "Send as SOAP+XML (SOAP 1.2)" check in the "Change SOAP Request parameters" menu item, they get the following two alert dialogs:

HTTP error: could not POST file ‘/TurniArc/WebServices/Processi.svc’ on server ’10.51.0.108’ (415)

Error sending the soap data to ‘http://10.51.0.108/TurniArc/WebServices/Processi.svc’ HTTP error: could not POST file ‘/TurniArc/WebServices/Processi.svc’ on server ’10.51.0.108’ (415)

I indeed verified that. Unchecking that option, request is submitted as wanted. And I never had any problem invoking my web service with soapUI, the software I always used for in-house testing.

This is the first Web Service I create, starting without any theorical knowledge (but I guess everybody does :-) ), so I'm not even sure where to poke around to fix this. Could the problem lie in the binding? I created the service using Add/New Item/WCF Service and leaving all the default option, so it should be BasicHttpBinding

This is the serviceModel part of my web.config

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true"/>
<!--other bindings related to proxies to other services I'm invoking -->
</system.serviceModel>

My interface only has the

[ServiceContract(Namespace="http://www.archinet.it/HRSuite/Processi/")]

attribute and the class implementing it has the

[ServiceBehavior(IncludeExceptionDetailInFaults = true, Namespace = "http://www.archinet.it/HRSuite/Processi/")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

attributes

Thank you

Edit: The third party is using the Oracle SOA Middleware

Piddu
  • 383
  • 2
  • 10
  • 20

1 Answers1

3

BasicHttpBinding uses SOAP 1.1 so you cannot send request in SOAP 1.2 to the endpoint using this binding. HTTP status code 415 means unsupported media type which also implies this because SOAP 1.1 uses text/xml content type whereas SOAP 1.2 uses application/soap+xml content type.

If you want BasicHttpBinding equivalent with SOAP 1.2 without any other WS-* stuff included in WsHttpBinding you need to create custom binding. The simplest version looks like:

<bindings>
  <customBinding>
    <binding name="soap12">
      <textMessageEncoding messageVersion="Soap12" />
      <httpTransport />
    </binding>
  </customBinding>
</bindings>

Then you must manually define the endpoint for your service (at the moment you are using default endpoint):

<services>
  <service name="YourNamespace.YourServiceClass">
    <endpoint address="" binding="customBinding" bindingConfiguration="soap12" 
              contract="YourNamespace.YourServiceContractInterface" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

Anyway I hardly believe that reconfiguring the SOAP version for consuming your service in Oracle SOA middleware takes more then few minutes.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • As I Just wrote in the message, they're using the Oracle SOA, so, provided they can change the request format, every little edit they have to make is a long ang heavy matter. Since my side is more agile, I thought to allign my software; I researched this morning, and wsHttpBinding seems better overall. Is it? – Piddu May 31 '11 at 12:50
  • "I hardly believe that reconfiguring the SOAP version for consuming your service in Oracle SOA middleware takes more then few minutes." Well, in the past they've told me that for every update they had to re-deploy everything, and it always took a few days! Anyway, I'll try your code right away, thanks – Piddu May 31 '11 at 13:15
  • Same exact error can mean that your configuration is not used. Try to make some error in the config - for example non existing contract. – Ladislav Mrnka May 31 '11 at 15:02
  • I set messageVersion = "Soap122" and I got `The value of the property 'messageVersion' cannot be parsed. The error is: The value 'Soap122' is not a valid instance of type 'System.ServiceModel.Channels.MessageVersion'. Parameter name: value ` when trying to open the service url in the browser, so I'm afraid this isn't the case. And obviously neither XmlSpy nor soapUI could create their proxies – Piddu May 31 '11 at 15:22
  • Can you verify in wsdl or soapUI that the service really exposes soap 1.2 endpoint? – Ladislav Mrnka May 31 '11 at 15:27
  • in soapUI, the Interface properties panel of the project returns the value "SOAP 1.2" for the Property "SOAP Version" and here is an extract of the wsdl: ` `where soap12 points to namespace http://schemas.xmlsoap.org/wsdl/soap12/ – Piddu May 31 '11 at 15:29
  • So it looks like you have your soap 1.2 endpoint. Are you able to post valid request from soapUI? – Ladislav Mrnka May 31 '11 at 15:39
  • And XML spy still doesn't work (btw. XmlSpy soap features are poor)? If it still doesn't work compare soap requests send by XmlSpy and SoapUI – Ladislav Mrnka May 31 '11 at 15:46
  • Actually, now XmlSpy gives a different error. It doesn't like my wsdl anymore: "message 'MyMessage' is defined more than once! (next occurrence: 'MyMessage')" but I only find one, even considering the import... Uff, I'm tired! Thank you very much for sticking – Piddu May 31 '11 at 15:52
  • As as update, they just told me they cannot make a SOAP 1.1 request with their version of the Middleware, only SOAP 1.2. I still can't get it to work, so my problem remains open – Piddu Jun 01 '11 at 10:37
  • You made it work - SoapUI is able to send valid SOAP 1.2 request. – Ladislav Mrnka Jun 01 '11 at 10:38
  • You may be right, but something's strange: I'm trying with other test softwares (namely, WcfTestClient, WCFStorm 1.3.0 Lite, and Visual Studio/Add Service Reference) with the new wsdl and they all find two endpoints for the service, with the same binding, contract and address. I now understand the error message XmlSpy gives, but then why all the others have no problem creating the proxies? WCFTestClient and WCFStorm Lite can even send their request (although I have no idea what SOAP version are they using), while Visual Studio throws the exception that more than endpoint is defined – Piddu Jun 01 '11 at 11:02
  • Are two endpoints defined in WSDL? Check it and the names will also say something about used bindings etc. – Ladislav Mrnka Jun 01 '11 at 11:08
  • The wsdl is like I posted 19 hours ago: one service node, one soap12:address node – Piddu Jun 01 '11 at 11:18
  • And what about MyMessage - it can also be referenced from xsd file. – Ladislav Mrnka Jun 01 '11 at 11:20
  • As before, the only references to MyMessage are ``, and `` which I'm sure it's not a definition but a usage of that name. This throughout 2 wsdl's and 2 xsd's – Piddu Jun 01 '11 at 12:41
  • They just notified me it still doesn't work, neither from XmlSpy nor from the SOA – Piddu Jun 01 '11 at 14:43
  • The answer was indeed correct, we were also having other problems not related to bindings. Thank you again – Piddu Jun 13 '11 at 09:01