You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Tong Wang <tw...@gmail.com> on 2009/06/15 16:20:24 UTC

[cxf] javax.xml.ws.Endpoint.publish(String address), the address should be escaped or not?

Hi,

I publish web services to Tomcat following the guide at
http://cwiki.apache.org/CXF20DOC/servlet-transport.html.
There is an example,

Endpoint.publish("/Greeter", new GreeterImpl());

I would like to know if the address contains invalid characters, does
it need to be escaped?

For example,
Endpoint.publish("/Greet er", new GreeterImpl());
or
Endpoint.publish("/Greet+er", new GreeterImpl());
or
Endpoint.publish("/Greet%20er", new GreeterImpl());

And in the WSDL, the service location should be
<soap:address location="http://localhost:9090/context/Greet er" />
or
<soap:address location="http://localhost:9090/context/Greet+er" />
or
<soap:address location="http://localhost:9090/context/Greet%20er" />

Any comment will be appreciated!

-tong

Re: [cxf] javax.xml.ws.Endpoint.publish(String address), the address should be escaped or not?

Posted by Daniel Kulp <dk...@apache.org>.

1 and 2 look correct to me.   3 looks to be a problem.   Probably log a JIRA 
(and a patch would be nice).

Dan


On Tue June 16 2009 12:18:53 am Tong Wang wrote:
> Thanks! I tried it and the observations are as follows.
>
> Please attention the scenario is servlet transport (Tomcat).
>
> 1. When we publish a service, a destination
> (org.apache.cxf.transport.servlet.ServletDestination) is registered
> with the address as a key.
> For example, Endpoint.publish("/Greet%20er", new GreeterImpl());
> The key will be "/Greet%20er".
>
> 2. The service location in the WSDL is the same as the address when we
> publish the service.
> For example, Endpoint.publish("/Greet%20er", new GreeterImpl());
> The service location in the WSDL will be <soap:address
> location="http://localhost:9090/context/Greet%20er" />
>
> 3. When we invoke the service, we will get the destination by the key,
> which is request.getPathInfo().
> For example, if we open url "http://localhost:9090/context/Greet%20er"
> The key will be "/Greet er". So we cannot get the correct destination
> with key "/Greet%20er".
>
>
> In my opinion, the address should be escaped, because the rfc2396 tells us:
>
> 2.4.2. When to Escape and Unescape
>
>   A URI is always in an "escaped" form, since escaping or unescaping a
>   completed URI might change its semantics.  Normally, the only time
>   escape encodings can safely be made is when the URI is being created
>   from its component parts; each component may have its own set of
>   characters that are reserved, so only the mechanism responsible for
>   generating or interpreting that component can determine whether or
>   not escaping a character will change its semantics. Likewise, a URI
>   must be separated into its components before the escaped characters
>   within those components can be safely decoded.
>
> Please correct me if anything wrong.
>
> -tong
>
> On Tue, Jun 16, 2009 at 4:25 AM, Daniel Kulp<dk...@apache.org> wrote:
> > Honestly, I have no idea.   Try it and let us know how it works out.  :-)
> >
> > Dan
> >
> > On Mon June 15 2009 10:20:24 am Tong Wang wrote:
> >> Hi,
> >>
> >> I publish web services to Tomcat following the guide at
> >> http://cwiki.apache.org/CXF20DOC/servlet-transport.html.
> >> There is an example,
> >>
> >> Endpoint.publish("/Greeter", new GreeterImpl());
> >>
> >> I would like to know if the address contains invalid characters, does
> >> it need to be escaped?
> >>
> >> For example,
> >> Endpoint.publish("/Greet er", new GreeterImpl());
> >> or
> >> Endpoint.publish("/Greet+er", new GreeterImpl());
> >> or
> >> Endpoint.publish("/Greet%20er", new GreeterImpl());
> >>
> >> And in the WSDL, the service location should be
> >> <soap:address location="http://localhost:9090/context/Greet er" />
> >> or
> >> <soap:address location="http://localhost:9090/context/Greet+er" />
> >> or
> >> <soap:address location="http://localhost:9090/context/Greet%20er" />
> >>
> >> Any comment will be appreciated!
> >>
> >> -tong
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: [cxf] javax.xml.ws.Endpoint.publish(String address), the address should be escaped or not?

Posted by Tong Wang <tw...@gmail.com>.
Thanks! I tried it and the observations are as follows.

Please attention the scenario is servlet transport (Tomcat).

1. When we publish a service, a destination
(org.apache.cxf.transport.servlet.ServletDestination) is registered
with the address as a key.
For example, Endpoint.publish("/Greet%20er", new GreeterImpl());
The key will be "/Greet%20er".

2. The service location in the WSDL is the same as the address when we
publish the service.
For example, Endpoint.publish("/Greet%20er", new GreeterImpl());
The service location in the WSDL will be <soap:address
location="http://localhost:9090/context/Greet%20er" />

3. When we invoke the service, we will get the destination by the key,
which is request.getPathInfo().
For example, if we open url "http://localhost:9090/context/Greet%20er"
The key will be "/Greet er". So we cannot get the correct destination
with key "/Greet%20er".


In my opinion, the address should be escaped, because the rfc2396 tells us:

2.4.2. When to Escape and Unescape

  A URI is always in an "escaped" form, since escaping or unescaping a
  completed URI might change its semantics.  Normally, the only time
  escape encodings can safely be made is when the URI is being created
  from its component parts; each component may have its own set of
  characters that are reserved, so only the mechanism responsible for
  generating or interpreting that component can determine whether or
  not escaping a character will change its semantics. Likewise, a URI
  must be separated into its components before the escaped characters
  within those components can be safely decoded.

Please correct me if anything wrong.

-tong

On Tue, Jun 16, 2009 at 4:25 AM, Daniel Kulp<dk...@apache.org> wrote:
>
> Honestly, I have no idea.   Try it and let us know how it works out.  :-)
>
> Dan
>
>
> On Mon June 15 2009 10:20:24 am Tong Wang wrote:
>> Hi,
>>
>> I publish web services to Tomcat following the guide at
>> http://cwiki.apache.org/CXF20DOC/servlet-transport.html.
>> There is an example,
>>
>> Endpoint.publish("/Greeter", new GreeterImpl());
>>
>> I would like to know if the address contains invalid characters, does
>> it need to be escaped?
>>
>> For example,
>> Endpoint.publish("/Greet er", new GreeterImpl());
>> or
>> Endpoint.publish("/Greet+er", new GreeterImpl());
>> or
>> Endpoint.publish("/Greet%20er", new GreeterImpl());
>>
>> And in the WSDL, the service location should be
>> <soap:address location="http://localhost:9090/context/Greet er" />
>> or
>> <soap:address location="http://localhost:9090/context/Greet+er" />
>> or
>> <soap:address location="http://localhost:9090/context/Greet%20er" />
>>
>> Any comment will be appreciated!
>>
>> -tong
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>

Re: [cxf] javax.xml.ws.Endpoint.publish(String address), the address should be escaped or not?

Posted by Daniel Kulp <dk...@apache.org>.
Honestly, I have no idea.   Try it and let us know how it works out.  :-)

Dan


On Mon June 15 2009 10:20:24 am Tong Wang wrote:
> Hi,
>
> I publish web services to Tomcat following the guide at
> http://cwiki.apache.org/CXF20DOC/servlet-transport.html.
> There is an example,
>
> Endpoint.publish("/Greeter", new GreeterImpl());
>
> I would like to know if the address contains invalid characters, does
> it need to be escaped?
>
> For example,
> Endpoint.publish("/Greet er", new GreeterImpl());
> or
> Endpoint.publish("/Greet+er", new GreeterImpl());
> or
> Endpoint.publish("/Greet%20er", new GreeterImpl());
>
> And in the WSDL, the service location should be
> <soap:address location="http://localhost:9090/context/Greet er" />
> or
> <soap:address location="http://localhost:9090/context/Greet+er" />
> or
> <soap:address location="http://localhost:9090/context/Greet%20er" />
>
> Any comment will be appreciated!
>
> -tong

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog