On 20/06/2008, Khan Navaz <[EMAIL PROTECTED]> wrote:
> I dont know why I am having so much difficulty explaining this to you, not
>  sure if you want to understand it in the first place.
>
>  once I place the byte[] in vars.putObject() how can I retrieve it in the
>  SOAP request, I repeat in SOAP Request. I dont think I can do
>  vars.getObject() inside the soap tags.
>
>  Sebb, take your time you dont have to reply in 2 sec, pls read the whole
>  chain. For god sake dont send in hurry.
>

As I wrote before, you need to use a beanshell function, which is
described here:

http://jakarta.apache.org/jmeter/usermanual/functions.html#__BeanShell

The function needs to contain the following code:

vars.getObject("byteString")


>
>  On Thu, Jun 19, 2008 at 5:30 PM, sebb <[EMAIL PROTECTED]> wrote:
>
>  > On 20/06/2008, Khan Navaz <[EMAIL PROTECTED]> wrote:
>  > > I am a newbie, I tried
>  > >  <binaryData><![CDATA[vars.getObject("byteString")]]></binaryData>
>  > >
>  >
>  > That's not a beanshell function call.
>  >
>  > >  also tried vars.getObject("byteString") in Request - Pre processor bean
>  > >  shell, it doesnt work :(
>  >
>  > Have you checked the log?
>  >
>  > >  also the jmeter.log has NUL NUL sometimes.
>  >
>  > If you want a sensible reply to that you'll have to provide a bit more
>  > detail.
>  >
>  > >
>  > >  On Thu, Jun 19, 2008 at 4:42 PM, sebb <[EMAIL PROTECTED]> wrote:
>  > >
>  > >  > On 20/06/2008, Khan Navaz <[EMAIL PROTECTED]> wrote:
>  > >  > > *BeanShell:*
>  > >  > >  String file =
>  > >  > >  Path+"/data/abcService/common/deep_foldered_images_in_zip.zip";
>  > >  > >  byte[] byteArray;
>  > >  > >  byte[] byteString;
>  > >  > >
>  > >  > >   try {
>  > >  > >     byteArray = IOUtils.toByteArray(new FileInputStream(file));
>  > >  > >       } catch (IOException e){
>  > >  > >     e.printStackTrace();
>  > >  > >   }
>  > >  > >
>  > >  > >  vars.putObject("byteString",byteArray);
>  > >  > >
>  > >  > >  *SOAP Request:*
>  > >  > >  <soapenv:Envelope xmlns:soapenv="
>  > >  > http://schemas.xmlsoap.org/soap/envelope/";
>  > >  > >  xmlns:sec="http://schemas.xmlsoap.org/ws/2002/07/secext";>
>  > >  > >    <soapenv:Header>
>  > >  > >       .........
>  > >  > >    </soapenv:Header>
>  > >  > >    <soapenv:Body>
>  > >  > >       <add>
>  > >  > >          <binaryData><![CDATA[${byteString}]]></binaryData>
>  > >  >
>  > >  > Variable references can only be strings.
>  > >  >
>  > >  > You'll need to use a beanshell function to recover the data:
>  > >  >
>  > >  > vars.getObject("byteString")
>  > >  >
>  > >  > >       </add>
>  > >  > >    </soapenv:Body>
>  > >  > >  </soapenv:Envelope>
>  > >  > >
>  > >  > >  *C:\home\y\logs\jmeter\jmeter.log*
>  > >  > >  2008/06/19 15:34:13 ERROR - jmeter.threads.JMeterThread:
>  > >  > >  java.lang.ClassCastException: [B cannot be cast to java.lang.String
>  > >  > >  at
>  > >  > org.apache.jmeter.threads.JMeterVariables.get(JMeterVariables.java:98)
>  > >  > >  at
>  > >  > >
>  > >  >
>  >  
> org.apache.jmeter.engine.util.SimpleVariable.toString(SimpleVariable.java:53)
>  > >  > >  at
>  > >  > >
>  > >  >
>  >  
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:133)
>  > >  > >  at
>  > >  > >
>  > >  >
>  >  
> org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:97)
>  > >  > >  at
>  > >  > >
>  > >  >
>  >  
> org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:85)
>  > >  > >  at
>  > >  > >
>  > >  >
>  >  
> org.apache.jmeter.testelement.AbstractTestElement.getPropertyAsString(AbstractTestElement.java:200)
>  > >  > >  at
>  > >  > >
>  > >  >
>  >  
> org.apache.jmeter.protocol.http.sampler.SoapSampler.getXmlData(SoapSampler.java:66)
>  > >  > >  at
>  > >  > >
>  > >  >
>  >  
> org.apache.jmeter.protocol.http.sampler.SoapSampler$2.getContentLength(SoapSampler.java:202)
>  > >  > >  at
>  > >  >
>  > org.apache.commons.httpclient.methods.EntityEnclosingMethod.getRequestC
>  > >  > >
>  > >  >
>  > >
>  > > > ---------------------------------------------------------------------
>  > >  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > >  > For additional commands, e-mail: [EMAIL PROTECTED]
>  > >  >
>  > >  >
>  > >
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: [EMAIL PROTECTED]
>  > For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to