Re: MTOM works only with base64 or it supports other types as well ?

2009-05-07 Thread Andreas Veithen
Sudhir,

The XOP specification (on which MTOM is based) indeed explicitly
restricts the scope to base64Binary items.

Andreas

On Thu, May 7, 2009 at 16:32, Sudhir Mongia  wrote:
> Hi,
> Just needed confirmation from the experts.
> I was reading through internet that MTOM is supported for the elements
> defined as base64Binary in the wsdl. Is this true ? Can't we use MTOM to
> transfer objects of any type other then base64Binary?
> Thanks,
> Sudhir
>
>
>


MTOM works only with base64 or it supports other types as well ?

2009-05-07 Thread Sudhir Mongia
Hi,
Just needed confirmation from the experts.

I was reading through internet that MTOM is supported for the elements
defined as base64Binary in the wsdl. Is this true ? Can't we use MTOM to
transfer objects of any type other then base64Binary?

Thanks,
Sudhir


Axis Client Stub base64 encodes user/password

2009-03-30 Thread Davis Ford
Hi, I have a simple client generated from the wsdl.  I'm using:

axis-1.4.jar
axis-jaxrpc-1.4.jar
axis-saaj-1.4.jar
wsdl4j-1.6.2.jar

I have the following simple call to post to a web service:

import javax.xml.rpc.ServiceException;
import javax.xml.soap.SOAPException;

import org.apache.axis.message.MessageElement;
import org.apache.axis.message.PrefixedQName;
import org.apache.axis.message.SOAPHeaderElement;

public class MyServiceWrapper {

public static callService(String id, String URL, String username, String pass) {

  MyServiceLocator locator = new MyServiceLocator();
  locator.setMyServiceEndpointAddress(URL);
  MyServiceSoapBindingStub service = (MyServiceSoapBindingStub)
locator.getMyService();

  // setup soap header
  SOAPHeaderElement header =
  new SOAPHeaderElement(new
PrefixedQName("http://my.domain.com/webservices/type";, "SessionInfo",
"encoding"));
  MessageElement userElement = new MessageElement("", "User");
  MessageElement passElement = new MessageElement("", "Password");
  userElement.setObjectValue(username);
  passElement.setObjectValue(password);
  header.addChild(userElement);
  header.addChild(passElement);
  service.setHeader(header);

  // create query
  MyQuery myQuery = new MyQuery();
  // set the id
  myQuery.setId(Long.parseLong(id));

  // call the web service
  return service.doMyMethod(myQuery);
}
}

If I call this inside...let's say in Eclipse it works fine.  The web
service is called..no errors, etc.

However, the environment I have to run in is inside Mozilla JavaScript
Rhino: http://www.mozilla.org/rhino/scriptjava.html

This is an integration with a 3rd party, and I have no other choice
but to do it this way.  So the way this works, is there is some
JavaScript file that calls the java code that does the above like
this:

importClass(com.my.domain.MyServiceWrapper);

function callServiceWrapper( ) {

   MyServiceWrapper.callService(id, url, username, password);
}

However, in this kind of environment it does not work.  Using
WireShark to capture the raw packet data and see the SOAP exchange, I
see that when it runs from the Rhino environment it base64 encodes the
User/Password MessageElements.

This is what it sends:

http://lang.java";>YWRtaW4=
http://lang.java";>YWRtaW4=

When I run in a pure Java environment without Rhino, it does not do
this.  Same code, same libraries, same JDK -- the only difference here
is Rhino.

Our web service server blows up on the base64 encoded elements:

soapenv:Server.generalExceptionError
parsing username/passwordhttp://xml.apache.org/axis/";>hostname

Does anyone have a clue why this might occur, and how I can fix it?

Thanks in advance,
Davis


Axis MTOM and Base64

2007-12-10 Thread Gerwood Stewart
Some of the online documentation (http://ws.apache.org/axis2/1_0/mtom- 
guide.html)  states that
"add and set the "enableMTOM" parameter to true in the Axis2.xml.  
When it is set, *outgoing* messages *which contains optimizable  
content* will be serialized and send as MTOM optimized messages. If  
it is not set all the binary data in binary content nodes will be  
serialized as Base64 encoded strings."


From my understanding of this you can enable MTOM so that the  
outgoing message is wrapped in MTOM ONLY if it contains optimizable  
content.


I tried enabling this, however it is now always on. Every message,  
even ones that contain only string fields (no base64) are wrapped in  
MTOM.


Does anybody have any ideas about where to look to adjust this, or  
have I mis-interpreted the documentation?


Thanks

Gerwood Stewart
Programmer
Teaching and Learning Centre
University of New England
[EMAIL PROTECTED]





Re: Problem with POJO Base64 Decoding

2007-07-02 Thread Me Coder

Hi,

Did you find a solution?

Thanks!


David-371 wrote:
> 
> Hello,
> 
> I'm new to Axis, using Axis 2 Java v1.2 and am having
> trouble moving binary data.
> 
> What I've done so far is successfully write and deploy
> some POJO's.  I'd now like to transfer some binary
> data and have added a field like this:
> 
> public byte[] getData()
> {
> ...
> }
> 
> public void setData(byte[] data)
> {
> ...
> }
> 
> If I run java2wsdl, it does just what I expect--it
> defines the "data" field as "xs:base64Binary".  If I
> then create a client from that WSDL (tried both Java
> and C++) and make the soap call with my data, the
> server chokes with this:
> 
> java.lang.NumberFormatException: For input string:
> "/9j/4A...(long base64 string)../9k="
>   at
> java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
>   at java.lang.Integer.parseInt(Integer.java:447)
>   at java.lang.Byte.parseByte(Byte.java:151)
>   at java.lang.Byte.(Byte.java:325)
>   at
> org.apache.axis2.databinding.typemapping.SimpleTypeMapper.getSimpleTypeObject(SimpleTypeMapper.java:85)
>   at
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:361)
>   at
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:349)
>   at
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:403)
>   at
> org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:676)
>   at
> org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:624)
>   at
> org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:560)
>   at
> org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:118)
>   at
> org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:83)
>   at
> org.apache.axis2.receivers.AbstractInMessageReceiver.receive(AbstractInMessageReceiver.java:33)
>   at
> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
>   at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
>   at
> org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:216)
>   at
> org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:275)
>   at
> org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:184)
>   at
> org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:74)
> [...]
> 
> Of course, I can force it to work if I change the type
> to String and just have both clients "know" that it's
> base64, but I'd really like to avoid that if possible
> (it's both bad style and extra headache).
> 
> Should I expect the technique I'm using above to work?
>  It looks like Axis is passing the entire
> base64-encoded String to the java.lang.Byte(String)
> constructor for some reason.  Should I use something
> other than byte[] to help the POJO mechanism figure it
> out?  Do I need to abandon the POJO approach?
> 
> Thanks,
> David
> 
> 
>  
> 
> Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user
> panel and lay it on us.
> http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-POJO-Base64-Decoding-tf3904546.html#a11406866
Sent from the Axis - User mailing list archive at Nabble.com.


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



Problem with POJO Base64 Decoding

2007-06-11 Thread David
Hello,

I'm new to Axis, using Axis 2 Java v1.2 and am having
trouble moving binary data.

What I've done so far is successfully write and deploy
some POJO's.  I'd now like to transfer some binary
data and have added a field like this:

public byte[] getData()
{
...
}

public void setData(byte[] data)
{
...
}

If I run java2wsdl, it does just what I expect--it
defines the "data" field as "xs:base64Binary".  If I
then create a client from that WSDL (tried both Java
and C++) and make the soap call with my data, the
server chokes with this:

java.lang.NumberFormatException: For input string:
"/9j/4A...(long base64 string)../9k="
at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:447)
at java.lang.Byte.parseByte(Byte.java:151)
at java.lang.Byte.(Byte.java:325)
at
org.apache.axis2.databinding.typemapping.SimpleTypeMapper.getSimpleTypeObject(SimpleTypeMapper.java:85)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:361)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:349)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:403)
at
org.apache.axis2.databinding.utils.BeanUtil.processObject(BeanUtil.java:676)
at
org.apache.axis2.databinding.utils.BeanUtil.ProcessElement(BeanUtil.java:624)
at
org.apache.axis2.databinding.utils.BeanUtil.deserialize(BeanUtil.java:560)
at
org.apache.axis2.rpc.receivers.RPCUtil.processRequest(RPCUtil.java:118)
at
org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:83)
at
org.apache.axis2.receivers.AbstractInMessageReceiver.receive(AbstractInMessageReceiver.java:33)
at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:144)
at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:279)
at
org.apache.axis2.transport.http.HTTPWorker.service(HTTPWorker.java:216)
at
org.apache.axis2.transport.http.server.AxisHttpService.doService(AxisHttpService.java:275)
at
org.apache.axis2.transport.http.server.AxisHttpService.handleRequest(AxisHttpService.java:184)
at
org.apache.axis2.transport.http.server.HttpServiceProcessor.run(HttpServiceProcessor.java:74)
[...]

Of course, I can force it to work if I change the type
to String and just have both clients "know" that it's
base64, but I'd really like to avoid that if possible
(it's both bad style and extra headache).

Should I expect the technique I'm using above to work?
 It looks like Axis is passing the entire
base64-encoded String to the java.lang.Byte(String)
constructor for some reason.  Should I use something
other than byte[] to help the POJO mechanism figure it
out?  Do I need to abandon the POJO approach?

Thanks,
David


  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 


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



[AXIS 2] ADB stub and Soap body with Base64Binary data (Base64 <-->DataHandler)

2007-03-19 Thread Giuseppe Sarno
Hi,
I have a wsdl which contains a message data has got xs:base64Binary
data.

The Code generated using the code generation tools presents the
setInfo(DataHandler) function.
Now all the example I have seen talk about attachment etc. (which I'm
not really interested) as the data is passed in the Soap body.

So the question is, can anyone help me understanding how can I pass a
base64 encoded binary data into the DataHandler ? 
And how can I decode it ?

Regards.


Base64 encoding

2007-02-21 Thread Venky Vasant
A file  when it is encoded using Apache's Base64 and stored in database 
(sqlserver), all the blank spaces (whitespace)   are converted to "?"
  its kind of a html tag with a white space

if this is not the right forum, please let me know where should i post this

Thanks
Venkat


 

Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited

Re: adb, byte array, base64

2006-11-30 Thread Davanum Srinivas

BoD,

could you please log a JIRA and upload your sample?

thanks,
dims

On 11/30/06, BoD <[EMAIL PROTECTED]> wrote:

Hi!

I'm trying to make a very simple web service, using adb:

. I make a simple class with public methods
. I use java2wsdl to generate a .aar
. I publish it, and get the wsdl file
. I use the wsdl file to generate a stub

It works well as long as I use simple types (String, int) for the method
parameters, but when I tried to put a byte[] in there, it stopped
working with an exception ("Reader cannot be null").

Anyway I noticed the binding for a byte[] was not xsd:base64Binary (it's
a sequence). Is there a binding to/from xsd:base64Binary in adb?

Thank you very much for your help!

BoD


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





--
Davanum Srinivas : http://www.wso2.net (Oxygen for Web Service Developers)

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



adb, byte array, base64

2006-11-30 Thread BoD

Hi!

I'm trying to make a very simple web service, using adb:

. I make a simple class with public methods
. I use java2wsdl to generate a .aar
. I publish it, and get the wsdl file
. I use the wsdl file to generate a stub

It works well as long as I use simple types (String, int) for the method 
parameters, but when I tried to put a byte[] in there, it stopped 
working with an exception ("Reader cannot be null").


Anyway I noticed the binding for a byte[] was not xsd:base64Binary (it's 
a sequence). Is there a binding to/from xsd:base64Binary in adb?


Thank you very much for your help!

BoD


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



Re: FW: Base64

2006-08-11 Thread Anne Thomas Manes

Don't use SOAP Encoding. Define the service as style="wrapped" (in
either java2wsdl or WSDD). You may need to edit the generated WSDL
file and specify the type of the image as xsd:base64binary.

On 8/11/06, Nirmish Dholakia <[EMAIL PROTECTED]> wrote:


Thanks Anne,

We have a service returning a string as XML.

Following is the sample out-put of the service.



Nirmish
Dholakia
25


So in the WSDL the type of the output is defined as  "type=soapenc:string".


Now  The requirement is like ..

we want to append two images in the current websevice response. So the
response would be like below.




Nirmish
Dholakia
25
 


For producing above out put. Can I encode the image file using Base64 and
pass this base64 string as element's( and ) value.
If yes then will the .Net client able to decode the same?

Or is there any other way?

Please give your inputs/comments.

Thanks You
Nirmish



-Original Message-
From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 10, 2006 8:36 PM
To: axis-user@ws.apache.org; [EMAIL PROTECTED]
Subject: Re: Base64

Yes. Define it as type="xsd:base64binary".

Anne

On 8/10/06, Nirmish Dholakia <[EMAIL PROTECTED]> wrote:
>
>
> Hi All,
>
> I have a web services written in Java. and the client for this
> webservice is in .Net environment.
>
> I am passing an image file in this webservice using Base64 encoding.
>
> Now the question is will the .Net client able to decode the same?
>
> Please provide your views/inputs.
>
> Thank You
> Nirmish
>
>
>
> --
>  No virus found in this outgoing message.
>  Checked by AVG Free Edition.
>  Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date:
> 8/7/2006
>

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006



-
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]



FW: Base64

2006-08-11 Thread Nirmish Dholakia
 
Thanks Anne,

We have a service returning a string as XML.

Following is the sample out-put of the service.



Nirmish
Dholakia
25


So in the WSDL the type of the output is defined as  “type=soapenc:string”.


Now  The requirement is like ..

we want to append two images in the current websevice response. So the
response would be like below.




Nirmish
Dholakia
25
 


For producing above out put. Can I encode the image file using Base64 and
pass this base64 string as element’s( and ) value.
If yes then will the .Net client able to decode the same?

Or is there any other way? 

Please give your inputs/comments.

Thanks You
Nirmish



-Original Message-
From: Anne Thomas Manes [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 10, 2006 8:36 PM
To: axis-user@ws.apache.org; [EMAIL PROTECTED]
Subject: Re: Base64

Yes. Define it as type="xsd:base64binary".

Anne

On 8/10/06, Nirmish Dholakia <[EMAIL PROTECTED]> wrote:
>
>
> Hi All,
>
> I have a web services written in Java. and the client for this 
> webservice is in .Net environment.
>
> I am passing an image file in this webservice using Base64 encoding.
>
> Now the question is will the .Net client able to decode the same?
>
> Please provide your views/inputs.
>
> Thank You
> Nirmish
>
>
>
> --
>  No virus found in this outgoing message.
>  Checked by AVG Free Edition.
>  Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 
> 8/7/2006
>

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006
 

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006
 


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



RE: Base64

2006-08-10 Thread Nirmish Dholakia
Thanks Anne,

But I forgot to mention that I am using Axis for generating the wsdl. Hence
it will not define the type as  type="xsd:base64binary” so weather I have to
modify the generated WSDL? 

Thank You again

Nirmish

-Original Message-
From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 10, 2006 8:36 PM
To: axis-user@ws.apache.org; [EMAIL PROTECTED]
Subject: Re: Base64

Yes. Define it as type="xsd:base64binary".

Anne

On 8/10/06, Nirmish Dholakia <[EMAIL PROTECTED]> wrote:
>
>
> Hi All,
>
> I have a web services written in Java. and the client for this 
> webservice is in .Net environment.
>
> I am passing an image file in this webservice using Base64 encoding.
>
> Now the question is will the .Net client able to decode the same?
>
> Please provide your views/inputs.
>
> Thank You
> Nirmish
>
>
>
> --
>  No virus found in this outgoing message.
>  Checked by AVG Free Edition.
>  Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 
> 8/7/2006
>

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


--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006
 


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



Re: Base64

2006-08-10 Thread Anne Thomas Manes

Yes. Define it as type="xsd:base64binary".

Anne

On 8/10/06, Nirmish Dholakia <[EMAIL PROTECTED]> wrote:



Hi All,

I have a web services written in Java. and the client for this webservice is
in .Net environment.

I am passing an image file in this webservice using Base64 encoding.

Now the question is will the .Net client able to decode the same?

Please provide your views/inputs.

Thank You
Nirmish



--
 No virus found in this outgoing message.
 Checked by AVG Free Edition.
 Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006



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



Base64

2006-08-10 Thread Nirmish Dholakia



Hi 
All,
 
I have a web 
services written in Java. and the client for this webservice is in .Net 
environment.
 
I am passing 
an image file in this webservice using Base64 encoding.
 
Now the 
question is will the .Net client able to decode the same?
 
Please 
provide your views/inputs.
 
Thank 
You
Nirmish


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.10.7/411 - Release Date: 8/7/2006
 


Re: Possible Axiom Bug: base64 encoding

2006-06-17 Thread Eran Chinthaka
Hi Carlos,

Thanks for digging in to the problem. Can you please create a patch and
attach it to a JIRA (http://issues.apache.org/jira/browse/AXIS2)?

-- Chinthaka


Carlos Perez wrote:
> Hi,
> 
> I have been trying to consume an Axis2 web service that returns binary
> data in base64 from a .NET client, and the client is complaining about
> invalid characters in the base64 string. I took a look at the string and
> actually the base64 string is including '=' chars in the middle of the
> string, but this char is only allowed at the end of the string, for
> padding. So I took a look at the code for the class
> org.apache.axiom.om.impl.llom.OMTextImpl and there seems to be a bug in
> the base64 encoding process, in the method getText(). This method is
> encoding chunks of 1024 bytes at a time; base64 encodes 3 bytes at a
> time, and as 1024 is not a multiple of 3 then a pad of two '=' chars is
> generated for every chunk. I think that with a chunk size that is
> multiple of 3  (i.e. 1023), this problem could be solved.
> 
> 
>public String getText() throws OMException {
>...
> InputStream inStream;
> inStream = this.getInputStream();
> byte[] data;
> StringBuffer text = new StringBuffer();
> do {
> data = new byte[1024];
> int len;
> while ((len = inStream.read(data)) > 0) {
> byte[] temp = new byte[len];
>     System.arraycopy(data, 0, temp, 0, len);
> text.append(Base64.encode(temp));
> }
> 
> } while (inStream.available() > 0);
> 
>   ...
> }
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 




signature.asc
Description: OpenPGP digital signature


Possible Axiom Bug: base64 encoding

2006-06-16 Thread Carlos Perez

Hi,

I have been trying to consume an Axis2 web service that 
returns binary data in base64 from a .NET client, and the 
client is complaining about invalid characters in the 
base64 string. I took a look at the string and actually 
the base64 string is including '=' chars in the middle of 
the string, but this char is only allowed at the end of 
the string, for padding. So I took a look at the code for 
the class org.apache.axiom.om.impl.llom.OMTextImpl and 
there seems to be a bug in the base64 encoding process, in 
the method getText(). This method is encoding chunks of 
1024 bytes at a time; base64 encodes 3 bytes at a time, 
and as 1024 is not a multiple of 3 then a pad of two '=' 
chars is generated for every chunk. I think that with a 
chunk size that is multiple of 3  (i.e. 1023), this 
problem could be solved.



   public String getText() throws OMException {
   ...
InputStream inStream;
inStream = this.getInputStream();
byte[] data;
StringBuffer text = new StringBuffer();
do {
data = new byte[1024];
int len;
while ((len = inStream.read(data)) > 
0) {

byte[] temp = new byte[len];
System.arraycopy(data, 0, temp, 
0, len);

    text.append(Base64.encode(temp));
}

} while (inStream.available() > 0);

  ...
}




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



Re: Base64 and Compression

2006-04-17 Thread Martin Gainty
Jan-

I found this article to be quite helpful on applying Base64 encoding to either 
the envelope or the individual element
http://xml.sys-con.com/read/40089.htm

Martin--
*
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



- Original Message - 
From: "Jan Krumsiek" <[EMAIL PROTECTED]>
To: 
Sent: Monday, April 17, 2006 8:14 AM
Subject: Base64 and Compression


> Hello.
> 
> I am currently using a JWS Web Service to provide an web interface to an EJB. 
> I know, JWS Services are simple and primitive, but it should be enough for 
> this simple redirection purpose.
> 
> Below is message I posted one example how I am calling the Web Service from 
> the client side. Now, is there any way to the the Axis packages do automatic 
> base64 encoding and/or compression of the String data?
> 
> Many thanks in advance,
> 
> Jan
> 
> 
> Code:
> 
> public static String getMatrixChunk(String sessionID, int elements) throws 
> MalformedURLException, ServiceException, RemoteException {
> Call call = getStandardCall("getMatrixChunk");
> call.addParameter("op1", XMLType.XSD_STRING, ParameterMode.IN );
> call.addParameter("op2", XMLType.XSD_INT, ParameterMode.IN );
> call.setReturnType(XMLType.XSD_STRING );
> // base64 decode the result
> return (String)Base64.decodeToObject((String) call.invoke( new Object [] { 
> sessionID, new Integer(elements) }));
> }
> 
> private static Call getStandardCall(String methodName) throws 
> ServiceException, MalformedURLException {
> Service service = new Service();
> Call call = (Call)service.createCall();
> 
> call.setTargetEndpointAddress(new URL(END_POINT));
> call.setOperationName(methodName);
> 
> return call;
> } 
> 
> 
> 
> 
> _
> versendet mit www.Oleco.de Mail - Anmeldung und Nutzung kostenlos!
> Oleco www.netlcr.de jetzt auch mit SPAMSCHUTZ.
> 
> 
>   
>

Re: Base64 and Compression

2006-04-17 Thread robert lazarski
You could either: 

Use gzip compression: 

http://wiki.apache.org/ws/FrontPage/Axis/GzipCompression

Or just do getBytes() on the string and compress the byte array:

http://javaalmanac.com/egs/java.util.zip/CompArray.html

HTH,
Robert
http://www.braziloutsource.com/On 4/17/06, Jan Krumsiek
 <[EMAIL PROTECTED]> wrote:Hello.
I
am currently using a JWS Web Service to provide an web interface to an
EJB. I know, JWS Services are simple and primitive, but it should be
enough for this simple redirection purpose.Below is message I
posted one example how I am calling the Web Service from the client
side. Now, is there any way to the the Axis packages do automatic
base64 encoding and/or compression of the String data?Many thanks in advance, JanCode:public
static String getMatrixChunk(String sessionID, int elements) throws
MalformedURLException, ServiceException, RemoteException {Call call = getStandardCall("getMatrixChunk");call.addParameter("op1", XMLType.XSD_STRING, ParameterMode.IN );
call.addParameter("op2", XMLType.XSD_INT, ParameterMode.IN );call.setReturnType(XMLType.XSD_STRING );// base64 decode the resultreturn (String)Base64.decodeToObject((String) call.invoke
( new Object [] { sessionID, new Integer(elements) }));}private static Call getStandardCall(String methodName) throws ServiceException, MalformedURLException {Service service = new Service();Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new URL(END_POINT));call.setOperationName(methodName);return call;}_
versendet mit www.Oleco.de Mail - Anmeldung und Nutzung kostenlos!Oleco www.netlcr.de jetzt auch mit SPAMSCHUTZ.



Base64 and Compression

2006-04-17 Thread Jan Krumsiek
Hello.

I am currently using a JWS Web Service to provide an web interface to an EJB. I 
know, JWS Services are simple and primitive, but it should be enough for this 
simple redirection purpose.

Below is message I posted one example how I am calling the Web Service from the 
client side. Now, is there any way to the the Axis packages do automatic base64 
encoding and/or compression of the String data?

Many thanks in advance,

 Jan


Code:

public static String getMatrixChunk(String sessionID, int elements) throws 
MalformedURLException, ServiceException, RemoteException {
Call call = getStandardCall("getMatrixChunk");
call.addParameter("op1", XMLType.XSD_STRING, ParameterMode.IN );
call.addParameter("op2", XMLType.XSD_INT, ParameterMode.IN );
call.setReturnType(XMLType.XSD_STRING );
// base64 decode the result
return (String)Base64.decodeToObject((String) call.invoke( new Object 
[] { sessionID, new Integer(elements) }));
}

private static Call getStandardCall(String methodName) throws ServiceException, 
MalformedURLException {
Service service = new Service();
Call call = (Call)service.createCall();

call.setTargetEndpointAddress(new URL(END_POINT));
call.setOperationName(methodName);

return call;
} 




_
versendet mit www.Oleco.de Mail - Anmeldung und Nutzung kostenlos!
Oleco www.netlcr.de jetzt auch mit SPAMSCHUTZ.

 
   


Re: content-transfer-encoding: base64

2006-02-11 Thread trebor iksrazal
Haven't tried it as an attachment. Of course over the
wire you could just convert it to a string: 

 ByteArrayOutputStream baos = new
ByteArrayOutputStream();
 ...
 new String(Base64.encode(baos.toByteArray()));

And of course wsdl has a base64 type - I recently sent
a zip as base64 with wsdl as I needed error handling. 


HTH, 
Robert (clearing my iksrazal inbox). 
http://www.braziloutsource.com/

--- Argo <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> Is it possible specify to
> Content-Transfer-Encoding:base64 for ws
> attachment with Axis 1.3?
> 
> I have a generated client class with method with
> DataHandler.
> DataHandler DataSource is simple
> ByteArrayDataSource. Bytes are encoded
> as base64. 
> 
> 
> -- Argo
> 


"None are more hopelessly enslaved than those who falsely believe they are 
free. -- Goethe"

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


content-transfer-encoding: base64

2006-02-10 Thread Argo
Hi all,

Is it possible specify to Content-Transfer-Encoding:base64 for ws
attachment with Axis 1.3?

I have a generated client class with method with DataHandler.
DataHandler DataSource is simple ByteArrayDataSource. Bytes are encoded
as base64. 


-- Argo