2011-05-31 148 views
0

使用Visual Studio 2010中,我开发一个Web应用程序托管的第三方使用WCF服务。他们告诉我他们不能调用它。为了测试,他们将我重定向到Altova XmlSpy,并指出,在创建新的SOAP请求时,如果他们选择“作为SOAP + XML发送(SOAP 1.2)”,请在“更改SOAP请求参数”菜单项中选中,以下两个警报对话框:无法发送WCF服务请求作为SOAP + XML

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) 

我确实证实了这一点。 取消选中该选项,请求按需要提交。我从来没有用soapUI来调用我的web服务,这是我一直用于内部测试的软件。

这是第一个Web服务创建,开始没有任何中的理论知识(但我想每个人都没有:-)),所以我甚至不知道从哪里闲逛来解决这个问题。问题在于绑定吗?我创建使用添加/新项目/ WCF服务,保留所有默认选项的服务,所以应该basicHttpBinding的

这是我的web.config的serviceModel部分

<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> 

我的接口只有在

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

属性和类实现它具有

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

个属性

谢谢

编辑:第三方是否正在使用Oracle SOA中间件

回答

2

BasicHttpBinding使用SOAP 1.1,所以你不能在SOAP 1.2请求发送到使用此绑定的端点。 HTTP状态码415表示不支持的媒体类型,这也暗示了这一点,因为SOAP 1.1使用text/xml内容类型,而SOAP 1.2使用application/soap + xml内容类型。

如果你想basicHttpBinding的等效采用SOAP 1.2,没有任何其他的WS- *的东西包含在WsHttpBinding的你需要创建自定义绑定。最简单的版本是这样的:

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

然后,你必须手动定义为您服务端点(此刻的你正在使用默认端点):

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

无论如何,我很难相信,重新配置SOAP版本因为在Oracle SOA中间件中使用您的服务需要几分钟的时间。

+0

那么什么是正确的绑定? WsHttpBinding的? – Piddu 2011-05-31 12:29:11

+0

没有以正确的方式是向您发送SOAP 1.1 – 2011-05-31 12:34:29

+0

请求正如我刚才在邮件中写道,他们正在使用Oracle SOA,所以,只要它们能够改变请求格式,他们必须做出每个小编辑是一个长期的昂重的事情。由于我的身体更加敏捷,我认为我的软件是一致的;今天早上我研究了一下,wsHttpBinding整体看起来更好。是吗? – Piddu 2011-05-31 12:50:28