WCF客户端PHP-获取“错误请求”或“安全错误”

时间:2018-09-13 10:25:39

标签: php xml windows wcf soap

我正在尝试从使用WCF的Web服务获得响应。服务器使用SOAP 1.1(WS-I Basic Profile 1.1)的“ BasicHTTPBinding”协议。

app.config:

<system.serviceModel>
<bindings>
    <basicHttpBinding>
        <binding name="BasicHttpBinding_firmaService" sendTimeout="00:01:00" receiveTimeout="00:10:00"
        maxBufferSize="500000000" maxBufferPoolSize="500000000" maxReceivedMessageSize="500000000">
            <readerQuotas maxDepth="32" maxStringContentLength="500000000" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
    </basicHttpBinding>
</bindings>
<behaviors>
    <endpointBehaviors>
        <behavior name="XXXBehavior">
            <dataContractSerializer maxItemsInObjectGraph="50000000"/>
        </behavior>
    </endpointBehaviors>
</behaviors>
<client>
    <endpoint address="https://xyz.firma.com/V2xx/Service.svc" behaviorConfiguration="XXXBehavior" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_firmaService" contract="ServiceReferenceXXX.firmaService" name="BasicHttpBinding_firmaService" />
</client>

,并且请求应如下所示:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <u:Timestamp u:Id="_0">
            <u:Created>2018-09-05T14:55:19.366Z</u:Created>
            <u:Expires>2018-09-05T15:00:19.366Z</u:Expires>
        </u:Timestamp>
        <o:UsernameToken u:Id="uuid-f6651994-dbbb-4765-b3d0-a2489410ffda-5">
            <o:Username>user</o:Username>
            <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">pass</o:Password>
        </o:UsernameToken>
    </o:Security>
</s:Header>
<s:Body>
    <getServiceTest xmlns="http://tempuri.org/">
        <filter xmlns:a="http://www.enterprise.de/modell2.1.0.1.0" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
            <a:Erweiterung i:type="a:Anfrage">
                <a:FreieAttribute i:nil="true"/>
                <a:VorgabeModus>Testbetrieb</a:VorgabeModus>
                <a:VorgabeLand>D</a:VorgabeLand>
                <a:VorgabeNurPlaintext>false</a:VorgabeNurPlaintext>
                <a:VorgabeProfil i:nil="true"/>
                <a:VorgabeSparte>KeineAngabe</a:VorgabeSparte>
                <a:VorgabeTarifart>Keine</a:VorgabeTarifart>
            </a:Erweiterung>
            <a:BiPROVersion i:nil="true"/>
            <a:ConsumerID i:nil="true"/>
            <a:Input>Test it!</a:Input>
        </filter>
    </getServiceTest>
</s:Body>

我的问题:
步骤应该是什么样?
如何从服务器获得响应?

感谢您的帮助。

0 个答案:

没有答案