soapUI和CXF生成的soap消息之间的重要区别

时间:2016-09-01 16:11:56

标签: java soap cxf soapui

我第一次使用soap,我需要与在线Web服务提供商联系以请求令牌。 通过使用由webservice的创建者提供的教程,我设法在soapUI中请求令牌。

我想通过使用cxf从java创建这个请求,但java代码的输出根据web服务是无效的。

这是soupUI的输出

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
  <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
     <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-8734DCAC898A26C679147255132073337">***Removed***</wsse:BinarySecurityToken>
     <ds:Signature Id="SIG-8734DCAC898A26C679147255132073540" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <ds:SignedInfo>
           <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
              <ec:InclusiveNamespaces PrefixList="soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
           </ds:CanonicalizationMethod>
           <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
           <ds:Reference URI="#TS-8734DCAC898A26C679147255132073136">
              <ds:Transforms>
                 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                    <ec:InclusiveNamespaces PrefixList="wsse soapenv" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                 </ds:Transform>
              </ds:Transforms>
              <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
              <ds:DigestValue>xilelFj5FCGQNX+Szji+3TDVgGM=</ds:DigestValue>
           </ds:Reference>
           <ds:Reference URI="#id-8885DEBF4AF9AF3DCA147204399440011">
              <ds:Transforms>
                 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                    <ec:InclusiveNamespaces PrefixList="" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                 </ds:Transform>
              </ds:Transforms>
              <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
              <ds:DigestValue>66XFTbUdZKfJt5AnChcbGUCToKU=</ds:DigestValue>
           </ds:Reference>
           <ds:Reference URI="#X509-8734DCAC898A26C679147255132073337">
              <ds:Transforms>
                 <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                    <ec:InclusiveNamespaces PrefixList="" xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                 </ds:Transform>
              </ds:Transforms>
              <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
              <ds:DigestValue>PuyJGRSzgDa8/rrWn/uoNKL8KQY=</ds:DigestValue>
           </ds:Reference>
        </ds:SignedInfo>
        <ds:SignatureValue>AdQb7XfnYs8UxhvfVCcy8tkPiNOPul2FxKCynCLOazKgkIGLM54rCgK40UnbG44OJFisCWRJgdneIRADU19NcyTcPMSYzE249+Ew65daeGKD/VT3ppWkMI3eqrKmGQKZMx5rUn7eOi+x2MCHtQXYMCNm9P65jwh+bvy2gaY/SXmLxBRFoFVQCsH2/GSIRuwQnQf7eUNRhTSgquOcCJFHSMA+ieBLiGWHBkZvAUNQ0mktl/0mZba+SB+n1TupBRTbh4JllVol8c+/WlHVtiK5BVSMa/joS4ZzglCOaNPUEs2MANaUOQF88PNdgBcjr+uv2EMs3Exrg+al4zYLYRnqlw==</ds:SignatureValue>
        <ds:KeyInfo Id="KI-8734DCAC898A26C679147255132073338">
           <wsse:SecurityTokenReference wsu:Id="STR-8734DCAC898A26C679147255132073339">
              <wsse:Reference URI="#X509-8734DCAC898A26C679147255132073337" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
           </wsse:SecurityTokenReference>
        </ds:KeyInfo>
     </ds:Signature>
     <wsu:Timestamp wsu:Id="TS-8734DCAC898A26C679147255132073136">
        <wsu:Created>2016-08-30T10:02:00Z</wsu:Created>
        <wsu:Expires>2016-08-30T10:03:00Z</wsu:Expires>
     </wsu:Timestamp>
  </wsse:Security>
</soapenv:Header>
<soapenv:Body wsu:Id="id-8885DEBF4AF9AF3DCA147204399440011" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <wst:RequestSecurityToken Context="?" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
     <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>
     <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
     <wst:Claims Dialect="http://schemas.xmlsoap.org/ws/2006/12/authorization/authclaims">
        <auth:ClaimType Uri="urn:be:smals:expeditor:number" xmlns:auth="http://schemas.xmlsoap.org/ws/2006/12/authorization">
           <auth:Value>109199</auth:Value>
        </auth:ClaimType>
     </wst:Claims>
  </wst:RequestSecurityToken>

这是java输出:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="X509-8734DCAC898A26C679147255132073337">***Removed***</wsse:BinarySecurityToken>
        <wsu:Timestamp wsu:Id="TS-8734DCAC898A26C679147255132073136">
            <wsu:Created>2016-08-30T10:02:00Z</wsu:Created>
            <wsu:Expires>2016-08-30T10:03:00Z</wsu:Expires>
        </wsu:Timestamp>
        <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="SIG-8734DCAC898A26C679147255132073540">
            <ds:SignedInfo>
                <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                    <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="soapenv"/>
                </ds:CanonicalizationMethod>
                <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
                <ds:Reference URI="#TS-8734DCAC898A26C679147255132073136">
                    <ds:Transforms>
                        <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                            <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse soapenv"/>
                        </ds:Transform>
                    </ds:Transforms>
                    <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                    <ds:DigestValue>xilelFj5FCGQNX+Szji+3TDVgGM=</ds:DigestValue>
                </ds:Reference>
                <ds:Reference URI="#id-8885DEBF4AF9AF3DCA147204399440011">
                    <ds:Transforms>
                        <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                    </ds:Transforms>
                    <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                    <ds:DigestValue>AgqdnJqNrm1vHvk28as432oniGU=</ds:DigestValue>
                </ds:Reference>
                <ds:Reference URI="#X509-8734DCAC898A26C679147255132073337">
                    <ds:Transforms>
                        <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
                            <ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="soapenv"/>
                        </ds:Transform>
                    </ds:Transforms>
                    <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
                    <ds:DigestValue>DiSRIAlWMmsRWgOM+O2dyuhSjJE=</ds:DigestValue>
                </ds:Reference>
            </ds:SignedInfo>
            <ds:SignatureValue>PrEUX+5AC2ku6cry8QrU6QjG+5kO80xPSXJXkpOFNc/tlGuMeARnJyvBUHoIbmsUVZDI40i3mp+paqyYIkhoficThQzXKJlfRYBPt+bNAGEBVYx+FdkOvTrnLYYgAEjEuXIle73c9aFvS4HuHthKkmEFOFa50cbFEdjDEQecV1QBTqfdS16oPDyjiCp+4JfwvPqKqiJKqturfZ3jDLMtccxW1PTBAqq/4QKiAlhgr/qg4IEtvSdgJ5h8jyguLe7hxiXNgrgvYpom+EzoK0ADTQtwXwUYA4gO+dMe/G5ZVSH58+j4LKVq19SXj8iD66oC0zNH1gfmWZGMtmXG2v/lbw==</ds:SignatureValue>
            <ds:KeyInfo Id="KI-8734DCAC898A26C679147255132073338">
                <wsse:SecurityTokenReference wsu:Id="STR-8734DCAC898A26C679147255132073339">
                    <wsse:Reference URI="#X509-8734DCAC898A26C679147255132073337" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
                </wsse:SecurityTokenReference>
            </ds:KeyInfo>
        </ds:Signature>
    </wsse:Security>
</soapenv:Header>
<soapenv:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="id-8885DEBF4AF9AF3DCA147204399440011">
    <wst:RequestSecurityToken xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns4="http://www.w3.org/2005/08/addressing" xmlns:ns6="http://schemas.xmlsoap.org/ws/2006/12/authorization" xmlns:wst="http://docs.oasis-open.org/ws-sx/ws-trust/200512" Context="abc">
        <wst:TokenType>http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1</wst:TokenType>
        <wst:RequestType>http://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
        <wst:Claims Dialect="http://schemas.xmlsoap.org/ws/2006/12/authorization/authclaims">
            <auth:ClaimType xmlns:auth="http://schemas.xmlsoap.org/ws/2006/12/authorization" Uri="urn:be:smals:expeditor:number">
                <Value>109199</Value>
            </auth:ClaimType>
        </wst:Claims>
    </wst:RequestSecurityToken>
</soapenv:Body>

我知道这两条消息之间存在多种差异。 但由于我对肥皂缺乏了解,我不知道哪些差异很重要。

为了便于调试,我确保java代码始终使用相同的时间戳和ID。

0 个答案:

没有答案
相关问题