dale con

Ranch Hand
+ Follow
since Apr 15, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by dale con

hello all i'm calling a web service that returns a xsd:base64Binary


using this code


but it's not working i get a null

if i do this instead call.invoke(new Object[] {uncompressed}); and inspect the result it is correct

What do i need to do to get the result back in the byte [] bytes object

thanks for any help
15 years ago
hi do you know of an example or tutorial

thanks
15 years ago
hi all

can someone tell me the best way to wait, say 5 seconds before the next line of code executes

e.g.

system.out.println("first line of code");

wait 5 seconds and run next line of code

system.out.println("second line of code after waiting 5 seconds");


thanks
15 years ago
hi all

i'm hving some trouble with compressing (zipping) a String, i'm not too sure how to do t. i've seend examples of compressing a file but not a string, can anyone help me out

I'm trying to modeify this so it takes a string and not a file but getting no where, i know i have to use ByteArrayInputStream but don't know how to use in the example i have


String inFilename = "c:\articles\examplegzip.gz";
GZIPInputStream gzipInputStream =
new GZIPInputStream(new FileInputStream(inFilename));
// Open the output file
String outFilename = "c:\articles\statebirdsclone.txt";
OutputStream out = new FileOutputStream(outFilename);

// Transfer bytes from the compressed file to the output file
byte[] buf = new byte[1024];
int len;
while ((len = gzipInputStream.read(buf)) > 0) {
out.write(buf, 0, len);
}

// Close the file and stream
gzipInputStream.close();
out.close();
15 years ago
hi all ,
i'm new to input/output streams and i'm very stuck

I'm using jdom to return a db recordset and format it as xml, like this

.......
RecordsetToXML rsXML = new RecordsetToXML(rs, "root", "record");
// create the XML from recordset
Document jDOMDoc = rsXML.build();
XMLOutputter outputter = new XMLOutputter();
outputter.output(jDOMDoc, writer);
result = writer.toString();
........
where result is the recordset from a db query formatted as xml

i now want to use gzip to compress the 'result'. I have this (http://javaalmanac.com/egs/java.util.zip/CompressFile.html) link but i'm confused how i pass the 'result' to the gzip method.

can anyone help me please

thanks for any help
15 years ago
thanks - i've already read that article

the client is a vb client, so don't think this will work
15 years ago
hi all

can anyone give me / show links to an example of a webservice that zips
a message

i need to write a ws will send data to a client, but before the client
gets the data i need to zip it as it will be a large dataset.

has anyone an example zipping the soap body / message at server side ?

thanks for any help
15 years ago
thanks

i can get the remainder doing this

String s = "somestringvalue";

int n = s.length();

int remainder = n % 2;

but don't know how append String s with x number of 0's to make the String s even
15 years ago
hi all

i can find the length of a string

String s = "mystringodd";

can someone show me how i can then see if the string conains an even number of characters

e.g String s contains 11 chars

whati want to do is see if String s is even, if not i need to append a 0 to make it even, so string s becomes this 0mystringodd

can anyone help me ou with this


many thanks
15 years ago
hi all

i can find the length of a string

String s = "mystringodd";

can someone show me how i can then see if the string conains an even number of characters

e.g String s contains 11 chars

whati want to do is see if String s is even, if not i need to append a 0 to make it even, so string s becomes this 0mystringodd

can anyone help me ou with this


many thanks
15 years ago
hi all can someone please tell me how i convert a string to xml, so that i can iterate through it and grab the elements and their values

e.g. if my string is this
String xml = "<person><firstname>first</firstname><lastname>first</lastname></person>";

i want to iterate through to get the firstname and lastname elements and then get their vlaues

thanks for any help
15 years ago
cheers guys for all your help, much appreciated



i know this is a relatively old thing to do but trying to find stuff out there is quite difficult
15 years ago
hi all ,

can anyone give me an example of screen scraping a website and return the result e.g. html as a string

or lead me to some tutorials / examples

many thanks
15 years ago
hi all

i'm currntly getting username and password using basic authentication in my web service.

we are using a product that doesn't support http basic authentaication in the http header, so now i have to re-write my web service. Can anyone suggest an alternative way to do this?

Can i set the username and password in the SOAP Envelope/body?

Thsi is the code i'm curently using
String headerAuth = (String)msgContext.getProperty(HTTPConstants.HEADER_AUTHORIZATION);

if (headerAuth != null)
{
headerAuth = headerAuth.trim();
}

if (headerAuth != null && headerAuth.startsWith("Basic "))
{
int i;

headerAuth = new String(Base64.decode(headerAuth.substring(6)));

String [] userNamePassword = headerAuth.split(":");

userName = userNamePassword[0];
password = userNamePassword[1];
}

thanks for any help
15 years ago
hi all

i'm writing a client to a web service that has authentication and has to be in javascript

if i use java i can do this

.....
call.setusername("username");
call.setpassword("password");
.....


Can anyone tell what this will be in javascript


Thanks for any help
15 years ago