Hi dims,
Sorry for the previous email. I did not finish it, but
sent it unintendedly.
I use WSS4JHandler, the following code in the method
public boolean doReceiver(MessageContext mc,
RequestData reqData) throws WSSecurityException
caused the problem
/*
* After setting the new current message,
probably modified because
* of decryption, we need to locate the
security header. That is,
* we force Axis (with getSOAPEnvelope()) to
parse the string, build
* the new header. Then we examine, look up the
security header
* and set the header as processed.
*
* Please note: find all header elements that
contain the same
* actor that was given to
processSecurityHeader(). Then
* check if there is a security header with
this actor.
*/
SOAPHeader sHeader = null;
try {
sHeader =
message.getSOAPPart().getEnvelope().getHeader();
} catch (Exception ex) {
throw new
WebServiceException("WSS4JHandler: cannot get SOAP
header after security processing", ex);
}
More specifically, the line
sHeader =
message.getSOAPPart().getEnvelope().getHeader();
threw the exception.
I traced the getEnvelope() class,
public SOAPEnvelope getEnvelope()
throws SOAPException
{
if(sourceWasSet)
sourceWasSet = false;
lookForEnvelope();
if(envelope != null)
{
if(source != null)
{
document.removeChild(envelope);
envelope =
createEnvelopeFromSource();
}
} else if(source != null)
{
envelope =
createEnvelopeFromSource();
} else
......
Since envelop == null, the above called the method
createEnvelopeFromSource() as follows,
protected Envelope
createEnvelopeFromSource()
throws SOAPException
{
String xmlDecl = lookForXmlDecl();
javax.xml.transform.Source tmp = source;
source = null;
EnvelopeImpl envelope =
(EnvelopeImpl)EnvelopeFactory.createEnvelope(tmp,
this);
Then it called EnvelopeFactory.createEnvelope()
method,
public static Envelope
createEnvelope(Source src, SOAPPartImpl soapPart)
throws SOAPException
{
javax.xml.parsers.SAXParser saxParser;
saxParser = null;
if(src instanceof StreamSource)
{
if(src instanceof JAXMStreamSource)
try
{
((JAXMStreamSource)src).reset();
}
catch(IOException ioe)
{
log.severe("SAAJ0515.source.reset.exception");
throw
new SOAPExceptionImpl(ioe);
}
try
{
saxParser = parserPool.get();
}
catch(Exception e)
{
log.severe("SAAJ0601.util.newSAXParser.exception");
throw new
SOAPExceptionImpl("Couldn't get a SAX
parser while constructing a envelope", e);
}
org.xml.sax.InputSource is =
SAXSource.sourceToInputSource(src);
org.xml.sax.XMLReader rejectFilter;
try
{
rejectFilter = new RejectDoctypeSaxFilter(saxParser);
}
catch(Exception ex)
{
log.severe("SAAJ0510.soap.cannot.create.envelope");
throw new
SOAPExceptionImpl("Unable to create envelope from
given source: ", ex);
}
src = new SAXSource(rejectFilter, is);
}
Envelope env;
Transformer transformer =
EfficientStreamingTransformer.newTransformer();
DOMResult result = new DOMResult(soapPart);
transformer.transform(src, result);
env = (Envelope)soapPart.getEnvelope();
if(saxParser != null)
parserPool.put(saxParser);
return env;
Exception ex;
if(ex instanceof
SOAPVersionMismatchException)
{ throw
(SOAPVersionMismatchException)ex;
} else
{
log.severe("SAAJ0511.soap.cannot.create.envelope");
throw new
SOAPExceptionImpl("Unable to create envelope from
given source: ", ex);
}
}
......
Finally, the following error is thrown,
"com.sun.xml.messaging.saaj.soap.EnvelopeFactory
createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given
source"
Thanks,
Jian
--- Davanum Srinivas <[EMAIL PROTECTED]> wrote:
> .JAX-WS EA is not an environment that we are
> familiar with.. Could you
> please localize the code inside wss4j that is
> causing the problem?
>
> thanks,
> dims
>
> On 11/11/05, Fang Jian <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am trying to use SAML and use the configuration
> > coming with WSS4J CVS code, i.e.,
> >
> > At the client side,
> >
> > config.put("deployment", "client");
> > config.put("flow", "request-only");
> > config.put("action", "Timestamp
> > SAMLTokenUnsigned");
> > config.put("samlPropFile",
> "saml.properties");
> >
> > at the server side
> >
> > config.put("deployment", "server");
> > config.put("flow", "request-only");
> > config.put("action", "Timestamp
> > SAMLTokenUnsigned");
> >
> > I use Sun's Jax-ws EA 2.0 and the soap message is
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soapenv:Envelope
> >
>
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> > <soapenv:Header/>
> > <soapenv:Body>
> > <ns2:addNumbers
> xmlns:ns2="http://jtv.com">
> > <number1>10</number1>
> > <number2>20</number2>
> > </ns2:addNumbers>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > After the client did the security processing, the
> > message is:
> >
> > <?xml version="1.0"
> > encoding="UTF-8"?><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"
> > soapenv:actor="test" soapenv:mustUnderstand="1">
> > <Assertion
> > xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
> > xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion"
> > xmlns:samlp="urn:oasis:names:tc:SAML:1.0:protocol"
> > AssertionID="aa4441546da436294e634c74afd9bd69"
> > IssueInstant="2005-11-11T22:02:26.531Z"
> > Issuer="www.example.com" MajorVersion="1"
> > MinorVersion="1"><AuthenticationStatement
> > AuthenticationInstant="2005-11-11T22:02:26.517Z"
> >
>
AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:password"><Subject><NameIdentifier
> >
>
NameQualifier="www.example.com">uid=joe,ou=people,ou=saml-demo,o=example.com</NameIdentifier><SubjectConfirmation><ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:sender-vouches</ConfirmationMethod></SubjectConfirmation></Subject></AuthenticationStatement></Assertion>
> > <wsu:Timestamp
> >
>
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsu:Created>2005-11-11T22:02:25.967Z</wsu:Created><wsu:Expires>2005-11-11T22:07:25.967Z</wsu:Expires></wsu:Timestamp></wsse:Security></soapenv:Header>
> > <soapenv:Body>
> > <ns2:addNumbers
> xmlns:ns2="http://jtv.com">
> > <number1>10</number1>
> > <number2>20</number2>
> > </ns2:addNumbers>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > However, the server throwed the following error
> from
> > the log file,
> >
> > com.sun.xml.messaging.saaj.soap.EnvelopeFactory
> > createEnvelope
> > SEVERE: SAAJ0511: Unable to create envelope from
> given
> > source
> >
> >
> > The client received the following fault message,
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soapenv:Envelope xmlns:ns1="http://jtv.com"
> >
>
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> > <soapenv:Body>
> > <soapenv:Fault
> >
>
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> > <faultcode>soapenv:Server</faultcode>
> > <faultstring>WSS4JHandler: cannot get
> SOAP
> > header after security processing</faultstring>
> > </soapenv:Fault>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > Any hints for what was wrong?
> >
> > Thanks in advance,
> >
> > Jian
> >
> >
> >
> >
> >
> >
> >
> >
> > __________________________________
> > Yahoo! FareChase: Search multiple travel sites in
> one click.
> > http://farechase.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> >
> >
>
>
> --
> Davanum Srinivas : http://wso2.com/blogs/
>
__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]