如何实现Message Inspectors?

时间:2015-07-07 09:36:31

标签: java c# soap-client

我想构建一个soap Client .NET来联系Java Web服务。问题在于响应,因为签名没有Java和.NET的兼容性。 所以我想禁用.NET的验证响应,为此,我在MSDN上找到了这篇文章

https://msdn.microsoft.com/en-us/library/aa717047.aspx

我可以读到,插入一个拦截响应的方法是可能的,我可以绕过检查。但我无法做到这一点。 我在我的项目中写了导入这些类:

SchemaValidationBehavior
SchemaValidationBehaviorExtensionElement
SchemaValidationMessageInspector

这是我的app.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>

    <startup> 
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
    </startup>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="MyNewService">
                  <security defaultAlgorithmSuite="Basic128" authenticationMode="MutualCertificate" requireDerivedKeys="false" securityHeaderLayout="Lax" includeTimestamp="true" messageProtectionOrder="SignBeforeEncrypt" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSignatureConfirmation="false">
                    <localClientSettings detectReplays="true"/>
                    <localServiceSettings detectReplays="true"/>
                  </security>
                    <textMessageEncoding messageVersion="Soap11WSAddressing10"/>
                    <httpsTransport/>

                </binding>
            </customBinding>
        </bindings>
        <client>
          <endpoint address="https://edottotest.sanita.regione.rsr.rupar.puglia.it/nsisr/PianoAssistenzialeResidenzialeService" binding="customBinding" bindingConfiguration="MyNewService" contract="PianoAssistenzialeResidenzialeService.PianoAssistenzialeResidenziale" name="PianoAssistenzialeResidenzialePort" >
            <identity>
              <dns value="HEALTHNETBR"/>

            </identity>

          </endpoint>

        </client>


    </system.serviceModel>
</configuration>

我认为问题出在这个档案上。

0 个答案:

没有答案