View Full Version : Hi everyone!
oKloster
01-27-2006, 02:23
I've been reading these pages for a while and in most cases I've found answers to what I'm struggling with.:confused: Great! and thanks to all of you for that. I'm now feeling kind of experienced in quite a few areas, so I might be able to contribute myself also. :D
mcarlson
01-27-2006, 07:53
oKloster,
Congrats on the first post! Jump on in an post a reply to another member's question or add an observation of your own in one of those areas that you now have experience.
BTW, you can use the "highlight" tag in the form [highlight=lang]some code[/hightlight] to highlight code written in a bunch of languages including Java, XML, C, SQL, etc.
Mark
mcarlson
01-27-2006, 07:57
Example of highlighted java code.
/*
* This class has been automatically generated by the webMethods Developer(TM).
*
*/
import java.io.*;
import java.util.Vector;
import com.wm.util.Table;
import com.wm.data.*;
import com.wm.util.coder.IDataCodable;
import com.wm.app.b2b.util.GenUtil;
import com.wm.app.b2b.client.Context;
import com.wm.app.b2b.client.ServiceException;
public class ping{
public static void main(String[] args)
{
// Connect to server - edit for alternate server
String server = "localhost:5555";
Context context = new Context();
// To use SSL:
//
// context.setSecure(true);
// Optionally send authentication certificates
//
// String cert = "c:\\myCerts\\cert.der";
// String privKey = "c:\\myCerts\\privkey.der";
// String cacert = "c:\\myCerts\\cacert.der";
// context.setSSLCertificates(cert, privKey, cacert);
// Set username and password for protected services
String username = null;
String password = null;
try {
context.connect(server, username, password);
} catch (ServiceException e) {
System.out.println("\n\tCannot connect to server \""+server+"\"");
System.exit(0);
}
try
{
// *** Invoke the Service and Disconnect ***
invoke(context);
context.disconnect();
System.out.println("\n********* Successful invoke **********");
// *** Access the Results ***
System.out.println("\n************* Inputs *****************");
System.out.println("This Service has no inputs.");
System.out.println("\n************* Outputs *****************");
System.out.println("This Service has no outputs.");
} catch (IOException e) {
System.err.println(e);
} catch (ServiceException e) {
System.err.println(e);
}
System.exit(0);
}
public static String getString(String name)
throws IOException, ServiceException
{
System.out.print(name + " =");
return (new BufferedReader(new InputStreamReader(System.in))).readLine();
}
public static String[] getStringArray(String name)
throws IOException, ServiceException
{
int size;
String tmp;
System.out.print(name + ": how large? ");
tmp = (new BufferedReader(new InputStreamReader(System.in))).readLine();
size = Integer.parseInt(tmp);
String[] strArray = new String[size];
for(int i = 0; i < size; i++){
strArray[i] = getString(name +"[" + i + "]");
}
return strArray;
}
public static String[][] getStringTable(String name)
throws IOException, ServiceException
{
int rows = 0, cols = 0;
String tmp;
System.out.print(name + ": how many rows? ");
tmp = (new BufferedReader(new InputStreamReader(System.in))).readLine();
rows = Integer.parseInt(tmp);
System.out.print(name + ": how many cols? ");
tmp = (new BufferedReader(new InputStreamReader(System.in))).readLine();
cols = Integer.parseInt(tmp);
String[][] strTable = new String[rows][cols];
for(int i = 0; i < rows; i++){
for(int j = 0; j < cols; j++){
strTable[i][j] = getString(name+"["+i+"]["+j+"]");
}
}
return strTable;
}
public static void invoke(
Context context)
throws IOException, ServiceException
{
IData out = context.invoke("wm.server", "ping", null);
return;
}
}