Author: anil.saldhana(a)jboss.com
Date: 2011-06-17 14:37:01 -0400 (Fri, 17 Jun 2011)
New Revision: 1009
Modified:
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/PicketLinkDispatch.java
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/jaas/JBWSTokenIssuingLoginModule.java
Log:
use SOAPMessage rather than source
Modified:
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/PicketLinkDispatch.java
===================================================================
---
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/PicketLinkDispatch.java 2011-06-17
18:30:34 UTC (rev 1008)
+++
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/PicketLinkDispatch.java 2011-06-17
18:37:01 UTC (rev 1009)
@@ -37,17 +37,12 @@
import javax.servlet.http.HttpServletRequest;
import javax.xml.bind.JAXBContext;
import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.SOAPMessage;
-import javax.xml.transform.Source;
-import javax.xml.transform.dom.DOMResult;
-import javax.xml.transform.dom.DOMSource;
import javax.xml.ws.AsyncHandler;
import javax.xml.ws.Binding;
import javax.xml.ws.BindingProvider;
@@ -62,9 +57,6 @@
import org.picketlink.identity.federation.core.saml.v2.common.IDGenerator;
import org.picketlink.identity.federation.core.util.Base64;
import org.picketlink.identity.federation.core.util.StringUtil;
-import org.picketlink.identity.federation.core.util.TransformerUtil;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
/**
* <p>
@@ -79,7 +71,7 @@
* @author Anil.Saldhana(a)redhat.com
* @since May 10, 2011
*/
-public class PicketLinkDispatch implements Dispatch<Source>
+public class PicketLinkDispatch implements Dispatch<SOAPMessage>
{
@SuppressWarnings("rawtypes")
private Dispatch parent;
@@ -131,7 +123,7 @@
}
@SuppressWarnings({"unchecked", "rawtypes"})
- public Source invoke(Source msg)
+ public SOAPMessage invoke(SOAPMessage soapMessage)
{
PLMessageContext msgContext = new PLMessageContext();
msgContext.put(MessageContext.MESSAGE_OUTBOUND_PROPERTY, Boolean.TRUE);
@@ -148,21 +140,8 @@
{
throw new RuntimeException(e1);
}
- msgContext.put(MessageContext.SERVLET_REQUEST, request);
+ msgContext.put(MessageContext.SERVLET_REQUEST, request);
- MessageFactory messageFactory = null ;
- SOAPMessage soapMessage = null;
-
- try
- {
- messageFactory = MessageFactory.newInstance();
- soapMessage = messageFactory.createMessage();
- }
- catch (SOAPException e)
- {
- throw new RuntimeException( e );
- }
-
String userName = (String)
parent.getRequestContext().get(BindingProvider.USERNAME_PROPERTY);
String passwd = (String)
parent.getRequestContext().get(BindingProvider.PASSWORD_PROPERTY);
if( StringUtil.isNotNull(userName))
@@ -187,27 +166,7 @@
}
msgContext.setMessage(soapMessage);
- DOMResult domresult = new DOMResult();
- try
- {
- TransformerUtil.getTransformer().transform(msg, domresult);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- Node doc = domresult.getNode();
-
- try
- {
- soapMessage.getSOAPBody().addDocument((Document) doc);
- }
- catch (SOAPException e)
- {
- throw new RuntimeException(e);
- }
-
List<Handler> handlers = getBinding().getHandlerChain();
for( Handler handler: handlers)
{
@@ -221,7 +180,7 @@
HttpsURLConnection.setDefaultSSLSocketFactory(sslSocketFactory);
}
- SOAPBody body;
+ SOAPMessage response = null;
try
{
SOAPConnectionFactory connectFactory = SOAPConnectionFactory.newInstance();
@@ -229,33 +188,30 @@
//Send it across the wire
URL url = new URL(endpoint);
- SOAPMessage response = connection.call(soapMessage, url);
- body = response.getSOAPBody();
+ response = connection.call(soapMessage, url);
}
catch (Exception e)
{
throw new RuntimeException(e);
}
- DOMSource resultSource = new DOMSource(body.getFirstChild());
-
- return resultSource;
+ return response;
}
@SuppressWarnings("unchecked")
- public Response<Source> invokeAsync(Source msg)
+ public Response<SOAPMessage> invokeAsync(SOAPMessage msg)
{
return parent.invokeAsync(msg);
}
@SuppressWarnings("unchecked")
- public Future<?> invokeAsync(Source msg, AsyncHandler<Source> handler)
+ public Future<?> invokeAsync(SOAPMessage msg, AsyncHandler<SOAPMessage>
handler)
{
return parent.invokeAsync(msg, handler);
}
@SuppressWarnings("unchecked")
- public void invokeOneWay(Source msg)
+ public void invokeOneWay(SOAPMessage msg)
{
parent.invokeOneWay(msg);
}
Modified:
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/jaas/JBWSTokenIssuingLoginModule.java
===================================================================
---
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/jaas/JBWSTokenIssuingLoginModule.java 2011-06-17
18:30:34 UTC (rev 1008)
+++
trust/trunk/jbossws/src/main/java/org/picketlink/trust/jbossws/jaas/JBWSTokenIssuingLoginModule.java 2011-06-17
18:37:01 UTC (rev 1009)
@@ -28,7 +28,7 @@
import javax.net.ssl.SSLSocketFactory;
import javax.security.auth.login.LoginException;
-import javax.xml.transform.Source;
+import javax.xml.soap.SOAPMessage;
import javax.xml.ws.Binding;
import javax.xml.ws.Dispatch;
import javax.xml.ws.handler.Handler;
@@ -129,7 +129,7 @@
super(config);
//Get pre-constructed Dispatch from super
- Dispatch<Source> dispatch = super.getDispatch();
+ Dispatch<SOAPMessage> dispatch = super.getDispatch();
String overrideDispatchStr = (String)
options.get("overrideDispatch");
if( StringUtil.isNotNull(overrideDispatchStr))
Show replies by date