1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Migrating From Apache SOAP v2.</title>
</head>
<body bgcolor="#FFFFFF">
<h2 align="center">Migrating From Apache SOAP v2.1 to Apache SOAP
v2.2</h2>
<p>This document explains the changes you may have to make to
migrate from Apache SOAP v2.1 to Apache SOAP v2.2.</p>
<h3>XMLParserLiaison replaced with JAXP</h3>
<p>We previously used a home grown solution for achieving XML
parser independence. However, given the release of a Java
standard mechanism for doing that, we have now switched over to
using JAXP. What does this mean for you? It means that if you had
any code that used XMLParserLiaison then you will have to change
that code. Luckily, the changes are simple: the <a
href="http://xml.apache.org/websrc/cvsweb.cgi/xml-soap/java/samples/messaging/SendMessage.java.diff?r1=1.2&r2=1.3&diff_format=h"
target="_top">differences between v1.2 and v1.3 of the "messaging"
sample</a>, shows you exactly what to do!</p>
<p>Sometimes this change may show up even if you don't have any
code that directly uses XMLParserLiaison. If you are seeing that,
please recompile your code with the v2.2 jar in your classpath
and the problem should go away.</p>
<h3>HTTP session maintenance</h3>
<p>We new support maintaining HTTP sessions. The "addressbook2"
sample shows an example of how to use it. </p>
<p>The session support is on by default. If you were interacting
with any "session" scoped HTTP services with a certain
behavior, you may now see a different behavior as the code now
correctly maintains HTTP sessions. If you want to turn off HTTP
session support, you need to create your own SOAPHTTPConnection
object, set the sesssion maintenance property to false and set
the transport propert of the call to that SOAPHTTPConnection:</p>
<blockquote>
<pre>Call call = new Call ();
SOAPHTTPConnection shc = new SOAPHTTPConnection ();
shc.setMaintainSession (false);
call.setSOAPTransport (shc);
// now make calls with "call"</pre>
</blockquote>
<p>Having session support on the client side finally means that
Apache SOAP can be used to implement stateful Web services
without having user intervention to manage that.</p>
<h3>Getting at "environmental" information for RPC
style services</h3>
<p>A common question with Apache SOAP v2.1 was how an RPC service
author could access "environmental" information such as
the HTTPSession object or HTTP headers. The v2.1 answer was that
you had to <a href="provider.html">write a custom provider</a> to
do that. As of v2.2, there's a better, simpler way.</p>
<p>The RPCJavaProvider (the provider that runs all RPC style
services) now has the following behavior: when searching for the
method in the target class to call to process the service
request, if a method with a matching signature is not found, then
a second search is done. The second search looks for a method
with an additional (first) argument of type org.apache.soap.rpc.SOAPContext
(please see the API docs for the details of that class). If
found, then an instance of SOAPContext is passed to the service
handler class. </p>
<p>Having access to the incoming SOAPContext gives you a lot of
freedom: you can access the following via the "getProperty"
method:</p>
<ul>
<li>HTTPServlet object using the key org.apache.soap.Constants.BAG_HTTPSERVLET
</li>
<li>HTTPSession object using the key org.apache.soap.Constants.BAG_HTTPSESSION
</li>
<li>HTTPServletRequest object using the key org.apache.soap.Constants.BAG_HTTPSERVLETREQUEST</li>
<li>HTTPServletResponse object using the key org.apache.soap.Constants.BAG_HTTPSERVLETRESPONSE</li>
</ul>
<p>If the original SOAP request was in the SOAP Attachments form,
then you can get at unreferenced MIME parts using the "getBodyPart"
methods.</p>
<p><strong>NOTE</strong>: <em>SOAPContext is a read-only object:
do not use any of the set<FOO> methods!</em></p>
<p><strong>NOTE</strong>: <em>Using this feature makes your
service implementation class bound to Apache SOAP. Use it with
care!</em></p>
<h3>Other migration problems</h3>
<p>If you are running into other migration issues please check
the FAQs at <a href="http://xml.apache.org/soap/faq">http://xml.apache.org/soap/faq</a>.</p>
<p> </p>
</body>
</html>
|