Hello

I prepared short patch for the client side only - but didn't had possibility
to test it.

Pavel

> -----Original Message-----
> From: Scott Nichol [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, November 09, 2002 11:21 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Apache SOAP and request only Web Services.
> 
> 
> It is not a lot of code to change to support this on both the 
> client and
> the server, and for that matter, for both messaging and RPC.  However,
> no one working on Apache SOAP has chosen to do this with the limited
> time they spend on the project.
> 
> Scott Nichol
> 
> ----- Original Message -----
> From: "Ashutosh Arora" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Saturday, November 09, 2002 2:55 PM
> Subject: Re: Apache SOAP and request only Web Services.
> 
> 
> >
> > For client side is it possible to provide this support in 
> Apache SOAP.
> > Assuming I do not want to go for rpc invocation. I create my soap
> message
> > using Apache SOAP. I want to invoke a Web Service using the messge
> oriented
> > technique given in the Apache SOAP messaging sample.
> >
> > This Web Service is a SOAP/HTTP request only Web Service. 
> Based on my
> > understanding with existing Web Services implementations, a request
> only
> > SOAP/HTTP Web Service will respond back with HTTP STatus 
> code of "202
> > Accepted". If we can provide some support in
> > org.apache.soap.messaging.Message class, so that if it sees HTTP
> status
> > code of 202 accepted it will not try to create SOAPEnvelope. I think
> this
> > support will be very helpful for people using Apache SOAP 
> client-only
> API,
> > in consuming request only web services.
> >
> > Just a suggestion.
> > Thanks
> > -Ashutosh
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > |---------+----------------------------->
> > |         |           Scott Nichol      |
> > |         |           <snicholnews@scott|
> > |         |           nichol.com>       |
> > |         |                             |
> > |         |           11/07/2002 08:46  |
> > |         |           PM                |
> > |         |           Please respond to |
> > |         |           soap-dev          |
> > |         |                             |
> > |---------+----------------------------->
> >
> >-------------------------------------------------------------
> ----------
> --------------------------------------------------------------
> --------|
> >   |
> |
> >   |       To:       [EMAIL PROTECTED]
> |
> >   |       cc:
> |
> >   |       Subject:  Re: Apache SOAP and request only Web Services.
> |
> >   |
> |
> >   |
> |
> >
> >-------------------------------------------------------------
> ----------
> --------------------------------------------------------------
> --------|
> >
> >
> >
> > Apache SOAP does not currently implement something equivalent the
> > one-way ports specified in WSDL
> > (http://www.w3.org/TR/wsdl.html#_one-way).  I am not certain what
> > specification says how to implement this on HTTP.  Microsoft has the
> > server respond with an empty (no entity) HTTP response with 
> some magic
> > status like "216 Received" after the SOAP request is validated, but
> > before the service is actually executed.  I would like to 
> have this in
> > Apache SOAP, but have not yet had time to add it.
> >
> > The current Apache SOAP code (1) always executes the service before
> > transmitting an HTTP response and (2) always transmits a 
> SOAP envelope
> > as the HTTP entity.  The closest thing to one-way operations is any
> > service with a void return type.
> >
> > Scott Nichol
> >
> > ----- Original Message -----
> > From: "Ashutosh Arora" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, November 07, 2002 5:20 PM
> > Subject: Apache SOAP and request only Web Services.
> >
> >
> > > Hi,
> > >
> > > Is it possible to invoke request only Web Services using Apache
> SOAP?
> > I
> > > want to use SOAP/HTTP to invoke a request only Web 
> SErvice. Is there
> > any
> > > way I can leverage Apache SOAP to do that? Is there any 
> sample code
> > that I
> > > can refer to?
> > > Any help will be greatly appreciated.
> > >
> > > Thanks
> > > -Ashutosh
> > >
> > >
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 

Index: HTTPUtils.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/util/net/HTTPUtils.java,v
retrieving revision 1.36
diff -u -r1.36 HTTPUtils.java
--- HTTPUtils.java      12 Nov 2002 14:15:38 -0000      1.36
+++ HTTPUtils.java      16 Nov 2002 11:58:46 -0000
@@ -506,7 +506,7 @@
           int codeStart = -1;
           int codeEnd = -1;
           int stringStart = -1;
-    
+
           for (count = 0, b = bInStream.read(); b != '\n' && b != -1; b = 
bInStream.read()) {
               if (b != '\r') {
                  if (b == ' ') {
@@ -615,7 +615,14 @@
               return post(newURL, request, timeout, httpProxyHost, httpProxyPort,
                    outputBufferSize, tcpNoDelay, null, responseCopy, numRedirects);
           }
+      } else if (statusCode == HttpURLConnection.HTTP_ACCEPTED) {
+          // One way message support - no further processing necessary
+          bOutStream.close();
+          bInStream.close();
+          s.close();
+          return null;
       }
+
 
       // TODO: process differently depending on statusCode and respContentLength
       //       (TransportMessage does not even get statusCode)
Index: SOAPHTTPConnection.java
===================================================================
RCS file: 
/home/cvspublic/xml-soap/java/src/org/apache/soap/transport/http/SOAPHTTPConnection.java,v
retrieving revision 1.29
diff -u -r1.29 SOAPHTTPConnection.java
--- SOAPHTTPConnection.java     12 Nov 2002 14:15:38 -0000      1.29
+++ SOAPHTTPConnection.java     16 Nov 2002 12:00:39 -0000
@@ -2,7 +2,7 @@
  * The Apache Software License, Version 1.1
  *
  *
- * Copyright (c) 2000 The Apache Software Foundation.  All rights 
+ * Copyright (c) 2000 The Apache Software Foundation.  All rights
  * reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -10,7 +10,7 @@
  * are met:
  *
  * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
+ *    notice, this list of conditions and the following disclaimer.
  *
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in
@@ -18,7 +18,7 @@
  *    distribution.
  *
  * 3. The end-user documentation included with the redistribution,
- *    if any, must include the following acknowledgment:  
+ *    if any, must include the following acknowledgment:
  *       "This product includes software developed by the
  *        Apache Software Foundation (http://www.apache.org/)."
  *    Alternately, this acknowledgment may appear in the software itself,
@@ -26,7 +26,7 @@
  *
  * 4. The names "SOAP" and "Apache Software Foundation" must
  *    not be used to endorse or promote products derived from this
- *    software without prior written permission. For written 
+ *    software without prior written permission. For written
  *    permission, please contact [EMAIL PROTECTED]
  *
  * 5. Products derived from this software may not be called "Apache",
@@ -171,7 +171,7 @@
   public void setRequestCopy (StringBuffer requestCopy) {
     this.requestCopy = requestCopy;
   }
-  
+
   /**
    * Set buffer for capturing copy of the response.
    */
@@ -198,7 +198,7 @@
   public StringBuffer getResponseCopy () {
     return responseCopy;
   }
-  
+
   /**
    * Indicate whether to maintain HTTP sessions.
    */
@@ -347,13 +347,13 @@
         // if there is saved cookie headers, put them in to the request
         if (cookies2 != null) { // RFC 2965 header
           headers.put ("Cookie2", Cookie.buildCookieValue(sendTo, cookies2));
-        } 
+        }
         if (cookies != null) { // RFC 2109 header
           headers.put ("Cookie", Cookie.buildCookieValue(sendTo, cookies));
         }
       }
 
-      headers.put (Constants.HEADER_SOAP_ACTION, 
+      headers.put (Constants.HEADER_SOAP_ACTION,
                    (action != null) ? ('\"' + action + '\"') : "");
       if (userName != null) {
         // add the Authorization header for Basic authentication
@@ -376,6 +376,9 @@
                                    timeout, httpProxyHost, httpProxyPort,
                                    outputBufferSize, tcpNoDelay,
                                    requestCopy, responseCopy);
+        // Support one way messaging
+        if (response == null)
+            return;
       } catch (MessagingException me) {
         throw new IOException ("Failed to encode mime multipart: " + me);
       } catch (UnsupportedEncodingException uee) {
@@ -385,7 +388,7 @@
       if (maintainSession) {
         // look for Set-Cookie2 and Set-Cookie headers and save them.
         // Only update my state iff the header is there .. otherwise
-        // leave the current 
+        // leave the current
         // Note: Header is case-insensitive
         Hashtable responseHeaders = response.getHeaders();
         String hdr;
Index: Message.java
===================================================================
RCS file: /home/cvspublic/xml-soap/java/src/org/apache/soap/messaging/Message.java,v
retrieving revision 1.11
diff -u -r1.11 Message.java
--- Message.java        18 Oct 2002 13:36:00 -0000      1.11
+++ Message.java        16 Nov 2002 12:02:07 -0000
@@ -97,7 +97,7 @@
   public void setSOAPTransport (SOAPTransport st) {
     this.st = st;
   }
-   
+
   public SOAPTransport getSOAPTransport () {
     return st;
   }
@@ -106,7 +106,7 @@
    * Send an envelope to the given URL via the SOAPTransport that has
    * been configured for this instance (or SOAPHTTPConnection by default).
    * The envelope is sent exactly as-is.
-   * 
+   *
    * @param url the url to send to
    * @param actionURI the value of the SOAPAction header
    * @param env envelope to send
@@ -160,9 +160,13 @@
     }
     try {
       resCtx = st.getResponseSOAPContext ();
+      if (resCtx == null)
+          throw new SOAPException (Constants.FAULT_CODE_CLIENT,
+                                   "Invalid call. Service does not return a 
+response.");
+
       String payloadStr = Call.getEnvelopeString (st);
 
-      Document doc = 
+      Document doc =
           xdb.parse(new InputSource(new StringReader(payloadStr)));
 
       if (doc == null) {
@@ -176,8 +180,8 @@
       throw new SOAPException (Constants.FAULT_CODE_CLIENT, me.getMessage (),
                               me);
     } catch (SAXException ioe) {
-      throw new SOAPException (Constants.FAULT_CODE_CLIENT, 
-                               "Parsing error, response was:\n" + 
+      throw new SOAPException (Constants.FAULT_CODE_CLIENT,
+                               "Parsing error, response was:\n" +
                                ioe.getMessage(), ioe);
     } catch (IOException ioe) {
       throw new SOAPException (Constants.FAULT_CODE_CLIENT, ioe.getMessage (),

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to