Topic
1 reply Latest Post - ‏2009-09-26T00:26:52Z by SystemAdmin
SystemAdmin
SystemAdmin
9 Posts
ACCEPTED ANSWER

Pinned topic Java statements to send XML to NameHunter server?

‏2009-01-21T20:55:39Z |
The IBM Global Name Management disks included a NameHunter (NH) server executable (nhServer.exe) and a sample program, nhsGui.exe, that provides an interface for sending name queries to the NH server. I am attempting to write a Java program that sends name queries to the NH server in a similar way, but the Java statements I am currently using to send XML data are not functioning. One way of describing the problem is to contrast the debug output statements that are logged by the NH server when (1) a name query is executed using nhsGui.exe, versus (2) the debut output logged when my Java program is executed.

With the nhsGui.exe program, after the program is started and the “Connect To Server” button is clicked, debug output is generated by the NH server that indicates that a connection was made. Then, when a name query is submitted, debug output is generated that lists the XML data that was transmitted to the NH server.

In contrast, with the Java program I have written, the statement to establish a connection with the NH server does cause a debug output message to be generated (indicating that a connection was made), but the statements to transmit XML to the NH server do not result in debug output as expected.

Here are the statements of the Java program that attempt to send XML data to the NH server. What corrections are needed?

public static void main(String[] args) {
Socket nhs = null;
try {
nhs = new Socket(“localhost”, 4566);
InputStream in = nhs.getInputStream();
OutputStream out = nhs.getOutputStream();
String requestStr
“<NHServerMessage protocol_version=\”1.0\”>” +
“<BASIC_REQUEST_INFO request_type=\”S\” request_id=\”-1\”/>” +
“<DATA_LIST_NAME value=\”names\”/>” +
“<SEARCH_NAME SN=\”Clark\” GN=\”Robert\”/>” +
“</NHServerMessage>”;
byte[] requestBuf = requestStr.getBytes();
out.write(requestBuf);
Updated on 2009-09-26T00:26:52Z at 2009-09-26T00:26:52Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    9 Posts
    ACCEPTED ANSWER

    Re: Java statements to send XML to NameHunter server?

    ‏2009-09-26T00:26:52Z  in response to SystemAdmin
    All you are missing is the terminating null.

    out.write(0);

    I'm told by IBM support to not send XML messages to the NameHunter communcations manager. You should use the NameWorks "Scoring" API instead.

    Hope that helps.