Author: ehugonnet
Date: 2014-02-06 06:41:05 -0500 (Thu, 06 Feb 2014)
New Revision: 18308
Added:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/OneWayUnMarshallerHTTP.java
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java
Log:
[JBPAPP-10655] Xerces tries to parse HTTP response from oneway invocation: "Premature
end of file"
Fixing this bug by adding oneway support when obtaining the unmarshaller.
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java 2014-02-06
11:37:49 UTC (rev 18307)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPProtocolConnection.java 2014-02-06
11:41:05 UTC (rev 18308)
@@ -31,7 +31,7 @@
*/
public class HTTPProtocolConnection extends HTTPRemotingConnection
{
- public UnMarshaller getUnmarshaller()
+ public UnMarshaller getUnmarshaller(boolean oneway)
{
return new HTTPMessageUnMarshaller();
}
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2014-02-06
11:37:49 UTC (rev 18307)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/HTTPRemotingConnection.java 2014-02-06
11:41:05 UTC (rev 18308)
@@ -188,7 +188,7 @@
// setup remoting client
Map<String, Object> metadata = createRemotingMetaData(reqMessage,
callProps);
Marshaller marshaller = getMarshaller();
- UnMarshaller unmarshaller = getUnmarshaller();
+ UnMarshaller unmarshaller = getUnmarshaller(oneway);
InvokerLocator locator = null;
try
{
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java 2014-02-06
11:37:49 UTC (rev 18307)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/JsonConnectionHTTP.java 2014-02-06
11:41:05 UTC (rev 18308)
@@ -41,7 +41,7 @@
*/
public class JsonConnectionHTTP extends HTTPRemotingConnection
{
- public UnMarshaller getUnmarshaller()
+ public UnMarshaller getUnmarshaller(boolean oneway)
{
return new JsonMessageUnMarshaller();
}
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java 2014-02-06
11:37:49 UTC (rev 18307)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/RemoteConnection.java 2014-02-06
11:41:05 UTC (rev 18308)
@@ -38,7 +38,7 @@
{
Marshaller getMarshaller();
- UnMarshaller getUnmarshaller();
+ UnMarshaller getUnmarshaller(boolean oneway);
MessageAbstraction invoke(MessageAbstraction reqMessage, Object endpoint, boolean
oneway) throws IOException;
}
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java 2014-02-06
11:37:49 UTC (rev 18307)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionHTTP.java 2014-02-06
11:41:05 UTC (rev 18308)
@@ -34,6 +34,7 @@
import org.jboss.ws.core.MessageAbstraction;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshallerHTTP;
+import org.jboss.ws.core.soap.OneWayUnMarshallerHTTP;
import org.jboss.ws.extensions.xop.XOPContext;
/**
@@ -45,9 +46,12 @@
*/
public class SOAPProtocolConnectionHTTP extends HTTPRemotingConnection
{
- public UnMarshaller getUnmarshaller()
+ public UnMarshaller getUnmarshaller(boolean oneway)
{
- return new SOAPMessageUnMarshallerHTTP();
+ if(oneway)
+ return new OneWayUnMarshallerHTTP();
+ else
+ return new SOAPMessageUnMarshallerHTTP();
}
public Marshaller getMarshaller()
Modified:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java 2014-02-06
11:37:49 UTC (rev 18307)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/client/SOAPProtocolConnectionJMS.java 2014-02-06
11:41:05 UTC (rev 18308)
@@ -44,6 +44,7 @@
import org.jboss.remoting.marshal.Marshaller;
import org.jboss.remoting.marshal.UnMarshaller;
import org.jboss.ws.core.MessageAbstraction;
+import org.jboss.ws.core.soap.OneWayUnMarshallerHTTP;
import org.jboss.ws.core.soap.SOAPMessageMarshaller;
import org.jboss.ws.core.soap.SOAPMessageUnMarshaller;
@@ -57,9 +58,12 @@
{
private boolean waitForResponse;
- public UnMarshaller getUnmarshaller()
+ public UnMarshaller getUnmarshaller(boolean oneway)
{
- return new SOAPMessageUnMarshaller();
+ if(oneway)
+ return new OneWayUnMarshallerHTTP();
+ else
+ return new SOAPMessageUnMarshaller();
}
public Marshaller getMarshaller()
@@ -143,7 +147,7 @@
}
ByteArrayInputStream bais = new
ByteArrayInputStream(responseListener.resMessage.getBytes());
- resMessage = (MessageAbstraction)getUnmarshaller().read(bais, null);
+ resMessage = (MessageAbstraction)getUnmarshaller(oneway).read(bais, null);
}
con.stop();
Added:
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/OneWayUnMarshallerHTTP.java
===================================================================
---
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/OneWayUnMarshallerHTTP.java
(rev 0)
+++
stack/native/branches/jbossws-native-3.1.2/modules/core/src/main/java/org/jboss/ws/core/soap/OneWayUnMarshallerHTTP.java 2014-02-06
11:41:05 UTC (rev 18308)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.soap;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.transport.http.HTTPMetadataConstants;
+import org.jboss.ws.WSException;
+
+public class OneWayUnMarshallerHTTP implements UnMarshaller
+{
+ private static Logger log = Logger.getLogger(OneWayUnMarshallerHTTP.class);
+
+ public Object read(InputStream inputStream, Map metadata) throws IOException,
ClassNotFoundException
+ {
+ Integer resCode = (Integer)metadata.get(HTTPMetadataConstants.RESPONSE_CODE);
+ if(!resCode.equals(200))
+ {
+ throw new WSException("One-way operation returned invalid HTTP response:
" + resCode);
+ }
+ return null;
+ }
+
+ public UnMarshaller cloneUnMarshaller() throws CloneNotSupportedException
+ {
+ return new OneWayUnMarshallerHTTP();
+ }
+
+ public void setClassLoader(ClassLoader cl)
+ {
+ //noop
+ }
+
+ private MimeHeaders getMimeHeaders(Map metadata)
+ {
+ log.debug("getMimeHeaders from: " + metadata);
+
+ MimeHeaders headers = new MimeHeaders();
+ Iterator i = metadata.keySet().iterator();
+ while (i.hasNext())
+ {
+ String key = (String)i.next();
+ Object value = metadata.get(key);
+ if (key != null && value instanceof List)
+ {
+ for (Object listValue : (List)value)
+ {
+ headers.addHeader(key, listValue.toString());
+ }
+ }
+ }
+ return headers;
+ }
+}