Web Services :: Print Axis2 Response / Request Xml
Nov 27, 2014
I want to print RAW Request Response XML to console. I have created the stubs using wsdl2java axis2. wsdl2java has created 2 java files, one for stub and one for callbackhandler.
I am trying with below method but getting null value for
operationContext.getMessageContext("Out") / operationContext.getMessageContext("In");.
public void SOAPLogHandler(Stub stub){
ServiceContext serviceConxt = stub._getServiceClient().getServiceContext();
//**** Enable the Cache to hold the last operation
OperationContext OperationContext = new OperationContext();
boolean cacheLastOperationContext = true;
OperationContext.setComplete(true); // Enable the Cache value
serviceConxt.setCachingOperationContext(cacheLastOperationContext);
serviceConxt.setLastOperationContext(OperationContext);
[code]....
View Replies
ADVERTISEMENT
Nov 27, 2014
I am calling a SOAP based webservice using JAX-WS and a client jar. I want to get a request and response somehow and save it for audit purposes. How I can do this?
When I google it, only Handlers come up, but, as far as I understand, it is not applicable on client side.
View Replies
View Related
Aug 23, 2010
I was a bit confused of the code generated by the Axis2 Code Gen.
I have created a logIn(String username, String password) method in my service and used Axis2 Code Gen to generate the Stub.
I try to access the logIn method from my Client using the Stub like below:
TestServiceStub stub = new TestServiceStub("http://localhost:8080/axis2/services/TestService");
String test = stub.logIn("user","pass").
but instead of UserName and password as the parameters, the Stub created a Login object as the parameter for the logIn method. like the one below:
stub.logIn(Login login1);
I wanted to try the logIn method by providing a static userName and password but it seems impossible because the Stub changed the parameter for the logIn method.
how to test the logIn method.
View Replies
View Related
Feb 18, 2015
I have a SOAP Client with wsdl to send a query to a SOAP Server. Along with the SOAP response I am supposed to attach a generated csv file (Not required to open and read - just attach).
SOAP Handler has been implemented at server.
Since it is client code I am not supposed to paste the exact contents online.
I can create new SOAPMessage and use AttachmentPart to attach the file but I am stumped regarding where to set it as response. We have used only javax.xml and apache.cxf.
View Replies
View Related
Mar 6, 2015
i'm sending soap request but i'm getting html response it is leading to crash! how to parse html response?
View Replies
View Related
Dec 12, 2014
New to webservices. Can i get to create webservice which takes xml input. Parse it and gives the response to client.
View Replies
View Related
Feb 23, 2015
In SOAPUI, how can I add a new property in a HTTP Test Request? I konw that this there isn´t, but should be somethink like that:
testRunner.testCase.getTestStepByName("myHttpTestRequest").addProperty("newProperty","newValue");
View Replies
View Related
Nov 14, 2014
I generated a WebService from a WSDL using JAXWS and import the finally generated WSDL to my SOAPUI to send out the request and view the response. For some reason, I always have to set WSS TimeToLive as 1000 in the request properties, else I get an error in the response. Now, I generated a client from the WSDL. I wonder if I need to set the WSS TimeToLive here as well
View Replies
View Related
Dec 18, 2014
I have an apache server with rest APIs accepting Json object and produce Json object.testing the sever using Chrome advanced rest client show no problems.I then tried to create a jave client, using org.jboss.resteasy:
public T sendPostRequest(String url, T input) throws Exception {
ClientRequest request = getNewClientRequest(url);
ObjectMapper om = new ObjectMapper();
final String body = om.writeValueAsString(input);
request.body(MediaType.APPLICATION_JSON, body);
final ClientResponse<String> responseObj = request.post(String.class);
validateResponseString(url, responseObj);
String responseString = responseObj.getEntity(String.class);
responseObj.releaseConnection();
[code]....
View Replies
View Related
Apr 6, 2015
I am trying to generate this request with my Java program, but I just can't seem to figure it out: curl -v -H "Authorization:Basic MY_AUTH_CODE" -H "Accept:application/xml" -H "app_id:MY_APP_ID" -H "app_key:MY_APP_KEY" -X GET "THIRD_PARTY_URL"
I tried to generate a query string, but I keep getting 403 errors. I also tried to input my parameters using URLConnection.getRequestProperty("name", "value"), but that didn't work either.
View Replies
View Related
Jan 20, 2015
I created the WSDL first in RSA and then created the java bean skelaton from the WSDL. There are a couple of dateTime fields in the WSDL that are created as GregorianCalendar objects.
When I test with SOAPui and the date fields are passed correctly, everything works great. But when there is an invalid date format or anything else in the SOAP request, instead of returning a Conversion exception or some other validation exception, the field is passed as a null to the request object in the SOAP IMPL. Should't this return an exception?
Sample requests inputs:
<endTimeStamp>2014-01-28T01:30:14.474Z</endTimeStamp> - Date
<endTimeStamp>06-FEB-14 01.51.00.000000000 AM</endTimeStamp> - Null
<endTimeStamp>Any other string be it a date or not.</endTimeStamp> - Null
[Code].....
View Replies
View Related
Mar 23, 2015
I want to write one REST client program for POST request ,request and response is in JSON Format.
public String getAck() {
HttpURLConnection httpConnection = null;
URL url=null;
try {
url = new URL("http://test:8080/ils/main");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
[Code]....
Line OutputStream os = httpConnection.getOutputStream();
I am getting connection time out problem
View Replies
View Related
Apr 24, 2008
I've been googling information on how to print a pdf in java, and it seems that the java print api is used more for printing from a swing app. What I'm needing to do is send a pdf document to the printer upon user request. I would like my app to work as follows - User selects pdf to be printed- Program determines pages to be printed and deducts amount from user account- If sufficient money, program sends job to printer automatically without popping up the print screen.- If printed successfully, then program tells user it was printed. I'm able to figure out the rest of the pieces, in regards to user input and determining pages of the pdf, except I don't see how I will be able to print the pdf.
I've tried to use this code
PrintService defaultPrintService = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob printerJob = defaultPrintService.createPrintJob();
File pdfFile = new File("c://myPdf.pdf");
SimpleDoc simpleDoc = null;
try {
simpleDoc = new SimpleDoc(pdfFile.toURL(), DocFlavor.URL.AUTOSENSE, null);
[Code] ....
But all that I get is junk characters spread across 15 or so pages, for a pdf file that simply says "Hello World". I can open the pdf file on my computer, and print it ok, but when using the above code, it just prints out junk. How I might need to format or setup the pdf so that I can print it correctly. My program could be run on any number of Linux systems, with a multitude of printer types.
View Replies
View Related
Feb 25, 2014
I have the following questions:
1. Does a GET HTTP request contain a request body? If yes what is contained in it? Are the request headers also part of the request body?
2. Is it possible to send a byte array as part of the GET request in its body?
3. Is there a size limitation on the data that can be sent via a GET request?
View Replies
View Related
Feb 19, 2015
Inspite of not returning anything, what is the purpose of response object in servlet? I have typically used or heard of only response.sendRedirect()
View Replies
View Related
Jul 29, 2014
I am trying to print the response of servlet as pdf. Below is my codeI am able to generate the response but not quite sure how should I write it to a pdf.
package com.Hardik;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.ConnectException;
import javax.net.ssl.HttpsURLConnection;
[Code] .....
View Replies
View Related
Oct 5, 2014
@RequestMapping(value = { "/mapping" }, method = RequestMethod.GET)
@ResponseBody
public Map<A, List<B>> getAsByB(HttpServletRequest httpRequest) {
return map;
}
when i try to get it by url i get an error. how can i send a response of a map as a json ?
View Replies
View Related
Jul 23, 2014
I have a requirement where a form is present with first name, last name, file upload etc. File upload is done through ajax call and then the form is submitted to a servlet. I want to know whether the file has been uploaded or not in the servlet which is called after i click on the form submit button. So is there any way i can read the response of the ajax call in the servlet ?
here is the ajax call below
$.ajaxFileUpload
(
{
url:_action,
[Code]...
View Replies
View Related
Jul 6, 2014
I have a EAR enterprise project with EJB and Web module.EJB module has a SongTokenImpl stateless session bean with @Stateless and @Webservice annotation.Web module has SongServlet.java and success jsp.
SongServlet has dependency injection to SongTokenImpl.
@EJB
TicketMaster songMaster;
@EJB
ShoppingCart shoppingCart;
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String songName = request.getParameter("songname");
Token token = tokentMaster.bookToken(new Song(songName));
System.out.println("we got song token for song "+token.getSongName());
[code]....
we got song token for song xyzInstead i see below error.SongServlet threw exception: java.lang.IllegalStateException: Cannot create a session after the response has been committed/
View Replies
View Related
Aug 8, 2014
I am trying to make a method that takes in a cmd command (nslookup, systeminfo, etc), and outputs the response to a text file. I have tried a dozen different ways with no success. below is my most current failure. It succeeds when i run it, but nothing shows up in the text file.
public static void runSystemCommand(String command) {
command = "ping 192.168.1.3";
try{
Process proc = Runtime.getRuntime().exec(command);
InputStream in = new BufferedInputStream(proc.getInputStream());
OutputStream out = new BufferedOutputStream(new FileOutputStream("C:NetPanelDataping.txt"));
[Code] ....
View Replies
View Related
Mar 14, 2015
I'm making a "very" basic blackjack game, and I'm stuck on how to get a user response to hit and stick game play.
import java.util.Random;
import java.util.Scanner;
class blackjack {
public static void main ( String[] args ) {
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
String money;
String name;
[Code]...
I know people will want me to tidy it up, or do it "their" way, but honestly I just need method of getting the user to press h or s and have the program continue under it's own steam.
View Replies
View Related
Jan 22, 2014
i am using eclipse kepler and tomcat 7 with the below code to get a response from the browser. i get no errors on my code and i organize my imports but when i run the code i get an http 404 error. i restart the server and it goes into the whole motion telling me that "Tomcat v7.0 Server at localhost started and is synchonized" i refresh it and i still get the error.
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
[code]....
View Replies
View Related
Jun 15, 2015
I have been using JavaFX for some time now and have encountered many performance issues, mainly with the initial display of GUI elements. For example, a simple stage with a table view (with about 10 columns) and chart takes about 5 seconds to display. A color picker will take about 3 seconds from the time I click the control to when it displays the pallet. This only happens when the controls are first displayed. This can't be right. I have searched and none seems to have a similar problem so I thought I would ask here just to make sure. Here is a sample Hello world that shows the problem with the color picker (takes ~ 3 seconds to show pallet when clicked).
public class HelloWorld extends Application
{
@Override
public void start(Stage primaryStage) {
StackPane root = new StackPane();
ColorPicker cp = new ColorPicker();
root.getChildren().add(cp);
[Code] .....
View Replies
View Related
Oct 16, 2014
I have an arraylist in my servlet which i need to pass to jsp as a response for a javascript call. This is an arraylist of DTOs. There are 24 DTO objects in the list. The DTO has an int variable and a HashMap. And i need to pass this into the javascript code in my jsp page. Do i use json? Do i send the entire list as a json object or should i iterate through the arraylist (from servlet) and serialize all the DTOs and pass that to the jsp?
View Replies
View Related
Oct 2, 2014
I have a class that do a soap request to a web service , the response is containing a base64 string repressing a file content , how can i send this string to a servlet (maybe any other way) to send it to the user as a downloaded file .
View Replies
View Related
Mar 3, 2015
I am creating cash counter application. i want to generate a pdf receipt in new window and print it.
I am using jsp to take input from user and servlets to process the input.
I am able to generate a pdf but in same page. i want it to be a popup menu. How to implement it?
View Replies
View Related