I have imported a WSDL and use it to send a SOAP request. It looks like this:
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<version xmlns="http://www.tempuri.org">
<parRequest xmlns="">
<faturaUUID>[string?]</faturaUUID>
<faturaNo>[string?]</faturaNo>
<faturaReferansNo>[string?]</faturaReferansNo>
<durumKodu>[int]</durumKodu>
<durumAciklamasi>[string?]</durumAciklamasi>
</parRequest>
</version>
</Body>
</Envelope>
But I want to remove
xmlns=""
such as
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<acceptResponse xmlns="http://tempuri.org/">
<responseRes>
<faturaUUID>[string?]</faturaUUID>
<faturaNo>[string?]</faturaNo>
<faturaReferansNo>[string?]</faturaReferansNo>
<durumKodu>1</durumKodu>
<durumAciklamasi>[string?]</durumAciklamasi>
</responseRes>
</acceptResponse>
</Body>
</Envelope>
My web service code:
@WebService(serviceName = "test", targetNamespace = "http://www.tempuri.org")
public class ErpEntServ {
@WebMethod(operationName = "version")
public String version(@WebParam(name = "parRequest") acceptResponse acceptResponse) {
return "0";
}
how to remove it?
I try to @WebParam(name = "parRequest",targetNamespace = "http://www.tempuri.org") acceptResponse acceptResponse but it did not.
Thank you for helping
about = new JMenuItem("About");
about.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A((Toolkit.getDefaultToolkit().getMenuShortcutMask()))));
JMenu help = new JMenu("Help");
help.add(about);
I was wondering why my aaccelerators were not working. I am running this in snow leopard with JavaSe-1.6 VM. They do work if I pull the menu down then try the key sequence. Thanks
Im a bit unsure and have to get advice.
I have the:
public class MyApp extends JFrame{
And from there i do;
MyServer = new MyServer (this);
MyServer.execute();
MyServer is a:
public class MyServer extends SwingWorker<String, Object> {
MyServer is doing listen_socket.accept() in the doInBackground()
and on connection it create a new
class Connection implements Runnable {
I have the belove DbHelper that are a singleton.
It holds an Sqlite connected. Im initiating it in the above MyApp
and passing references all the way in to my runnable:
class Connection implements Runnable {
My question is what will happen if there are two simultaneous read or `write?
My thought here was the all methods in the singleton are synchronized and
would put all calls in the queue waiting to get a lock on the synchronized method.
Will this work or what can i change?
public final class DbHelper {
private boolean initalized = false;
private String HomePath = "";
private File DBFile;
private static final String SYSTEM_TABLE = "systemtable";
Connection con = null;
private Statement stmt;
private static final ContentProviderHelper instance = new ContentProviderHelper ();
public static ContentProviderHelper getInstance() {
return instance;
}
private DbHelper () {
if (!initalized)
{
initDB();
initalized = true;
}
}
private void initDB()
{
DBFile = locateDBFile();
try {
Class.forName("org.sqlite.JDBC");
// create a database connection
con = DriverManager.getConnection("jdbc:sqlite:J:/workspace/workComputer/user_ptpp");
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
private File locateDBFile()
{
File f = null;
try{
HomePath = System.getProperty("user.dir");
System.out.println("HomePath: " + HomePath);
f = new File(HomePath + "/user_ptpp");
if (f.canRead())
return f;
else
{
boolean success = f.createNewFile();
if (success) {
System.out.println("File did not exist and was created " + HomePath);
// File did not exist and was created
} else {
System.out.println("File already exists " + HomePath);
// File already exists
}
}
} catch (IOException e) {
System.out.println("Maybe try a new directory. " + HomePath);
//Maybe try a new directory.
}
return f;
}
public String getHomePath()
{
return HomePath;
}
private synchronized String getDate(){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
return dateFormat.format(date);
}
public synchronized String getSelectedSystemTableColumn( String column) {
String query = "select "+ column + " from " + SYSTEM_TABLE ;
try {
stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
String value = rs.getString(column);
if(value == null || value == "")
return "";
else
return value;
}
} catch (SQLException e ) {
e.printStackTrace();
return "";
} finally {
}
return "";
}
}
I have a large text file I am reading from and I need to find out how many times some words come up. For example, the word "the". I'm doing this line by line each line is a string.
I need to make sure that I only count legit "the"'s the the in other would not count. This means I know I need to use regular expressions in some way. What I was trying so far is this:
numSpace += line.split("[^a-z]the[^a-z]").length;
I realize the regular expression may not be correct at the moment but I tried without that and just tried to find occurrences of the word the and I get wrong numbers to. I was under the impression this would split the string up into an array and how many times that array was split up was how many times the word is in the string. Any ideas I would be grateful.
Different websites are giving different opinions.
My understanding is this:
To clean up or reclaim the memory that an object occupies, the Garbage collector comes into action. (automatically is invoked???)
The garbage collector then dereferences the object. Sometimes, there is no way for the garbage collector to access the object. Then finalize is invoked to do a final clean up processing after which the garbage collector can be invoked.
is this right?
Okay I got this function who prints the name of all files in a directory recursively problem is that it's very slow and it gets the stuff from a network device and with my current code it has to access the device time after time.
What I would want is to first load all the files from the directory recursively and then after that go through all files with the regex to filter out all the files I don't want. Unless anyone got a better suggestion. I've never before done anything like this.
public static printFnames(String sDir){
File[] faFiles = new File(sDir).listFiles();
for(File file: faFiles){
if(file.getName().matches("^(.*?)")){
System.out.println(file.getAbsolutePath());
}
if(file.isDirectory()){
printFnames(file.getAbsolutePath());
}
}
}
This is just a test later on I'm not going to use the code like this, instead I'm going to add the path and modification date of every file which matches an advanced regex to an array.
This is a weird problem. Here is my code
String reply = listen.executeUrl("http://localhost:8080/JavaBridge/reply.php);
executeUrl returns as String object whatever is returned by the reply.php file.
Now comes the problem. In reply.php I am returning an PHP array and reply is a String.
When I do
System.out.println("Reply = "+reply);
I get
Reply = array(2) { [0]=> string(14) "Dushyant Arora" [1]=> string(19
) "@dushyantarora13 hi"}
But reply is still a String. How do I convert it into a String array or an Array.
If I have a try/catch block with returns inside it, will the finally block be called?
For example:
try {
something();
return success;
}
catch (Exception e) {
return failure;
}
finally {
System.out.println "i don't know if this will get printed out."
}
I know I can just type this in an see what happens (which is what I'm about to do, actually) but when I googled for answers nothing came up, so I figured I'd throw this up as a question.
Thanks!
i have the following class:
public class NewGameContract {
public boolean HomeNewGame = false;
public boolean AwayNewGame = false;
public boolean GameContract(){
if (HomeNewGame && AwayNewGame){
return true;
} else {
return false;
}
}
}
when i try to use it like so:
if (networkConnection){
connect4GameModel.newGameContract.HomeNewGame = true;
boolean status = connect4GameModel.newGameContract.GameContract();
switch (status){
case true:
break;
case false:
break;
}
return;
}
i am getting the error: incompatible types found: boolean required: int on the following switch (status) code.
what am i doing wrong please?
I'm trying to zip a large number of pdf files (stored as BLOBs in the DB) and then return the zip as an attachment to the user.
What's the best way to do this without running into memory issues?
Another note: I actually need to merge some PDFs prior to adding them to the ZipOutputStream. Therefore, a couple PDFs will need to be stored in memory at a time.
I assume it would be best to then store them as temporary files on the server before zipping them all?
hi everyone,
I work on inheritence with GUI (graphical user interfaces)
let me explain for example I made super class which is vehicle and the subclass is car, so the code to make inheritence will be
public class Car extends Vehicle
then I want to build the class Car as JFrame like
public class Car JFrame implements ActionListener {
so the problem is that I couldn't put both codes in the same class, and I need to do that.
anyone help me. thanks in advance
I wish that the question would be clear
I want to create a program for generating the series for the given base-n. ,
for example if my input is 2,then series shuould be, 00,01,10,11,etc.,(binary)
if my input is 10,then series shuould be,1,2,3,4,5,etc.,(decimal)
is there any general mechanism to find these numbers so that I can program for base-n.,
I want to get a list of dates between start and end date.If i give the start and end date means, it give the result as the list of all dates including the start and end date.
Thanks in advance.
I have a HashSet containing all groups I've retrieved from my database. I've been asked to filter this result by removing two specific groups. It seems trivial but I can't seem to come up with a solid solution for storing the specific groups I want to filter out.
My idea is to just create an array containing references to the two groups I need to filter out. I can then filter out my search query with whatever is in the array. My concern is that in the future they may ask to filter out more groups and maybe an array may not be a good idea.
//Creates the array containing groups to filter out
String[] hiddenGroups = {"group1","group2"};
//retrieves all groups
Set<String>allGroups = new HashSet<String>();
allGroups.addAll(authorityService.getAllAuthorities(AuthorityType.GROUP);
List<String>results = new ArrayList<String>();
//filters out specified groups
for (String group : allGroups) {
boolean isHidden = false;
for (String hiddenGroup : hiddenGroups) {
if (hiddenGroup.equalsIgnorecase(group)) {
isHidden = true;
}
}
if (!isHidden){
results.add(group);
}
}
Consider this line:
if (object.getAttribute("someAttr").equals("true")) { // ....
Obviously this line is a potential bug, the attribute might be null and we will get a NullPointerException. So we need to refactor it to one of two choices:
First option:
if ("true".equals(object.getAttribute("someAttr"))) { // ....
Second option:
String attr = object.getAttribute("someAttr");
if (attr != null) {
if (attr.equals("true")) { // ....
The first option is awkward to read but more concise, while the second one is clear in intent, but verbose.
Which option do you prefer in terms of readability?
I am trying to write a regular expression for somethin like
s1 = I am at Boston at Dowtown
s2 = I am at Miami
I am interested in the words after at eg: Boston, Downtown, Miami
I have not been successful in creating a regex for that. Somethin like
> .*? (at \w+)+.*
gives just Boston in s1 (Downtown is missed). it just matches the first "at" Any suggestions
Hi there,
I’m working with Net beans IDE and I want to add a piece of code to my project in a way that the source code won’t be visible to the user who is running the project, I decided to export that piece of code as a jar file in eclipse and then add that jar file to the project. But unfortunately net beans does not let me import that. It says which it is expecting a . Or when I insert. It goes in to that class and I cannot import that jar file into the project by import instruction. Is there a command in net beans which creates and object from jar file and then makes access to the functions and classes of the jar file? Would you please give the format of that instruction? If you know a better way to do this task I would be so happy if you share it with me
Hi,
I am using simple date format to allow users to specify which time zone they are sending data in:
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss,z");
This works fine:
e.g.
df.parse("2009-05-16 11:07:41,GMT");
However, if someone is always sending time in London time (i.e. taking into account daylight savings), what would be the approriate time zone String to add?
e.g. this doesnt work:
df.parse("2009-05-16 11:07:41,Europe/London");
Thanks.
Hi guys,
I have a Spring application that I believe has some bottlenecks, so I'd like to run it with a profiler to measure what functions take how much time. Any recommendations to how I should do that?
I'm running STS, the project is a maven project, and I'm running Spring 3.0.1
Cheers
Nik
I have a JPanel that I am adding JLabel's to. I then want to remove all the JLabels and add some new ones.
So I do the following:
panel.removeAll();panel.repaint();
panel.add(new JLabel("Add something new");
panel.revalidate();
This works fine. My problem arises when I start a new thread after this like:
panel.removeAll();panel.repaint();
(1)panel.add(new JLabel("Add something new");
panel.revalidate();
//new thread to start - this thread creates new JLabels that should appear under (1)
firstProducer.start();
try {
firstProducer.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Then the output from the original JLabels is still visible. I have read that the revalidate process is a long running task and hence the firstProducer thread is getting started while
the revalidation is going on and a conflict is arising. What is the best way to deal with this?
I know that when creating buttons, like next and previous, that the code can be somewhat long to get those buttons to function.
My professor gave us this example to create the next button:
private void jbtnNext_Click() {
JOptionPane.showMessageDialog(null, "Next" ,"Button Pressed",
JOptionPane.INFORMATION_MESSAGE);
try {
if (rset.next()) {
fillTextFields(false);
}else{
//Display result in a dialog box
JOptionPane.showMessageDialog(null, "Not found");
}
}
catch (SQLException ex) {
ex.printStackTrace();
}
}
Though, I do not really understand how that short and simple if statement is what makes the next button function. I see that the fillTextFields(false) uses a boolean value and that you need to initialize that boolean value in the beginning of the code I believe. I had put private fillTextFields boolean = false; but this does not seem to be right...
I'm just hoping someone could explain it better. Thanks :)