0

I'm getting HTML content in below format.

wsse:BinarySecurityToken wsu:Id="uuid:07747f2a-4be4-48fa-9654-5e12235f6040" ValueType="http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> aHR0cCUzYSUyZiUyZnNjaGVtYXMubWNk</wsse:BinarySecurityToken>< 

In the below code I'm getting wsu:Id="uuid:07747f2a-4be4-48fa-9654-5e12235f6040" ValueType="http://schemas.xmlsoap.org/ws/2009/11/swt-token-profile-1.0" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> aHR0cCUzYSUyZiUyZnNjaGVtYXMubWNk

- (void)connectionDidFinishLoading:(NSURLConnection *)connection { if(_data) { NSString* content = [[NSString alloc] initWithData:_data encoding:NSUTF8StringEncoding]; NSLog(@"Content :%@",content); NSRange divRange = [content rangeOfString:@"wsse:BinarySecurityToken" options:NSCaseInsensitiveSearch]; if (divRange.location != NSNotFound) { NSRange endDivRange; endDivRange.location = divRange.length + divRange.location; endDivRange.length = [content length] - endDivRange.location; endDivRange = [content rangeOfString:@"=<" options:NSCaseInsensitiveSearch range:endDivRange]; if (endDivRange.location != NSNotFound) { divRange.location += divRange.length; divRange.length = endDivRange.location - divRange.location; NSLog(@"BinarySecurityToken : %@",[content substringWithRange:divRange]); } } [webView loadHTMLString:content baseURL:_url]; } 

}

I want the Output as aHR0cCUzYSUyZiUyZnNjaGVtYXMubWNk.

Any ideas? Thanks in advance.

6
  • Yesterday You Accepted the same Answer now what ? stackoverflow.com/questions/16566129/… Commented May 16, 2013 at 6:26
  • <wsse:BinarySecurityToken wsu:Id=&quot;> it has some attribute,that also printing with the token.Can you please help me to remove that? Commented May 16, 2013 at 6:29
  • 1
    Use my method nd call it using NSString *token = [self stringBetweenString:@"sse:BinarySecurityToken>" andString:@"</wsse:BinarySecurityToken>"]; Commented May 16, 2013 at 6:33
  • stringBetweenString is not working,anyway thanks a lot Bunty Commented May 16, 2013 at 6:39
  • What is all about is it working for you young man ? Commented May 16, 2013 at 9:07

1 Answer 1

0

As you discussing you have NSString *token = @"<wsse:BinarySecurityToken>aHR0cCUzYSUyZiUyZnNjaGVtYWd0Sjk0JTNk</wsse:BinarySecurityToken>"; and what the token between tags then you can replace the unwanted character like .

NSString *str = [token stringByReplacingOccurrencesOfString:@"<wsse:BinarySecurityToken>" withString:@""];;

and then

NSString *correctToken = [str stringByReplacingOccurrencesOfString:@"</wsse:BinarySecurityToken>" withString:@""];;

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.