Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I want to access the Wcf webservice which is Implemented in .net and the binding used is wsHttpBinding.I have successfully got the token response as follows,

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/SCT</a:Action>
    <a:RelatesTo>urn:uuid:2129de36-cc70-4d97-9e92-14dcaf71c732</a:RelatesTo>
    <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>2013-11-25T04:17:23.012Z</u:Created>
    <u:Expires>2013-11-25T04:22:23.012Z</u:Expires>
    </u:Timestamp></o:Security></s:Header>
    <s:Body>

    <t:RequestSecurityTokenResponse xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
    <t:TokenType>http://schemas.xmlsoap.org/ws/2005/02/sc/sct</t:TokenType>
    <t:RequestedSecurityToken>
    <c:SecurityContextToken u:Id="uuid-afee7521-fc91-489a-a1f9-f3a26ac38cbc-3" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
    <c:Identifier>urn:uuid:7ea6d3c2-5c78-4581-8e3c-e94deee3318a</c:Identifier>
    </c:SecurityContextToken>
    </t:RequestedSecurityToken>

    <t:RequestedAttachedReference>
    <o:SecurityTokenReference xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" URI="#uuid-afee7521-fc91-489a-a1f9-f3a26ac38cbc-3">
    </o:Reference></o:SecurityTokenReference>
    </t:RequestedAttachedReference>

    <t:RequestedUnattachedReference>
    <o:SecurityTokenReference xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <o:Reference URI="urn:uuid:7ea6d3c2-5c78-4581-8e3c-e94deee3318a" ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct">
    </o:Reference>
    </o:SecurityTokenReference>
    </t:RequestedUnattachedReference>

    <t:ComputedKey>http://schemas.xmlsoap.org/ws/2005/02/trust/CK/PSHA1</t:ComputedKey>
    </t:RequestedProofToken>
    <t:Entropy>
    <t:BinarySecret u:Id="uuid-afee7521-fc91-489a-a1f9-f3a26ac38cbc-4" Type="http://schemas.xmlsoap.org/ws/2005/02/trust/Nonce">zxlv1wz49xT0raSRAhKMQhb6aDeTJrdT+bzobZe/VIA=</t:BinarySecret>
    </t:Entropy>
    <t:Lifetime>
    <u:Created>2013-11-25T04:17:23.012Z</u:Created>
    <u:Expires>2013-11-25T19:17:23.012Z</u:Expires>
    </t:Lifetime><t:KeySize>256</t:KeySize>
    </t:RequestSecurityTokenResponse>


    </s:Body>
    </s:Envelope>

With the above reference i have to make the signature and digest value for generating another request. For instance, The another request format is given below.

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
    <a:Action s:mustUnderstand="1">SOAP_ACTION_URL</a:Action>
    <a:MessageID>urn:uuid:5f2ff5cc-92b1-4562-b361-7af92ad3a832</a:MessageID>
    <a:ReplyTo>
    <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <a:To s:mustUnderstand="1">REQUEST_URL</a:To>
    <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>2013-11-25T04:17:44.070Z</u:Created>
    <u:Expires>2013-11-25T04:22:44.070Z</u:Expires>
    </u:Timestamp>
    <c:SecurityContextToken u:Id="uuid-afee7521-fc91-489a-a1f9-f3a26ac38cbc-3" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
    <c:Identifier>urn:uuid:7ea6d3c2-5c78-4581-8e3c-e94deee3318a</c:Identifier>
    </c:SecurityContextToken>
        <c:SecurityContextToken u:Id="uuid-afee7521-fc91-489a-a1f9-f3a26ac38cbc-3" xmlns:c="http://schemas.xmlsoap.org/ws/2005/02/sc">
        <c:Identifier>urn:uuid:7ea6d3c2-5c78-4581-8e3c-e94deee3318a</c:Identifier>
        </c:SecurityContextToken>
        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
        <SignedInfo>
        <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
        <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1"/>
        <Reference URI="#_0">
        <Transforms>
        <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/></Transforms>
        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
        <DigestValue>+HMXGwZJx1Ez2mCNH1glxw+b4gk=</DigestValue>
        </Reference>
        </SignedInfo>
        <SignatureValue>KMzPx6dv/2auhMXsPH+j9vhpC4k=</SignatureValue>
        <KeyInfo>
        <o:SecurityTokenReference>
        <o:Reference ValueType="http://schemas.xmlsoap.org/ws/2005/02/sc/sct" URI="#uuid-afee7521-fc91-489a-a1f9-f3a26ac38cbc-3"/>
        </o:SecurityTokenReference>
        </KeyInfo>
        </Signature>
<s:body>
content</s:Body></s:Envelope>

Is there any idea or any library available to achieve this in android?. Please help me..Thanks in advance.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.