Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed walrus soap handling that I borked

  • Loading branch information...
commit 37cd73993992b8665fedff17ccb28c7bea417bfd 1 parent 0708eb3
authored August 15, 2009
15  clc/modules/wsstack/src/main/java/com/eucalyptus/ws/handlers/WalrusSoapHandler.java
... ...
@@ -1,16 +1,22 @@
1 1
 package com.eucalyptus.ws.handlers;
2 2
 
  3
+import java.io.ByteArrayInputStream;
3 4
 import java.io.ByteArrayOutputStream;
4 5
 import java.util.Iterator;
5 6
 import java.util.List;
6 7
 
  8
+import javax.xml.stream.XMLInputFactory;
  9
+import javax.xml.stream.XMLStreamReader;
  10
+
7 11
 import org.apache.axiom.om.OMAbstractFactory;
8 12
 import org.apache.axiom.om.OMElement;
  13
+import org.apache.axiom.soap.SOAP11Constants;
9 14
 import org.apache.axiom.soap.SOAPEnvelope;
10 15
 import org.apache.axiom.soap.SOAPFactory;
11 16
 import org.apache.axiom.soap.SOAPFault;
12 17
 import org.apache.axiom.soap.SOAPHeader;
13 18
 import org.apache.axiom.soap.SOAPHeaderBlock;
  19
+import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
14 20
 import org.apache.log4j.Logger;
15 21
 import org.jboss.netty.buffer.ChannelBuffer;
16 22
 import org.jboss.netty.buffer.ChannelBuffers;
@@ -21,6 +27,7 @@
21 27
 
22 28
 import com.eucalyptus.ws.EucalyptusRemoteFault;
23 29
 import com.eucalyptus.ws.MappingHttpMessage;
  30
+import com.eucalyptus.ws.MappingHttpRequest;
24 31
 import com.eucalyptus.ws.binding.Binding;
25 32
 import com.google.common.collect.Lists;
26 33
 
@@ -35,7 +42,13 @@
35 42
 	public void incomingMessage( ChannelHandlerContext ctx, MessageEvent event ) throws Exception {
36 43
 		if ( event.getMessage( ) instanceof MappingHttpMessage ) {
37 44
 			final MappingHttpMessage message = ( MappingHttpMessage ) event.getMessage( );
38  
-			final SOAPEnvelope env = message.getSoapEnvelope( );
  45
+			String content = message.getContent( ).toString( "UTF-8" );
  46
+			ByteArrayInputStream byteIn = new ByteArrayInputStream( content.getBytes( ) );
  47
+			XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance( ).createXMLStreamReader( byteIn );
  48
+			StAXSOAPModelBuilder soapBuilder = new StAXSOAPModelBuilder( xmlStreamReader, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI );
  49
+			SOAPEnvelope env = ( SOAPEnvelope ) soapBuilder.getDocumentElement( );
  50
+			message.setSoapEnvelope( env );
  51
+			message.setMessageString( content );
39 52
 			if ( !env.hasFault( ) ) {
40 53
 				message.setOmMessage( env.getBody( ).getFirstElement( ) );
41 54
 			} else {
6  clc/modules/wsstack/src/main/java/com/eucalyptus/ws/handlers/WalrusSoapUserAuthenticationHandler.java
@@ -40,11 +40,7 @@
40 40
 	public void incomingMessage( ChannelHandlerContext ctx, MessageEvent event ) throws Exception {
41 41
 		if ( event.getMessage( ) instanceof MappingHttpRequest ) {
42 42
 			MappingHttpRequest httpRequest = ( MappingHttpRequest ) event.getMessage( );
43  
-			String content = httpRequest.getContent( ).toString( "UTF-8" );
44  
-			ByteArrayInputStream byteIn = new ByteArrayInputStream( content.getBytes( ) );
45  
-			XMLStreamReader xmlStreamReader = XMLInputFactory.newInstance( ).createXMLStreamReader( byteIn );
46  
-			StAXSOAPModelBuilder soapBuilder = new StAXSOAPModelBuilder( xmlStreamReader, SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI );
47  
-			SOAPEnvelope envelope = ( SOAPEnvelope ) soapBuilder.getDocumentElement( );
  43
+			SOAPEnvelope envelope = httpRequest.getSoapEnvelope();
48 44
 			SOAPBody body = envelope.getBody();
49 45
 			final StAXOMBuilder doomBuilder = new StAXOMBuilder( DOOMAbstractFactory.getOMFactory( ), body.getXMLStreamReader( ) );
50 46
 			final OMElement elem = doomBuilder.getDocumentElement( );

0 notes on commit 37cd739

Please sign in to comment.
Something went wrong with that request. Please try again.