Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

Alex Hurtt

Ranch Hand
+ Follow
since Oct 26, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
4
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 Alex Hurtt

Arjun Reddy wrote:

Bosun Bello wrote:The handleMesssge method that you will implement takes a reference to SOAPMessageContext.



Sorry I meant, I need to call the handleMessage method passing in the SoapMessageContext right? So How do I get the SoapMessageContext?

Thanks.



You don't explicitly call your handleMessage() method. You just implement it and the JAXWS runtime will invoke it for you at the appropriate point in the message handling chain assuming you have registered your handler with the JAXWS runtime either programmatically or by external XML configuration somehow.
9 years ago

Arjun Reddy wrote:Thanks Christopher and Alex for replying.

Christopher- I was looking at the link you replied back and I have a question. How do I get a reference to the SOAPMessageContext?



If you're going to go the handler route, then if you need a SOAPMessageContext you should write a Handler that implements SOAPHandler. The JAXWS runtime will pass the handleMessage() method of your handler an instance of SOAPMessageContext. From the SOAPMessageContext you can get a SOAPMessage with the getMessage() method. This will allow you programmatic access to all elements of the entire SOAP message envelope. If, on the other hand, you only need access to the message body payload, you can implement the LogicalHandler interface in which case the JAXWS runtime will give the handleMessage() method a LogicalMessageContext on which you may invoke getMessage() to obtain a LogicalMessage. From this LogicalMessage you can invoke one of its getPayload(...) methods to get the body contents of the message as a couple different types...

Better yet...here, read this: http://jax-ws.java.net/articles/handlers_introduction.html

and this:

http://download.oracle.com/javase/6/docs/api/index.html?javax/xml/ws/handler/soap/SOAPMessageContext.html
9 years ago
While Bear gives good advice regarding updating your jsp knowledge, it appears that there are deeper issues at play here with this code. First, I want to make sure my interpretation of what you are actually aiming to do is correct. The reason the Southeast Teams header appears once for every loop iteration is, oddly enough, because you have it inside the body of your loop. So if your list contains 8 total elements you're going to see it 8 times the way you have it now. Plus, have you examined the HTML source code output from this script? Is it legal HTML? Looks like you are going to be outputting a table tag once then followed by an h2 tag for each iteration of your loop, but this h2 tag doesn't fall within any kind of td or th element like it should if it were part of a table...assuming this is what you wanted to do anyway which it probably isn't. Did you intend for the output to be in a single 2 column table with 1 column for Northeast Teams and 1 column for southeast teams? Or did you intend for it to be two separate tables one after the other? I think this isn't really so much of a jsp specific problem but possibly just a basic programming logic problem.
9 years ago
JSP
Why did you not use the tag library implementation to render your hidden input tag when you used it for the html:form tag and all the other inputs? This might something to do with it. What property will the value be bound to on the backing bean? Is the hidden input field even getting rendered when you examined your HTML output source?
9 years ago
Try using one of the fac.createOMElement(...) methods on your 'fac' object instead of createOMText(...). It looks like they've sort of reinvented DOM parsing with this Axiom API to some extent.

If you spend a few minutes and study the API documentation for your OMNode class here: http://ws.apache.org/axiom/apidocs/index.html?overview-summary.html

You will see there are constants defined in the interface that indicate what type of Node the implementing instance will be. These are commonly defined XML node types and each will be treated differently according to XML specs. If you are creating a text node and trying to add that to the body of your envelope, the Axiom framework will rightly treat it as plain text containing characters that must be escaped according to XML specification.
9 years ago
If you are using the sun/oracle reference implementation I believe you can set the following system property which is slightly easier than inserting a custom handler in the handler chain.

com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump=true
9 years ago
Well after checking javadocs for both JSTL 1.1 and 1.2 I see that your class in question is in fact in both version of the API and so should be in the jar file regardless of which one you have so my original suggestion (which admittedly was just the first thing that came to mind) doesn't seem to hold much validity in your case. Are you using an IDE? Are you packaging in a .war file inside an .ear file or anything or just a standalone .war file? When you say you are 'including' the jars, what exactly do you mean? Putting them in WEB-INF/lib of the .war file? If you are using an ANT script or some IDE function to package your .war, have you examined the contents of the .war you are deploying to make sure it actually included the jar files?
9 years ago
JSF
Verify by examining the contents of your jar files. Maybe you are looking for a class that is specified in JSTL 1.1 but no longer exists in JSTL 1.2 while you have clearly downloaded the JSTL 1.2 libraries or something like that.
9 years ago
JSF
Don't you mean:

System.out.println("Query " + i + " is executing...." + pst1);

??
9 years ago
JSP

Anupreet Arora wrote:Hi,

What is not clear to me in this is how is this useful in cases where a response might take an uncontrollable time to generate? In context of my example above, I don't want to go to javaranch.com after I have waited for 1 minute and another 10 secs. I want to go to javaranch after 10 secs while my response is taking one minute (read an uncontrollable time) to generate.

Appreciate your help ..



The way I have seen this mechanism used in practice most of the time is a scenario where 3 "pages" are involved. The 1st page - your input form. 2nd page - a "please wait while we process your request" page. 3rd page - the response "we're done, here's you answer" page. The input form actually submits not to the intended processing target action/servlet but to the wait page passing along all user entered data. The wait page usually has some animated equivalent of a spinning hourglass or progress meter of some kind. As soon as the wait page loads, it automatically uses the "Refresh" mechanism with a wait period of about 1 second to invoke the actual request processing servlet, again passing along all the user entered data from the first input page. Now the user continually sees the "wait" page whilst the long running request is processing on the backend. When the servlet is done it sends the 3rd page as the response. In essence the wait page is nothing but an intermdiary proxy to the actual form processing servlet so that the user gets the visual cue that something is happening on the backend and they are not as likely to want to hit refresh or something.
9 years ago
Tried this again on a different computer and the method using:

xjc jar:file:/path/to/jarfile.jar!/path/to/targetschema.xsd

actually does work so...must be a configuration, bug, or version issue on the other machine.
I have been grappling with finding an answer to this for hours...on the surface it doesn't seem to work but maybe I'm doing it wrong. I have a jar file containing nothing but a directory structure full of various XSD files. I want to be able to use either the XJC.exe (with sun/oracle java 6) or the XJC Ant task to target and compile certain schemas out of this jar file without having to extract them. According to the documentation you are supposed to be able to supply an XSD file name or a URL or a directory containing one or more schemas or a jar file as the input to XJC. So far I can only get it to work when I extract the jar file contents and specify a specific XSD file or directory. That is not desirable. I have tried something like this (assuming the jar file is name 'myjarfile.jar'):

xjc myjarfile.jar

I get an error saying something like "no grammar was specified"

I try specifying as a URL...something like this:

xjc jar:file:/myjarfile.jar!/path/to/schemafile/targetschema.xsd

This just doesn't work as it appears not to be able to locate the schema this way. I have verified the path and jar file directory structures and I'm almost sure I didn't make a mistake in the path reference. Am I trying to do something that just wasn't meant to be here or am I just screwing it up somehow?

EDIT: I notice also it says that if you specify a jar file that /META-INF/sun-jaxb.episode will be compiled...however the jar file contains no such file and I cannot put one there since I am not allowed to modify the jar file contents. So am I out of luck...must this file be present to give a jar file of schemas to XJC or is it optional?

Farhad Rahmati wrote:My tutor might think of plagiarism of he find the code here.



Except that it would be posted with your name being attributed as the author of the post so...if your tutor were to see that and still assume you plagiarized it then you should probably consider finding a slightly smarter tutor.
But no worries, glad you were able to figure it out.
10 years ago

arnaldo silveira wrote:hi,

I can pass a value from a jsp to a class without using servlet?

for example:

jsp



I need to send that value to a class I do not want to use servlet

anybody help?

thanks



Not sure I understand why you are having a problem here...although using scriptlet code in JSP's is inadvisable, you can put any Java code you want to in a scriptlet. You have the whole java library at your disposal between those little <% and %> tags...you aren't limited to using only classes in the servlet/jsp API's or anything. Just instantiate an instance of the class whos method you want to call and pass the string to it...
10 years ago
JSP
Probably not a good idea. If you can shed some light on why you feel you need to do this in a JSP we might be able to help you figure out a better alternative solution. But without more details we can only say, probably not a good idea to do this.
10 years ago
JSP