/** * Get the content length for this SOAPPart. * This will force buffering of the SOAPPart, but it will * also cache the byte[] form of the SOAPPart. * * @return the content length in bytes */ public long getContentLength() throws AxisFault { saveChanges(); if (currentForm == FORM_OPTIMIZED) { return ((ByteArray) currentMessage).size(); } else if (currentForm == FORM_BYTES) { return ((byte[]) currentMessage).length; } byte[] bytes = this.getAsBytes(); return bytes.length; }
/** * Get this message's SOAPPart as a SOAPEnvelope. * * @return a SOAPEnvelope containing this message's SOAPPart * @throws AxisFault if this failed */ public SOAPEnvelope getSOAPEnvelope() throws AxisFault { return mSOAPPart.getAsSOAPEnvelope(); }
/** * Get a string representation of this message's SOAPPart. * * @return the soap part of this message as a <code>String</code> * @throws org.apache.axis.AxisFault if the stringification failed */ public String getSOAPPartAsString() throws org.apache.axis.AxisFault { return mSOAPPart.getAsString(); }
env.setOwnerDocument(this); env.addBodyElement(bodyEl); setCurrentForm(env, FORM_SOAPENVELOPE); return env; is = new InputSource(new StringReader(getAsString())); getMessage().getMessageContext(), getMessage().getMessageType()); dser.getEnvelope().setOwnerDocument(this); setCurrentForm(nse, FORM_SOAPENVELOPE);
getAsBytes(); setCurrentForm(new String((byte[])currentMessageAsBytes, currentEncoding), FORM_STRING); }catch(UnsupportedEncodingException ue){ setCurrentForm( new String((byte[]) currentMessageAsBytes), FORM_STRING ); setCurrentForm(new String((byte[])currentMessage, currentEncoding), FORM_STRING); }catch(UnsupportedEncodingException ue){ setCurrentForm( new String((byte[]) currentMessage), FORM_STRING ); StringWriter writer = new StringWriter(); try { this.writeTo(writer); } catch (Exception e) { log.error(Messages.getMessage("exception00"), e); return null; setCurrentForm(writer.getBuffer().toString(), FORM_STRING); if (log.isDebugEnabled()) { log.debug("Exit: SOAPPart::getAsString(): " + currentMessage); StringWriter writer = new StringWriter(); try {
getAsSOAPEnvelope(); } catch (Exception e) { log.fatal(Messages.getMessage("makeEnvFail00"), e); inp.close(); setCurrentForm( buf, FORM_BYTES ); log.debug("Exit: SOAPPart::getAsBytes"); return (byte[])currentMessage; BufferedOutputStream os = new BufferedOutputStream(baos); try { this.writeTo(os); os.flush(); } catch (Exception e) { throw AxisFault.makeFault(e); setCurrentForm(baos.toByteArray(), FORM_BYTES); if (log.isDebugEnabled()) { log.debug("Exit: SOAPPart::getAsBytes(): " + currentMessage); try{ currentEncoding = XMLUtils.getEncoding(msgObject, null); setCurrentForm( ((String)currentMessage).getBytes(currentEncoding), FORM_BYTES ); }catch(UnsupportedEncodingException ue){ setCurrentForm( ((String)currentMessage).getBytes(), FORM_BYTES );
public Element getDocumentElement() { try{ return getEnvelope(); }catch(SOAPException se){ return null; } }
MessageContext ctx = getMessage().getMessageContext(); if (ctx != null) { ctx.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, InputStream is = in.getByteStream(); if(is != null) { setCurrentMessage(is, FORM_INPUTSTREAM); } else { Reader r = in.getCharacterStream(); throw new SOAPException(Messages.getMessage("couldNotReadFromCharStream"), e); setCurrentMessage(sb.toString(), FORM_STRING);
AxisFault env = (AxisFault)currentMessage; try { SerializationContext serContext = new SerializationContext(writer, getMessage().getMessageContext()); serContext.setSendDecl(inclXmlDecl); serContext.setEncoding(currentEncoding); SOAPEnvelope env = (SOAPEnvelope)currentMessage; try { SerializationContext serContext = new SerializationContext(writer, getMessage().getMessageContext()); serContext.setSendDecl(inclXmlDecl); serContext.setEncoding(currentEncoding); String xml = this.getAsString(); if(inclXmlDecl){ if(!xml.startsWith("<?xml")){
/** * check if the allow optimization flag is on * @return form optimization flag */ private boolean isFormOptimizationAllowed() { boolean allowFormOptimization = true; Message msg = getMessage(); if (msg != null) { MessageContext ctx = msg.getMessageContext(); if (ctx != null) { Boolean propFormOptimization = (Boolean)ctx.getProperty(ALLOW_FORM_OPTIMIZATION); if (propFormOptimization != null) { allowFormOptimization = propFormOptimization.booleanValue(); } } } return allowFormOptimization; }
mSOAPPart = new SOAPPart(this, initialContents, bodyInStream); mSOAPPart.setMessage(this);
/** * Content location. * * @return the content location */ public String getContentLocation() { return getFirstMimeHeader(HTTPConstants.HEADER_CONTENT_LOCATION); }
/** * Get a byte array representation of this message's SOAPPart. * * @return the soap part of this message as a <code>byte[]</code> * @throws org.apache.axis.AxisFault if creating the byte[] failed */ public byte[] getSOAPPartAsBytes() throws org.apache.axis.AxisFault { return mSOAPPart.getAsBytes(); }
/** * Content ID. * * @return the contentId reference value that should be used directly * as an href in a SOAP element to reference this attachment. * <B>Not part of JAX-RPC, JAX-M, SAAJ, etc. </B> */ public String getContentIdRef() { return org.apache.axis.attachments.Attachments.CIDprefix + getContentId(); }
/** * should not be called, the method will be handled in SOAPPart * * @return */ public Element getDocumentElement() { return soapPart.getDocumentElement(); }
/** * Get the content length, including both soap and any attachments. * * @return the total length of this message in bytes * @throws org.apache.axis.AxisFault if there was a problem that prevented * the length being calculated */ public long getContentLength() throws org.apache.axis.AxisFault { long ret = mSOAPPart.getContentLength(); if (mAttachments != null && 0 < mAttachments.getAttachmentCount()) { ret = mAttachments.getContentLength(); } return ret; }
soapPart = new org.apache.axis.SOAPPart(null, mpartStream, false); mpartStream= new MultiPartDimeInputStream( (java.io.InputStream) intialContents); soapPart = new org.apache.axis.SOAPPart(null, mpartStream, false); }catch(Exception e){ throw org.apache.axis.AxisFault.makeFault(e);} sendtype= SEND_TYPE_DIME;
env.setOwnerDocument(this); env.addBodyElement(bodyEl); setCurrentForm(env, FORM_SOAPENVELOPE); return env; is = new InputSource(new StringReader(getAsString())); getMessage().getMessageContext(), getMessage().getMessageType()); dser.getEnvelope().setOwnerDocument(this); setCurrentForm(nse, FORM_SOAPENVELOPE);
getAsBytes(); setCurrentForm(new String((byte[])currentMessageAsBytes, currentEncoding), FORM_STRING); }catch(UnsupportedEncodingException ue){ setCurrentForm( new String((byte[]) currentMessageAsBytes), FORM_STRING ); setCurrentForm(new String((byte[])currentMessage, currentEncoding), FORM_STRING); }catch(UnsupportedEncodingException ue){ setCurrentForm( new String((byte[]) currentMessage), FORM_STRING ); StringWriter writer = new StringWriter(); try { this.writeTo(writer); } catch (Exception e) { log.error(Messages.getMessage("exception00"), e); return null; setCurrentForm(writer.getBuffer().toString(), FORM_STRING); if (log.isDebugEnabled()) { log.debug("Exit: SOAPPart::getAsString(): " + currentMessage); StringWriter writer = new StringWriter(); try {
getAsSOAPEnvelope(); } catch (Exception e) { log.fatal(Messages.getMessage("makeEnvFail00"), e); inp.close(); setCurrentForm( buf, FORM_BYTES ); log.debug("Exit: SOAPPart::getAsBytes"); return (byte[])currentMessage; BufferedOutputStream os = new BufferedOutputStream(baos); try { this.writeTo(os); os.flush(); } catch (Exception e) { throw AxisFault.makeFault(e); setCurrentForm(baos.toByteArray(), FORM_BYTES); if (log.isDebugEnabled()) { log.debug("Exit: SOAPPart::getAsBytes(): " + currentMessage); try{ currentEncoding = XMLUtils.getEncoding(msgObject, null); setCurrentForm( ((String)currentMessage).getBytes(currentEncoding), FORM_BYTES ); }catch(UnsupportedEncodingException ue){ setCurrentForm( ((String)currentMessage).getBytes(), FORM_BYTES );