Can i use JAXM to run a UDDI Query against say IBM's UDDI Registry?
Created Jan 20, 2002
Davanum Srinivas Here's a stand-alone JAXM Client that can connect to IBM's UDDI Registry found at https://www-3.ibm.com/services/uddi/protect/registry.html.
import javax.xml.soap.*;
import javax.xml.messaging.*;
import java.util.*;
import java.io.*;
public class UddiPing {
public static void main(String[] args) {
try {
if (args.length != 1) {
System.err.println("Usage: UddiPing business-name");
System.exit(1);
}
// Create the connection and the message factory.
SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection connection = scf.createConnection();
MessageFactory msgFactory = MessageFactory.newInstance();
// Create a message
SOAPMessage msg = msgFactory.createMessage();
// Create an envelope in the message
SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
// Get hold of the the body
SOAPBody body = envelope.getBody();
body.addChildElement(envelope.createName("find_business", "",
"urn:uddi-org:api"))
.addAttribute(envelope.createName("generic"),
"1.0")
.addAttribute(envelope.createName("maxRows"),
"100")
.addChildElement("name").addTextNode(args[0]);
URLEndpoint endpoint
= new URLEndpoint("http://www-3.ibm.com/services/uddi/testregistry/inquiryapi");
msg.saveChanges();
SOAPMessage reply = connection.call(msg, endpoint);
System.out.println("Received reply from: "+endpoint);
reply.writeTo(System.out);
connection.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}