import XMLHttp; import oracle.xml.parser.v2.XMLDocument; import java.net.URL; public class TestXmlHttp { // Test posting a new News Story to our Web Site that accepts stories in XML public static void main(String args[]) throws Exception { // Make sure we can see through the firewall XMLHttp.setProxy("yourproxyserver.you.com","80"); // Here's the XML 'datagram' to post a new news story in a String String xmlDoc = "<moreovernews>"+ " <article>"+ " <url> http://technet.oracle.com/tech/xml </url>"+ " <headline_text> Posting from Java </headline_text>"+ " <source> you </source>"+ " </article>"+ "</moreovernews>"; // Parse XML message in a string, No external references so null BaseURL ok XMLDocument docToPost = XMLHelper.parse(xmlDoc,null); // Here's the URL of the service that accepts posted XML news stories String url = "http://ws5.olab.com/xsql/demo/insertxml/insertnewsstory.xsql"; // Construct the target service URL from the string above URL target = new URL(url); // Post the XML message... XMLDocument response = XMLHttp.doPost(docToPost,target); // Print the response. response.print(System.out); } } |