You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jim Talbut <jt...@spudsoft.co.uk> on 2010/09/25 08:23:48 UTC
More on autoRewriteSoapAddress
Folks,
I'm back again, working on getting autoRewriteSoapAddress settable from
Spring...
I've modified jaxws\EndpointImpl.java to put all of the Endpoint
properties into the EndpointInfo, but:
1. I also had to modify the WSDLQueryHandler because the type of the
property is still String, not boolean.
2. I've seen that there is some precedent for handling the problem a
different way.
The publishedEndpointUrl is set as an attribute on the EndpointImpl
(copied to a field in the EndpointImpl), and, if it is set, it is copied
to the properties of the endpointInfo.
My changes work without failing any existing tests, but I haven't
written a specific junit for it yet.
The change (along with a bunch of testing spew) is simply:
Index:
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
===================================================================
---
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
(revision 995338)
+++
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
(working copy)
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.jaxws;
+import java.io.PrintStream;
import java.security.AccessController;
import java.util.ArrayList;
import java.util.Arrays;
@@ -27,6 +28,7 @@
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.concurrent.Executor;
import java.util.logging.Logger;
@@ -321,6 +323,23 @@
// TODO is there a good place to put this
key-string as a constant?
endpointInfo.setProperty("publishedEndpointUrl",
publishedEndpointUrl);
}
+
+ if (null != properties) {
+ System.err.println("\n\ndoPublish called with " +
properties.size() + " entries.\n\n");
+ for (Entry<String, Object> entry :
properties.entrySet()) {
+ PrintStream err = System.err;
+ err.print("Setting property " + entry.getKey());
+ if (entry.getValue() == null) {
+ err.println(" to null");
+ } else {
+ Object val = entry.getValue();
+ err.println(" to " + val.toString() + " of
type " + val.getClass().getName());
+ }
+ endpointInfo.setProperty(entry.getKey(),
entry.getValue());
+ }
+ System.err.println("\n\n");
+ }
+
this.address = endpointInfo.getAddress();
}
serv.start();
Property changes on: rt\management-web
___________________________________________________________________
Added: svn:ignore
+ target
Index:
rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
===================================================================
---
rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(revision 995338)
+++
rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
(working copy)
@@ -56,6 +56,7 @@
import org.apache.cxf.helpers.CastUtils;
import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.message.MessageUtils;
import org.apache.cxf.service.model.EndpointInfo;
import org.apache.cxf.staxutils.StaxUtils;
import org.apache.cxf.transports.http.StemMatchingQueryHandler;
@@ -281,10 +282,11 @@
el.setAttribute("location", base + "?wsdl=" +
sl.replace(" ", "%20"));
}
}
+
+ Object rewriteSoapAddress =
ei.getProperty("autoRewriteSoapAddress");
+ System.err.println("rewriteSoapAddress == " + rewriteSoapAddress);
- Boolean rewriteSoapAddress =
ei.getProperty("autoRewriteSoapAddress", Boolean.class);
-
- if (rewriteSoapAddress != null &&
rewriteSoapAddress.booleanValue()) {
+ if (rewriteSoapAddress != null &&
MessageUtils.isTrue(rewriteSoapAddress)) {
List<Element> serviceList =
DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
"http://schemas.xmlsoap.org/wsdl/",
"service");
Jim
Re: More on autoRewriteSoapAddress
Posted by Jim Talbut <jt...@spudsoft.co.uk>.
Dan,
I've finally found the time to add a couple of tests and attached them
to the jira.
https://issues.apache.org/jira/browse/CXF-2770
Thanks in advance for finding the time to take a look and letting me
know what you think.
If nothing else the file (and class) names are way too long for anything
other than a test!
Jim
On 27/09/2010 21:37, Daniel Kulp wrote:
>
> This looks fine by me. :-) If you can add a test (system test is fine) and
> attach to a jira, I'd be happy to re-look at it.
>
> Dan
>
>
> On Saturday 25 September 2010 2:23:48 am Jim Talbut wrote:
>> Folks,
>>
>> I'm back again, working on getting autoRewriteSoapAddress settable from
>> Spring...
>>
>> I've modified jaxws\EndpointImpl.java to put all of the Endpoint
>> properties into the EndpointInfo, but:
>> 1. I also had to modify the WSDLQueryHandler because the type of the
>> property is still String, not boolean.
>> 2. I've seen that there is some precedent for handling the problem a
>> different way.
>> The publishedEndpointUrl is set as an attribute on the EndpointImpl
>> (copied to a field in the EndpointImpl), and, if it is set, it is copied
>> to the properties of the endpointInfo.
>>
>> My changes work without failing any existing tests, but I haven't
>> written a specific junit for it yet.
>>
>> The change (along with a bunch of testing spew) is simply:
>>
>> Index:
>> rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
>> ===================================================================
>> ---
>> rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
>> (revision 995338)
>> +++
>> rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
>> (working copy)
>> @@ -18,6 +18,7 @@
>> */
>> package org.apache.cxf.jaxws;
>>
>> +import java.io.PrintStream;
>> import java.security.AccessController;
>> import java.util.ArrayList;
>> import java.util.Arrays;
>> @@ -27,6 +28,7 @@
>> import java.util.List;
>> import java.util.ListIterator;
>> import java.util.Map;
>> +import java.util.Map.Entry;
>> import java.util.concurrent.Executor;
>> import java.util.logging.Logger;
>>
>> @@ -321,6 +323,23 @@
>> // TODO is there a good place to put this
>> key-string as a constant?
>> endpointInfo.setProperty("publishedEndpointUrl",
>> publishedEndpointUrl);
>> }
>> +
>> + if (null != properties) {
>> + System.err.println("\n\ndoPublish called with " +
>> properties.size() + " entries.\n\n");
>> + for (Entry<String, Object> entry :
>> properties.entrySet()) {
>> + PrintStream err = System.err;
>> + err.print("Setting property " + entry.getKey());
>> + if (entry.getValue() == null) {
>> + err.println(" to null");
>> + } else {
>> + Object val = entry.getValue();
>> + err.println(" to " + val.toString() + " of
>> type " + val.getClass().getName());
>> + }
>> + endpointInfo.setProperty(entry.getKey(),
>> entry.getValue());
>> + }
>> + System.err.println("\n\n");
>> + }
>> +
>> this.address = endpointInfo.getAddress();
>> }
>> serv.start();
>>
>> Property changes on: rt\management-web
>> ___________________________________________________________________
>> Added: svn:ignore
>> + target
>>
>>
>> Index:
>> rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
>> ===================================================================
>> ---
>> rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
>> (revision 995338)
>> +++
>> rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
>> (working copy)
>> @@ -56,6 +56,7 @@
>> import org.apache.cxf.helpers.CastUtils;
>> import org.apache.cxf.helpers.DOMUtils;
>> import org.apache.cxf.helpers.XMLUtils;
>> +import org.apache.cxf.message.MessageUtils;
>> import org.apache.cxf.service.model.EndpointInfo;
>> import org.apache.cxf.staxutils.StaxUtils;
>> import org.apache.cxf.transports.http.StemMatchingQueryHandler;
>> @@ -281,10 +282,11 @@
>> el.setAttribute("location", base + "?wsdl=" +
>> sl.replace(" ", "%20"));
>> }
>> }
>> +
>> + Object rewriteSoapAddress =
>> ei.getProperty("autoRewriteSoapAddress");
>> + System.err.println("rewriteSoapAddress == " + rewriteSoapAddress);
>>
>> - Boolean rewriteSoapAddress =
>> ei.getProperty("autoRewriteSoapAddress", Boolean.class);
>> -
>> - if (rewriteSoapAddress != null&&
>> rewriteSoapAddress.booleanValue()) {
>> + if (rewriteSoapAddress != null&&
>> MessageUtils.isTrue(rewriteSoapAddress)) {
>> List<Element> serviceList =
>> DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
>>
>> "http://schemas.xmlsoap.org/wsdl/",
>> "service");
>>
>>
>> Jim
Re: More on autoRewriteSoapAddress
Posted by Daniel Kulp <dk...@apache.org>.
This looks fine by me. :-) If you can add a test (system test is fine) and
attach to a jira, I'd be happy to re-look at it.
Dan
On Saturday 25 September 2010 2:23:48 am Jim Talbut wrote:
> Folks,
>
> I'm back again, working on getting autoRewriteSoapAddress settable from
> Spring...
>
> I've modified jaxws\EndpointImpl.java to put all of the Endpoint
> properties into the EndpointInfo, but:
> 1. I also had to modify the WSDLQueryHandler because the type of the
> property is still String, not boolean.
> 2. I've seen that there is some precedent for handling the problem a
> different way.
> The publishedEndpointUrl is set as an attribute on the EndpointImpl
> (copied to a field in the EndpointImpl), and, if it is set, it is copied
> to the properties of the endpointInfo.
>
> My changes work without failing any existing tests, but I haven't
> written a specific junit for it yet.
>
> The change (along with a bunch of testing spew) is simply:
>
> Index:
> rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
> ===================================================================
> ---
> rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
> (revision 995338)
> +++
> rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/EndpointImpl.java
> (working copy)
> @@ -18,6 +18,7 @@
> */
> package org.apache.cxf.jaxws;
>
> +import java.io.PrintStream;
> import java.security.AccessController;
> import java.util.ArrayList;
> import java.util.Arrays;
> @@ -27,6 +28,7 @@
> import java.util.List;
> import java.util.ListIterator;
> import java.util.Map;
> +import java.util.Map.Entry;
> import java.util.concurrent.Executor;
> import java.util.logging.Logger;
>
> @@ -321,6 +323,23 @@
> // TODO is there a good place to put this
> key-string as a constant?
> endpointInfo.setProperty("publishedEndpointUrl",
> publishedEndpointUrl);
> }
> +
> + if (null != properties) {
> + System.err.println("\n\ndoPublish called with " +
> properties.size() + " entries.\n\n");
> + for (Entry<String, Object> entry :
> properties.entrySet()) {
> + PrintStream err = System.err;
> + err.print("Setting property " + entry.getKey());
> + if (entry.getValue() == null) {
> + err.println(" to null");
> + } else {
> + Object val = entry.getValue();
> + err.println(" to " + val.toString() + " of
> type " + val.getClass().getName());
> + }
> + endpointInfo.setProperty(entry.getKey(),
> entry.getValue());
> + }
> + System.err.println("\n\n");
> + }
> +
> this.address = endpointInfo.getAddress();
> }
> serv.start();
>
> Property changes on: rt\management-web
> ___________________________________________________________________
> Added: svn:ignore
> + target
>
>
> Index:
> rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
> ===================================================================
> ---
> rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
> (revision 995338)
> +++
> rt/core/src/main/java/org/apache/cxf/transport/http/WSDLQueryHandler.java
> (working copy)
> @@ -56,6 +56,7 @@
> import org.apache.cxf.helpers.CastUtils;
> import org.apache.cxf.helpers.DOMUtils;
> import org.apache.cxf.helpers.XMLUtils;
> +import org.apache.cxf.message.MessageUtils;
> import org.apache.cxf.service.model.EndpointInfo;
> import org.apache.cxf.staxutils.StaxUtils;
> import org.apache.cxf.transports.http.StemMatchingQueryHandler;
> @@ -281,10 +282,11 @@
> el.setAttribute("location", base + "?wsdl=" +
> sl.replace(" ", "%20"));
> }
> }
> +
> + Object rewriteSoapAddress =
> ei.getProperty("autoRewriteSoapAddress");
> + System.err.println("rewriteSoapAddress == " + rewriteSoapAddress);
>
> - Boolean rewriteSoapAddress =
> ei.getProperty("autoRewriteSoapAddress", Boolean.class);
> -
> - if (rewriteSoapAddress != null &&
> rewriteSoapAddress.booleanValue()) {
> + if (rewriteSoapAddress != null &&
> MessageUtils.isTrue(rewriteSoapAddress)) {
> List<Element> serviceList =
> DOMUtils.findAllElementsByTagNameNS(doc.getDocumentElement(),
>
> "http://schemas.xmlsoap.org/wsdl/",
> "service");
>
>
> Jim
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog