SOAP Output Required In XML Format
Mar 21, 2014
Using the concept of web service (SOAP), I need to have a web service running. The client page will pass an ID to the web service and in return the service will return some values retrieved from the database based on the ID passed, as output. The output so fetched has to be in XML format.
View Replies
ADVERTISEMENT
Nov 6, 2014
I have an output of three columns, Total Income | Tax Payable | Net Income... however to output this I have the following code:
System.out.println(" Total Income | Tax Payable | Net Income");
int i = 0;
for (i=0; i <=18; i++){
if(incomes[i] < 0){
break;
[Code] ....
And the format of it comes out as: Screen Shot 2014-11-06 at 22.50.25.jpg
I'm getting very OCD about the format and I know there is a printf function which would solve this, however I don't really know how to use this correctly and it just messes up when I try to use it.
View Replies
View Related
Feb 12, 2014
I am new to java and I have this assignment that I started but I am now stuck . The instructions are:
Create an ElapsedTimeCalculator class that computes the amount of time that passes between a starting time and an ending time, in military format.
For example, suppose the two times are 1445 and 1730. Then the program output should look something like this:
Start time:1445
End time: 1730
Exactly 2 hour(s) and 45 minute(s) have passed.
Total elapsed time in minutes:165
Total elapsed time in hours:2.75
ElapsedTimeCalculator Class Specifications:
1.Your class will have a constructor that takes two parameters: the starting time and the ending time in military format
2.Your class will also have these methods:
-Get method to return the starting and ending times
-Set method that resets the starting and ending times to values passed as parameters
-a method that returns the hour portion of the elapsed time
-a method that returns the minute portion of the elapsed time
-a method that returns the total elapsed time in minutes
-a method that returns the total elapsed time in hours
Now here below you can see what I have so far...
public class ElapsedTimeCalculator {
private int startTime, endTime;
private int hours;
private int minutes;
private int seconds;
//constructor
ElapsedTimeCalculator(int start, int end)
[Code] ....
I don't have any errors so far, I am more stuck on how to begin a method that returns the hour, minute, etc.. (the third bullet).
View Replies
View Related
Apr 10, 2014
Here's a link to it : [URL] ....
The basic gist is it's "A program that reads in a text file that uses a specific input format and uses it to produce a formatted report for output."
Specifically :"For this lab you will write a Java program that produces a simple formatted report. The program will prompt the user to enter a file name. This file must contain information in a specific format (detailed below). Each "block" of the file contains information for one player in a competition -- the name of the player followed by a number of different scores that that player achieved. The program should find each player's average score, median score and best and worst scores and display them in a line on the final summary report. The program should also determine which player has the highest average score and which player has the lowest average score."
I get the following errors when I try and compile it:
Enter an input file name: Project11.txt
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException... -1
at java.util.ArrayList.elementData(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at Project11.getMedian(Project11.java:68)
at Project11.main(Project11.java:27)
I get that the error(s) reside in lines 68 and 27, among problem other areas, but I'm not exactly sure how I can fix them.
Here's my code:
import java.io.*;
import java.util.*;
public class Project11 {
public static void main(String[] args) throws IOException{
Scanner in = new Scanner(System.in);
System.out.print("Enter an input file name: ");
String input = in.nextLine();
[Code] ....
View Replies
View Related
Dec 30, 2014
I am trying to create a Swing app that connects to a SOAP API. I have never messed around with web services so I sure this is user error .... The code below throws an error that says "Server did not recognize the value of HTTP Header SOAPAction".
Java Code:
import java.io.IOException;
import javax.swing.JOptionPane;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPBody;
[Code] ....
View Replies
View Related
Dec 21, 2014
I have created a SOAP client and initiate the transaction using proxy objects.Need to log the raw SOAP request/response XML message.
PaymentsAppServiceProxy proxy=new PaymentsAppServiceProxy();
QueryTransactionRequest request=new QueryTransactionRequest();
//Need to print the actual XML from the request
try {
QueryTransactionResponse response=proxy.queryTransaction(request);
[code]....
View Replies
View Related
Jan 24, 2015
I am new to web services and need to call a web service that has already been written. Below is the wsdl for the web service.I need to call the web service from my java program. provide the code to call the webservice?
<definitions targetNamespace="urnefaultNamespace">
<message name="CREATECONTACTUSResponse"></message>
<message name="CREATECONTACTUSRequest">
<part name="REQUESTTYPE" type="xsd:string"/>
<part name="SALESORG" type="xsd:string"/>
<part name="FIRSTNAME" type="xsd:string"/>
<part name="LASTNAME" type="xsd:string"/>
<part name="EMAILADDRESS" type="xsd:string"/>
<part name="TELEPHONENUMBER" type="xsd:string"/>
<part name="EXTENSION" type="xsd:string"/>
[code]....
View Replies
View Related
May 20, 2014
Suppose I have the file in a particular directory with the below conntent starts with the below line -
5/15/2014 2:07:36 PM : 10 - 10 : *** Loading XML file DSH_000001_pos.xml ***
After that the content is shown below.
5/15/2014 2:07:36 PM : 10 - 30 : Loading positions for PERIOD DSH - TRDBOOK +NSCCL :INR - HOUS - (INR).
5/15/2014 2:07:36 PM : 10 - 30 : Loading positions for Exchange Complex NSCCL PERIOD Exchange Complex (INR).
5/15/2014 2:07:36 PM : 10 - 30 : Loading positions for Combined Commodity ANDHRABANK - ANDHRABANK PERIOD Combined Commodity (INR).
5/15/2014 2:07:36 PM : 10 - 30 : Loading positions for PERIOD DSH - CFDTRADING +ASXCC :GBP - HOUS - (GBP).
5/15/2014 2:07:36 PM : 20 - 30 : For <ecPort> ASXCC can't find required associated object <clearingOrg>
[code]....
View Replies
View Related
Nov 15, 2014
I would like to draw a rectangle around a certain part of an image.
So I wrote this:
Pixel[] pixels = scene.getPixels();
for( Pixel pixel : pixels)
{
if(pixel >= point.getX() && pixel <= (point.getX()+p2.getWidth())
{
pixel.setGreen(150);
}
}
But the error is giving me incompatible types. I would like to set all the pixels at a certain point up to the dimensions of my rectangle and so on. How would I do that?
View Replies
View Related
Dec 18, 2014
Is it possible to send a duplicate soup request?Basically, I have a situation where two almost identical requests can get sent but right now the response comes back as one response. I wanted visibility to the two responses and the one gets dropped off
View Replies
View Related
Mar 5, 2015
I'm developing a SOAP client and have used wsimport to generate the classes, etc. and all is going pretty well, but the server requires several headers that I've been coding up manually, specifically wise:Security and o:Security blocks. While this is a valid approach, I think I'm probably doing things the hard way and I know .NET (SOAP being an MS standard originally) has some really powerful code to generate these headers. Does java have any similar counterparts? As an example, I'm writing code like the following:
SOAPElement token = securityElement.addChildElement("UsernameToken", "o");
token.addAttribute(soapFactory.createName("u:Id"), "UsernameToken-1");
SOAPElement userToken = token.addChildElement("Username", "o");
userToken.addTextNode(user);
[code]...
View Replies
View Related
Apr 1, 2015
I'm creating a SOAP Client with JS, this is my first time with webServices and I must have several mistakes in my code.
The poit is, with my code, I cant take acces to the WebService, but I don't know how to access to the methods inside. So the webservice gives me the following response:
<h1>Version</h1>
<p>Hi there, this is an AXIS service!</p>
<i>Perhaps there will be a form for invoking the service here...</i>
Instead of the correct XML for the method I'm calling.
This is the code of my SOAP client:
<html>
<script type="text/javascript">
function run(){
var objXMLHttpRequest = new XMLHttpRequest();
objXMLHttpRequest.open("GET", "http://localhost:8080/CrunchifyWS/services/Version?wdsl/", true);
objXMLHttpRequest.onreadystatechange = function () {
//alert(objXMLHttpRequest.readyState+" "+ objXMLHttpRequest.status);
[code]....
I think that te mistake should be in the XML part, but, as I said, this is my first time and I don't know what I'm doing.
When I try to do POST instead of GET I have this reposnse:
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/soap/envelope/"; xmlns:xsd="w3.org/2001/XMLSchema"; xmlns:xsi="w3.org/2001/XMLSchema-instance">; <soapenv:Body> <soapenv:Fault> <faultcode xmlns:ns1="xml.apache.org/axis/">ns1:Client.NoSOAPAction</…; <faultstring>no SOAPAction header!</faultstring> <detail> <ns2:hostname xmlns:ns2="xml.apache.org/axis/">WebServices-PC</…; </detail> </soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
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
Feb 8, 2015
I want to send a SOAP xml to HTTPS url using 2 way mutual ssl. I have my certificates installed in my server. I am creating the SSLSocketFactory like this -
void createSSLSocketFactory()
{String clientTrustStore = *** Path to trust store file installed on my server.
String clientKeyStore = *** Path to key store file installed on my server.
//Reading keystore file
File keyFile = new File(clientKeyStore);
[Code] ....
So my question is,
1) How can I set the TrustStore and KeyStore in the request.
View Replies
View Related
Apr 2, 2014
I'm making a Hangman program for Java, here's my code:
import java.util.Scanner;
public class Hangman {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String answerWord = WordList.getWord();
[Code] .....
The Compiler gives me this only error:
Hangman.java:39: error: unexpected type
displayWord.charAt(i)=userInput.charAt(0);
^
required: variable
found: value
I understand that charAt returns i as a value and not a variable. What do I use to return a variable as I intended?
View Replies
View Related
Feb 21, 2015
I'm using jsoup to parse a calendar page.
I want to use a switch or if/else statement to filter out the data I don't need for the app. This is by no means anything more than a draft because java is easier to work with than android.
Element table = doc.getElementById("launch_calendar");
Iterator<Element> iterate = table.select("td").iterator();
if(iterate.hasNext()){
for(iterate.hasNext();;){
counter++;
[Code] ....
View Replies
View Related
Mar 8, 2014
I am working on an android application that submits images to a servlet, is there any need for me to use restful api ??
View Replies
View Related
Jul 8, 2014
I am trying to get attachements from soap resonse,I am getting the below error "Content is not allowed in prolog" with SOAP Attachment".
soap response is
================
------=_Part_585_5017019.1404291979395Content-Type: text/xml; charset=utf-8
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><RetrieveIncidentResponse message="Success" returnCode="0"
[Code] ....
The code i am trying is below :
try { // Create SoapMessage MessageFactory msgFactory = MessageFactory.newInstance();
SOAPMessage message = msgFactory.createMessage(); SOAPPart soapPart = message.getSOAPPart();
// Iterator i=message.getAttachments();
// Load the SOAP text into a stream source byte[] buffer = soapResponse.getBytes();
[Code] .....
Detailed error log is
===============
ERROR: 'Content is not allowed in prolog.'
Jul 8, 2014 10:13:53 AM com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given source
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to create envelope from given source:
at com.sun.xml.internal.messaging.saaj.soap.EnvelopeFactory.createEnvelope(EnvelopeFactory.java:114)
[Code] .....
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 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
Feb 3, 2015
import java.awt.*;
import java.awt.image.*;
import java.awt.event.*;
import javax.swing.*;
import java.net.*;
/**
An applet that shows a rotating globe.
[Code] ....
View Replies
View Related
May 4, 2014
I have quite a specific view for how I want my components layed out. No matter what I try I can get them to display how I want! I'm using three JPanels. There's a main panel that goes inside the tabbed pane. This main panel contains two other panels. The First panel is a gridbaglayout panel, with labels on the left column, and components on the right column. The second panel is underneath the second, and contains a label, and a button beneath it. THis uses a basic box layout, with one component per line. The label doesn't always appear (depends if a component is changed). With everything showing, this is how it looks so far:
However, I want the Labels on the left of the pane. The right hand column should be aligned horizontally and have more space from the labels. Ideally I'd like a gap between the last label/checkbox and the Note label.
This is my current code for the panel/s inside the tabbed pane window.
videoPanel = new JPanel();
applyVidBtn = new JButton("Apply Settings");
applyVidBtn.setVisible(false);
warningLbl = new JLabel("Note. Applying these settings causes a program restart.");
warningLbl.setVisible(false);
[Code] .....
View Replies
View Related
Mar 6, 2015
I've generated SOAP classes via wsimport from a local WSDL. All of the URLs in the WSDL point to the production services, but for testing I need to connect to a test location (different URL). There are dozens of examples on the web to set the endpoint, but it doesn't seem to be working for me - it's hitting the prod URL, not test.
PrepaidServices ps = new PrepaidServices();
ps.setHandlerResolver(new CustomHandlerResolver());
IPrepaidServices port = ps.getPrepaidServices();
BindingProvider bp = (BindingProvider) port;
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, TEST_URL);
LOG.debug("New Port = " +
[Code]...
The debug correctly shows the TEST port being set correctly, but when executed, inside one of the handler resolvers, I have the following code:
private void logMessage(SOAPMessageContext smc) {
// These headers are null: WSDL_OPERATION PATH_INFO HTTP_REQUEST_METHOD HTTP_REQUEST_HEADERS
LOG.debug("WSDL_PORT = " + smc.get(MessageContext.WSDL_PORT));
LOG.debug("WSDL_SERVICE = " + smc.get(MessageContext.WSDL_SERVICE));
[Code]...
The top debug lines both show the PRODUCTION URL! Shouldn't at least the port be the DEMO URL that I'd previously set?
Am I doing something wrong?
View Replies
View Related
May 30, 2014
I developed an application that is accessing some property files. The condition was that the user should be able to modify the content or parameters of those property file.How can I distribute the application using Java web start that also includes those property file in the client side?
View Replies
View Related
Jun 30, 2014
I have installed and tested j2se jdk8 u5 on my Windows 7 64 bit laptop and successfully tested in Eclipse with a quick Hello World.
JAVA_HOME = C:Program FilesJavajdk1.6.0_25
When I try to install j2ee jdk7 sdk7 I get
Error: Could not find the required version of the Java(TM) 2 Runtime Environment in '(null)'
View Replies
View Related
Jan 21, 2015
This program simply adds integers to an ArrayList and then prompt the user if they would like to delete specific numbers that they don't want.
The output that I get when I want to delete numbers like 2 and 4 from 1 2 3 4 5 is 1 2 3 4 5 instead of 1 3 5.
Java Code:
import java.util.ArrayList;
import java.util.Scanner;
public class AL
{
// A regular array like int arr[] has to have its size declare before run-time and it's not dynamic which mean it can not grow or expand on its own.
static Scanner input = new Scanner(System.in);
// You have to use reference types(Integer, Double, Float); not primitive types(int).
[Code] .....
View Replies
View Related