snichol 2002/10/18 06:36:00 Modified: java/docs changes.html java/src/org/apache/soap/rpc Call.java java/src/org/apache/soap/messaging Message.java Log: Submitted by: Pavel Ausianik <[EMAIL PROTECTED]> Here is a patch to enable clients to set up transport headers for sending envelope. Revision Changes Path 1.50 +1 -0 xml-soap/java/docs/changes.html Index: changes.html =================================================================== RCS file: /home/cvs/xml-soap/java/docs/changes.html,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- changes.html 16 Oct 2002 03:58:11 -0000 1.49 +++ changes.html 18 Oct 2002 13:36:00 -0000 1.50 @@ -94,6 +94,7 @@ exception for messaging calls in the Stateful EJB and Entity EJB providers rather than throwing a NPE.</li> <li>Add client support for HTTP redirects.</li> + <li>Allow additional transport headers to be specified by client.</li> </ul> </li> </ul> 1.18 +18 -2 xml-soap/java/src/org/apache/soap/rpc/Call.java Index: Call.java =================================================================== RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/rpc/Call.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Call.java 30 Aug 2002 21:39:00 -0000 1.17 +++ Call.java 18 Oct 2002 13:36:00 -0000 1.18 @@ -83,6 +83,7 @@ * @author Sanjiva Weerawarana ([EMAIL PROTECTED]) * @author Raj Yellapragada ([EMAIL PROTECTED]) * @author Scott Nichol ([EMAIL PROTECTED]) + * @author Pavel Ausianik <[EMAIL PROTECTED]> */ public class Call extends RPCMessage { @@ -254,9 +255,24 @@ /** * Invoke this call at the specified URL. Valid only on the client side. + * + * @param url the URL to send the envelope to + * @param SOAPActionURI the SOAPAction header field value */ public Response invoke(URL url, String SOAPActionURI) throws SOAPException { + return invoke(url, SOAPActionURI, null); + } + + /** + * Invoke this call at the specified URL. Valid only on the client side. + * + * @param url the URL to send the envelope to + * @param SOAPActionURI the SOAPAction header field value + * @param headers any other header fields to go to as protocol headers + */ + public Response invoke(URL url, String SOAPActionURI, Hashtable headers) throws SOAPException + { if (SOAPActionURI == null) { SOAPActionURI = ""; @@ -282,7 +298,7 @@ ((SOAPHTTPConnection)st).setTimeout(to); // Post the call envelope. - st.send(url, SOAPActionURI, null, callEnv, smr, ctx); + st.send(url, SOAPActionURI, headers, callEnv, smr, ctx); // Get the response context. SOAPContext respCtx = st.getResponseSOAPContext(); @@ -333,7 +349,7 @@ { throw new SOAPException(Constants.FAULT_CODE_CLIENT, "Parsing error, response was:\n" +e.getMessage(), - e); + e); } catch (IOException e) { 1.11 +20 -1 xml-soap/java/src/org/apache/soap/messaging/Message.java Index: Message.java =================================================================== RCS file: /home/cvs/xml-soap/java/src/org/apache/soap/messaging/Message.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Message.java 17 May 2001 18:25:42 -0000 1.10 +++ Message.java 18 Oct 2002 13:36:00 -0000 1.11 @@ -84,6 +84,7 @@ * so that this API can get at the 'response' envelope. * * @author Sanjiva Weerawarana ([EMAIL PROTECTED]) + * @author Pavel Ausianik <[EMAIL PROTECTED]> */ public class Message { SOAPTransport st; @@ -114,13 +115,31 @@ */ public void send (URL url, String actionURI, Envelope env) throws SOAPException { + send(url, actionURI, env, null); + } + + /** + * 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 + * @param headers any parameters to be used as protocol headers + * + * @exception SOAPException if something goes wrong. + */ + public void send (URL url, String actionURI, Envelope env, Hashtable headers) + throws SOAPException { + // Construct default HTTP transport if not specified. if (st == null) { st = new SOAPHTTPConnection (); } // Send request. - st.send (url, actionURI, null, env, null, reqCtx); + st.send (url, actionURI, headers, env, null, reqCtx); } /**
-- To unsubscribe, e-mail: <mailto:soap-dev-unsubscribe@;xml.apache.org> For additional commands, e-mail: <mailto:soap-dev-help@;xml.apache.org>