Loading ...
Sorry, an error occurred while loading the content.

Re: Post simple soap messages

Expand Messages
  • fun_guidebook <fun_guidebook@yahoo.com>
    The simplest way is to use a GET. You can set up a URL to your service, like http://ComputerName/virtualdirectory/ServiceName?Paramter=value But for a POST, I
    Message 1 of 2 , Jan 21, 2003
    • 0 Attachment
      The simplest way is to use a GET.

      You can set up a URL to your service, like
      http://ComputerName/virtualdirectory/ServiceName?Paramter=value


      But for a POST, I use:

      h = (HttpURLConnection) url.openConnection();
      h.setRequestMethod( "POST");
      h.setDoOutput(true);
      h.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
      h.setRequestProperty("Content-Length", "" + postString.length());
      h.setRequestProperty("SOAPAction", "yournamespace/" + Method);

      try
      {
      // send the soap request
      PrintWriter out = new PrintWriter(h.getOutputStream());
      out.println(postString);
      out.close();

      // get an input stream; read and parse the XML result
      responseCode = h.getResponseCode();
      if (responseCode == 200)
      in = h.getInputStream();
      }
      catch (Exception ex)
      {
      ex.printStackTrace();
      }

      if (in != null)
      {
      // process response
      }


      Steve

      Fun in North Central Florida
      http://www.lesliedunn.com/101/fun.html


      --- In soapbuilders@yahoogroups.com, "entitytype <entitytype@y...>"
      <entitytype@y...> wrote:
      > Hi :
      > I want to post simple soap messages from client to server using
      java
      > Can anyone please show where to find examples. My server is a
      > servlet which is going to parse the soap message and create
      responses.
      >
      > Thanks
      >
      > _ Mathu
    Your message has been successfully submitted and would be delivered to recipients shortly.