Can't send WCF Service request as SOAP+XML

最后都变了- 提交于 2019-12-08 10:11:49

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/6186663/cant-send-wcf-service-request-as-soapxml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!