Michael Hul

Greenhorn
+ Follow
since Oct 21, 2008
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 Michael Hul

Sorry I should have posted earlier, but I did something like your 2nd suggestion. Since I invoked the webservice using the following I get the attachment (if it exists) using the following Then I convert the attachment to a byte array and store it in a static class variable in a separate class so that when the 'Display PDF' button is clicked, it loads a servlet that can access the attachment using a call similar to the following then I display it using That seems to work fine. Thanks for the reply
[ November 11, 2008: Message edited by: Michael Hul ]
12 years ago
Thanks for the replys, once again my short-sightedness has been my downfall. I should really learn to better review my code before posting questions. The session variable is the way to go.
Thanks again.
12 years ago
JSP

As long as it isn't final, you can always reassign it. The only difference is you don't need an instance to access it.


How exactly would I go about reassigning it. Currently I have the variable stored in a class called 'pdfStore' so I can set it from another class using Then inside of a servlet I access it using This works for the first time that the variable pdfStream is set but when I run that code again and set the stream to something else (or null for that matter) when i access it, it only gives me the old value of the variable, as if it wasn't set again.
12 years ago
JSP
here is my problem basically:
I have first a jsp with a form that when submitted runs some java code and in particular sets a stream variable(class variable) with pdf content. Now after the variable is set and the process finishes, I need to have access to the value of that variable when another form is submitted before that value is set again to another stream. Unfortunately i get that value as null on the second run to the server if the variable is not declared static, and if it is declared static, then I can't change the value later to the next pdf stream.
Basically what I'm asking is 1) Is there a way to change the value of a static class variable? OR 2) Is there a way to preserve a non-static variable throughout the life of the JVM so that the value is not automatically reset to null?

Thanks in advance
12 years ago
JSP
Not sure if this is where my question belongs but i'll give it a shot.

I need to display a pdf stored in a byte array in a web browser so this is what i've done so far. First i have a jsp that when submited executes the following:

Where 'OpenPDF' maps to my servlet. The problem is with the following code in the servlet:

The problem is that throws an IllegalStateExeption saying that 'OutPutStream already obtained' since the response being passed in is the response object from the jsp and it has that darn 'out' object.

What can I do about this so that I will be able to display the pdf??? Ideally in a separate window aswell.

Thanks
12 years ago
Im not sure exactly where this question belongs so I'll just post it here since it's related to the webservices I'm working on.

I have a service that when invoked returns the response with a pdf as an attachment. This is all initiated from a jsp page. A user clicks a button which then submits the form and then i have a scriptlet call a java class where the webservice is consumed. This returns the response and displays it in the jsp. Now, i also have a second button titled 'Display PDF' that when clicked I need to have display the pdf attachment in another window. How the heck do I go about that??
12 years ago
Thanks Ulf but I found that the problem was my own short-sightedness. I was missing the little error message in the soap response that was saying
"PDF generation error. Could not find a part of the path...".
I fixed that and now the following code gives the attachment(s) I'm looking for (if anyone else ever runs into this problem)

12 years ago
quick question: Is there a way in Axis 1.0 to do the equivalent of the following;

I have a web service being called using call.invoke(SOAPEnvelope). The web service should return a PDF as an attachment somewhere but i don't know how to get it. I'm pretty new to web services so i'll take any help i can get.

Thanks
12 years ago
Nevermind. Problem solved. The services that didn't work had null values in the request xml files. I just wrote a few lines of code to remove lines from the xml containing the string "xsi:nil" and that appears to have fixed the problem.
12 years ago
ok so i decided to try a different route. I use the axis generated locator function and create an axis Call object. At this point i get the xml from the jsp textarea as a string and do this



The problem now is that for some services it works fine and when I invoke the call using the envelope I can get the same response as the existing .net implementation, But for some it doesn't work and it falls into that 'catch' block and throws a NullPointerException. I don't understand why the getSOAPEnvelope works for some of the XMLs but not for others. Any ideas?? Could it be something to do with the ByteArrayInputStream and the buffer size?

Thanks
12 years ago
ok let me try again.
The idea is the user will be presented with an interface (JSP page) where they will choose the service they want to invoke from a list. Once they have chosen the service they will click a button that loads, for example, the following xml into a text area from a file:


They can then change the values as they wish before the service is to be consumed. I'm looking for a way that i can invoke the service with the java values set to the ones above(or any ones the user decides to change) because the request being sent currently looks like this:



I then get the following exception :

System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (8, 40). ---> System.InvalidOperationException: Instance validation error: '' is not a valid value for PaymentFrequencyType.

Through the help of breakpoints I noticed that when getPaymentFrequency() is called, it returns a value of 'null'. Is there something I'm missing? Is using explicit 'set' commands like:

the only way to set values for the request soap message?

Hope that makes my problem a bit clearer.
Thanks
12 years ago
Hi, my problem is as follows (I'll try to word the question as best i can but im new to webservices so be gentle):

I'm working with a webservice test tool that has already been implemented in .net and i've been asked to do the same in java. So, I used the existing wsdl files for the .net implementation and apache axis to generate the stubs / complex types needed. Now, the way this is supposed to work is that the user will load an xml file containing the information to be passed by the soap request, and then have it consumed and return the soap response. However, I have no idea how to send the request with the information stored in the xml. A sample call looks something like:

response = quote.quoteGMP(loan, applicant, coverage, paymentFrequency);

where each field is a class generated by axis from the wsdl. Now, when the values contained within these complex types are set explicitly using their respective 'set' functions, the service works fine. Is there a way I could use the xml to set those values before the service is invoked? Any help with this would be appreciated. I'm using IBM RAD and Axis 1.1(unfortunately)

Sorry if this explanation seems vague, but im new to this stuff and im a bit reluctant to post code because of company privacy etc.

Thanks again
12 years ago