mace-opensaml-users - Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object
Subject: OpenSAML user discussion
List archive
Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object
Chronological Thread
- From: Sidhartha Priye <>
- To:
- Subject: Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object
- Date: Mon, 1 Mar 2010 13:44:16 -0800 (PST)
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type; b=MI1uGp3s2QScM/q2qZJKPC9qZDAu1TeepyCAHQI3LOTr+XkNNQLhNqnJzONO2PkfHdOFbFfr6hvt9I1ovyv5xKue/qb327oMv4H12SEMzxVu+itaVX4UAMYLBjjikg7mF8Z2m6U205SBfWtUyUf0nDubAr6sAkVZz6um/QZPHzM=;
Aah, sorry...you are right...when you meant parsing the XML I was relating it
to parsing the SOAPHeader which represent a DOM element. Here is the client
side that builds the DOM. This is the client side JAX WS Handler that injects
the SAML into the SOAPHeader.
DefaultBootstrap.bootstrap();
SOAPMessage message = smc.getMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
Name wsseHeaderName = soapEnvelope.createName("Security",
"wsse", WS_SECURITY_NS_URI);
if (soapEnvelope.getHeader() == null) {
soapEnvelope.addHeader();
}
SOAPHeaderElement securityElement = soapEnvelope.getHeader()
.addHeaderElement(wsseHeaderName);
Assertion assertion = (Assertion)
Configuration.getBuilderFactory().
getBuilder(Assertion.DEFAULT_ELEMENT_NAME)
.buildObject(Assertion.DEFAULT_ELEMENT_NAME);
assertion.setVersion(SAMLVersion.VERSION_20);
assertion.setID("_33776a319493ad607b7ab3e689482e45"); // in
reality, must be unique for all assertions
assertion.setIssueInstant(new DateTime());
Issuer myIssuer = (Issuer) Configuration.getBuilderFactory().
getBuilder(Issuer.DEFAULT_ELEMENT_NAME)
.buildObject(Issuer.DEFAULT_ELEMENT_NAME);
myIssuer.setValue("http://localhost:9088");
assertion.setIssuer(myIssuer);
NameID myNameID = (NameID) Configuration.getBuilderFactory().
getBuilder(NameID.DEFAULT_ELEMENT_NAME)
.buildObject(NameID.DEFAULT_ELEMENT_NAME);
myNameID.setValue("mbrendish");
myNameID.setFormat(NameIDType.X509_SUBJECT);
Subject mySubject =
(Subject)Configuration.getBuilderFactory().
getBuilder(Subject.DEFAULT_ELEMENT_NAME)
.buildObject(Subject.DEFAULT_ELEMENT_NAME);
mySubject.setNameID(myNameID);
assertion.setSubject(mySubject);
Element assertionElement = null;
try {
assertionElement =
Configuration.getMarshallerFactory().getMarshaller(assertion.getElementQName())
.marshall(assertion);
} catch (MarshallingException e) {
e.printStackTrace();
}
securityElement.appendChild(soapPart.importNode(
assertionElement, true));
//Print out the outbound SOAP message to System.out
message.writeTo(System.out);
System.out.println("");
Here is the WSClient
Service service = Service.create(SERVICE_NAME);
HeaderHandlerResolver handlerResolver = new HeaderHandlerResolver();
service.setHandlerResolver(handlerResolver);
// Endpoint Address
String endpointAddress =
"http://localhost:9088/bpm-servicesCXF/services/IBpmService";
try {
java.net.URL url = new URL(endpointAddress);
} catch (MalformedURLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
IBpmService client = service.getPort(IBpmService.class);
Map<String, Object> requestContext =
((BindingProvider)client).getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
endpointAddress);
requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY,
Boolean.TRUE);
String username = "ewrertert";
String password = "hdfuhgdg";
String category = "GETFULLEOPINWRK";
int max = -1;
Properties arguments = null;
String response =null;
try {
response = client.findTaskList(category, arguments, max);
System.out.println("Response: " + response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
thanks
Sid
----- Original Message ----
> From: Scott Cantor
> <>
> To:
>
> Sent: Mon, March 1, 2010 4:30:44 PM
> Subject: RE: [OpenSAML] local part cannot be "null" when creating a QName
> during unmarshalling an Assertion object
>
> > I have the Assertion
> > Element that I pass into the Unmarshaller(Element) at which point of time
> I
> > dont have control how its getting parsed and unmarshalled.
>
> That is not parsing the XML. That's unmarshalling objects from a DOM. The
> DOM already exists. Parsing is what happens when you go from XML to a DOM
> tree.
>
> > To be honest I am a couple of days old into SAML.
>
> This has nothing to do with SAML or OpenSAML.
>
> > So if you can point here with respect to the
> > code where I am going wrong, that will be more helpful -
> > Here is all the code that is involved.
>
> No, it isn't. You're missing all of the code that is giving you these
> objects:
>
> > SOAPHeader sh = smc.getMessage().getSOAPHeader();
> > // check for wsse:security element under SOAP Header
> > Node wsseElement = sh.getFirstChild();
>
> The DOM is already broken at that point because it was parsed without
> namespace awareness.
>
> -- Scott
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, (continued)
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/02/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/02/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/03/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/03/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/03/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/03/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/04/2010
- Validating signatures, a way to verify?, Tom Delorenzi, 03/04/2010
- RE: [OpenSAML] Validating signatures, a way to verify?, Scott Cantor, 03/04/2010
- RE: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Scott Cantor, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
- Re: [OpenSAML] local part cannot be "null" when creating a QName during unmarshalling an Assertion object, Sidhartha Priye, 03/01/2010
Archive powered by MHonArc 2.6.16.