James Bukowska

Greenhorn
+ Follow
since May 10, 2007
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 James Bukowska

Updated post
13 years ago
I have a SOAP message I coding by hand to mimic the response a server should send me if I sent a SOAP message and got a response back (since I can't atm get a response I just added what I thought I would get back to a .xml file and read it in)

All seemed to work fine until I wanted to get a value out of the SOAP message...

This is my message dumped into a file:



Using the following:


I managed to get the message and use message.writeTo(System.out) to print out what I actually expected to see:



So there I thought I had solved the conversion of a) file input to soap message and what follows, b) string conversion to soap message...

Alas, it was not to be... The next thing I wanted to do was to try and retrieve the success_or_failure value and use it for something, to do that I should need the SOAPBody so away I went again, only to be granted sight of the following exception: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:

Since the message printed okay using message.writeTo(System.out) I was somewhat mullified...



Any ideas greatly appreciated!
13 years ago
Hi all,

I am trying to connect to a secure site running a SOAP server but every method I have tried results in a deadend..., can anyone tell me if I have the right idea?

I am new to SOAP and new to creating secure connections HTTPs so the mix probably isn't good, ideally I'd deal with 1, then move onto 2 but that isn't possible atm since I don't have the server here, I suppose if the need should arise (which hopefully it won't) I could write a simple server and test that way then build up, but surely, it can't be that difficult can it?

My first attempt resulted in something I more or less expected, I assume the PriviledgedActionException indicates me trying to access a secure connection without sending any information about a username/password?

Does the following mean the server replied/rejected my request and therefore spawned the exception? e.g. I got to the server at least, or was it within Java recognising the protocol?

Exception: com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Message send failed



Attempt 2: next, I tried to create a HttpsURLConnection and use that but succeeding in the next exception: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad endPoint type sun.net.www.protocol.https.DelegateHttpsURLConnection:https://partners.dev.alibris.com/partners

I do have a username/password, and the protocol is HTTPs, am I at least on the right track?

Should the above code example (or some rendition of it) and below work?



Thank you for any ideas/help, much appreciated... I truly would like
understand more about this, it seems so simple yet so darned illusive!

Oops, i just added the output I tried to send...

The app is run from the command line... I do not have a SecurityManager, the only information i was given was an example message, an example response...

The url, https as protocol and username/password

Thanks
[ August 23, 2007: Message edited by: James Bukowska ]
13 years ago
Cool thanks, I've decided to continue with my read stream attempt, it seems to work, unless someone can tell me a good enough reason why i shouldn't

No Ajax since my employer doesn't wna tto risk people not having javascript enabled and complaining

Thanks to both of you
13 years ago
Its part of a servlet, and when I first posted the original question I hadn't tried any of this...



The above seems to do what I want which is basically what you suggested... Is there a better way to do this?
13 years ago
Hi, sorry, I wasn't being very clear...

I thought I should reply and say thanks, in doing so I didn't really think about what I was saying...

My employer wants everything done using JAVA, a form posts to a jsp page which then calls various functions in several java classes, setProperties and so on...

I'm not really sure about the best way of going about this so just experimenting...

If JavaScript is out of the question then that would completely exclude AJAX as a solution as far as I can see.

That leaves? Forgive my ignorance on this subject, I can pick up most things without any examples (no one else here seems to know enough for this type of thing) I'm stabbing in the dark with the knowledge I have and learn through trial and error.

I thought I would be able to directly request the page using JAVA passing the relevant querystring using the Socket class or something similar, and then receive the result as XML and use something like SAXBuilder to read the received stream and convert to manageable XML.

Something like this to read in the response, BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));

Am I wrong in that conclusion?
[ May 10, 2007: Message edited by: James Bukowska ]
13 years ago
Thanks, I haven't worked with AJAX yet so querying the methods I could use... The server is SOAP so I know that is one implementation.

Since live partial updates are not required at this stage, I'll start by going down the JAVA route...

I'll bear this in mind for the future (next week)

Thanks again
13 years ago
Hello,

You could try adding your classpath to the environment variable then echo it to ensure you know what the content is...

The error message "incorrect classpath: classes" is telling you the the classes directory you added to the classpath is invalid - try putting the full path to the directory classes, if the directory was in /u/user/classes then add export "$CLASSPATH=$CLASSPATH:/u/user/classes"

Note: if you wantd the classes directory to be the first dir to look in for your classes then add the reference to the beginning instead of the end of the export e.g. export CLASSPATH="/u/user/classes:$CLASSPATH"

Without seeing more I'm only guessing but I'm fairly sure its because you haven't directly referenced the full path of your classes directory :classes: should be /u/whereevermyclassdirectorylives/"
13 years ago
Hello all,
my first post...

I have been asked to implement an AJAX application and have run a few tests using JavaScript which works as I expect... See below...



Is it possible to do the above solely in Java using HttpServlet or something similar? e.g. completely eliminate the need for JavaScript and do everything on the server?

Thanks for help! Much Appreciated!
13 years ago