1 57 58 package org.apache.soap.rpc; 59 60 import java.io.*; 61 import java.util.*; 62 import org.w3c.dom.*; 63 import org.apache.soap.util.xml.*; 64 import org.apache.soap.*; 65 import org.apache.soap.encoding.*; 66 import javax.mail.MessagingException ; 67 import javax.mail.BodyPart ; 68 69 77 public class Response extends RPCMessage 78 { 79 private Parameter returnValue; 80 private Fault fault; 81 82 85 public Response(String targetObjectURI, String methodName, 86 Parameter returnValue, Vector params, Header header, 87 String encodingStyleURI, SOAPContext ctx) 88 { 89 super(targetObjectURI, methodName, params, header, encodingStyleURI, ctx); 90 91 this.returnValue = returnValue; 92 } 93 94 97 public Response(String targetObjectURI, String methodName, 98 Fault fault, Vector params, Header header, 99 String encodingStyleURI, SOAPContext ctx) 100 { 101 super(targetObjectURI, methodName, params, header, encodingStyleURI, 102 ctx); 103 104 this.fault = fault; 105 } 106 107 public void setReturnValue(Parameter returnValue) 108 { 109 this.returnValue = returnValue; 110 } 111 112 public Parameter getReturnValue() 113 { 114 return returnValue; 115 } 116 117 public void setFault(Fault fault) 118 { 119 this.fault = fault; 120 } 121 122 public Fault getFault() 123 { 124 return fault; 125 } 126 127 public boolean generatedFault() 128 { 129 return fault != null; 130 } 131 132 public Envelope buildEnvelope() 133 { 134 return super.buildEnvelope(true); 135 } 136 137 public static Response extractFromEnvelope(Envelope env, 138 SOAPMappingRegistry smr, 139 SOAPContext ctx) 140 throws IllegalArgumentException 141 { 142 return (Response)RPCMessage.extractFromEnvelope(env, null, true, smr, ctx); 143 } 144 145 160 public BodyPart findBodyPart(String uri) { 161 return ctx.findBodyPart(uri); 162 } 163 164 170 public int getPartCount() throws MessagingException { 171 return ctx.getCount(); 172 } 173 174 181 public BodyPart getBodyPart(int index) throws IndexOutOfBoundsException { 182 return ctx.getBodyPart(index); 183 } 184 } 185 | Popular Tags |