I have successfully posted to Axis, using the following snippet:

  StringBuffer buf;
  // populate buf here...
  URL url = new URL(location);
  HttpURLConnection con = (HttpURLConnection) url.openConnection();
  con.setRequestMethod("POST");
  con.setDoOutput(true);
  con.setRequestProperty("Content-type","text/xml");
  con.setRequestProperty("Content-Length", String.valueOf(buf.length()));
  con.setRequestProperty("Accept","application/soap+xml, text/*");
  con.setRequestProperty("SOAPAction","");
  con.connect();

  PrintWriter out = new PrintWriter(new
OutputStreamWriter(con.getOutputStream()));
  out.write(buf.toString());
  out.flush();
  out.close();
  BufferedReader results = new BufferedReader(new
InputStreamReader(con.getInputStream()));
  // read from results and log or print to stdout

Russ

-----Original Message-----
From: Deppen, Jeff [mailto:[EMAIL PROTECTED]
Sent: Monday, June 14, 2004 4:13 PM
To: '[EMAIL PROTECTED]'
Subject: Posting XML to AxisServlet


Help!

I'm trying to write an automated testing tool that will post Soap messages
to the AxisServlet.   When I attempt to post the XML directly to the
AxisServlet, I receive an AxisFault with a faultString: "no SOAPAction
header!"

The soap call works fine when I use the AXIS client side libraries.  It's
when I try to post XML that it goes haywire.  (I should note that I copied
the XML from the server log when I ran the client-side library test - so it
should be the exact XML the axis servlet is processing.)

So, can anyone:
1. tell me if posting soap/xml requests directly to the AxisServlet should
work
2. is the XML that shoes up in the AxisServlet (when using the axis client
side libraries) the EXACT XML that the servlet receives?
3. does anyone have any recommendations for an open source web services
tester?  

thanks!
jeff

Reply via email to