You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Oliver Wulff <ow...@talend.com> on 2011/01/04 17:29:00 UTC
Uri prefixes of DestinationFactory wrong?
Hi there
I've developed an interceptor which should figure out what transport is in use independent whether the application is running within tomcat, osgi or whatever.
I'm running my tests with a soap/http service deployed in tomcat 6.
I get the DestinationFactory like this:
Exchange ex = message.getExchange();
Bus bus = ex.get(Bus.class);
Endpoint e = ex.get(Endpoint.class);
EndpointInfo ei = e.getEndpointInfo();
DestinationFactoryManager mgr = bus.getExtension(DestinationFactoryManager.class);
DestinationFactory factory = mgr.getDestinationFactory(ei.getTransportId());
Set<String> uriPrefixes = factory.getUriPrefixes();
I'm confused because the returned uri is: "soap.tcp"
The transport id is fine: http://schemas.xmlsoap.org/soap/http
The destination factory is:org.apache.cxf.binding.soap.SoapTransportFactory [factory.getClass().getName()]
I'd expect to get something like http:// and https:// back as defined in AbstractHTTPTransportFactory:
private static final Set<String> URI_PREFIXES = new HashSet<String>();
static {
URI_PREFIXES.add("http://");
URI_PREFIXES.add("https://");
}
but the SoapTransportFactory defines:
public Set<String> getUriPrefixes() {
return Collections.singleton("soap.tcp");
}
Thanks
Oli
Re: Uri prefixes of DestinationFactory wrong?
Posted by Christian Schneider <ch...@die-schneider.net>.
Got a little error here. For the servlet transport you will of course
need the servlet import like you did already instead of the jetty transport.
Best regards
Christian
Am 05.01.2011 13:54, schrieb Christian Schneider:
> Hi Oliver,
>
> you should import some more stuff in caseService.xml.
>
> For a client you need the following imports:
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
>
> For a server it is:
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>
> You can find complete example spring contexts in the wsdl_first
> example of the cxf distribution.
>
> Btw. I guess the SoapTransportFactory could be for soap over tcp but I
> never used this
>
> Best regards
>
> Christian
>
>
> Am 05.01.2011 13:30, schrieb Oliver Wulff:
>> Hi Christian
>>
>> I've attached the web.xml und spring configuration file for the
>> project. I've deployed the jax-ws service within plain tomcat 6.
>>
>> I'll do the debugging.
>>
>> I don't understand why CXF has a SoapTransportFactory. Soap is not a
>> transport for me. I'd expect the ServletTransportFactory to be used
>> instead. And if there is a requirement for a SoapTransportFactory I'm
>> wondering why the uri prefix is "soap.tcp" and not a real uri prefix
>> like http://.
>>
>> thanks
>> oli
>>
>> ________________________________________
>> Von: Christian Schneider [chris@die-schneider.net]
>> Gesendet: Mittwoch, 5. Januar 2011 11:02
>> An: users@cxf.apache.org
>> Betreff: Re: Uri prefixes of DestinationFactory wrong?
>>
>> Hi Oliver,
>>
>> can you post a complete little project that shows your environment?
>> I guess your bus does not have a destination factory for http. (At least
>> in he test). You could also try to debug into the getDestinationFactory
>> call to see what destinationFactories are available on the bus.
>>
>> Best regards
>>
>> Christian
>>
>> Am 04.01.2011 17:29, schrieb Oliver Wulff:
>>> Hi there
>>>
>>> I've developed an interceptor which should figure out what transport
>>> is in use independent whether the application is running within
>>> tomcat, osgi or whatever.
>>>
>>> I'm running my tests with a soap/http service deployed in tomcat 6.
>>>
>>> I get the DestinationFactory like this:
>>>
>>>
>>> Exchange ex = message.getExchange();
>>>
>>> Bus bus = ex.get(Bus.class);
>>>
>>> Endpoint e = ex.get(Endpoint.class);
>>>
>>> EndpointInfo ei = e.getEndpointInfo();
>>>
>>> DestinationFactoryManager mgr =
>>> bus.getExtension(DestinationFactoryManager.class);
>>>
>>> DestinationFactory factory =
>>> mgr.getDestinationFactory(ei.getTransportId());
>>>
>>> Set<String> uriPrefixes = factory.getUriPrefixes();
>>>
>>>
>>>
>>> I'm confused because the returned uri is: "soap.tcp"
>>>
>>>
>>>
>>> The transport id is fine: http://schemas.xmlsoap.org/soap/http
>>>
>>>
>>>
>>> The destination factory
>>> is:org.apache.cxf.binding.soap.SoapTransportFactory
>>> [factory.getClass().getName()]
>>>
>>>
>>>
>>> I'd expect to get something like http:// and https:// back as
>>> defined in AbstractHTTPTransportFactory:
>>>
>>>
>>>
>>> private static final Set<String> URI_PREFIXES = new
>>> HashSet<String>();
>>> static {
>>> URI_PREFIXES.add("http://");
>>> URI_PREFIXES.add("https://");
>>> }
>>>
>>>
>>>
>>> but the SoapTransportFactory defines:
>>>
>>> public Set<String> getUriPrefixes() {
>>> return Collections.singleton("soap.tcp");
>>> }
>>>
>>>
>>>
>>> Thanks
>>>
>>> Oli
>>>
>> --
>> ----
>> http://www.liquid-reality.de
>
--
----
http://www.liquid-reality.de
Re: Uri prefixes of DestinationFactory wrong?
Posted by Willem Jiang <wi...@gmail.com>.
On 1/5/11 8:54 PM, Christian Schneider wrote:
> Hi Oliver,
>
> you should import some more stuff in caseService.xml.
>
> For a client you need the following imports:
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
>
> For a server it is:
> <import resource="classpath:META-INF/cxf/cxf.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
>
> You can find complete example spring contexts in the wsdl_first example
> of the cxf distribution.
>
> Btw. I guess the SoapTransportFactory could be for soap over tcp but I
> never used this
SoapTransportFactory will take care the transportId like
soap over jms "http://www.w3.org/2010/soapjms/"
soap over http binding "http://schemas.xmlsoap.org/soap/http/"
etc.
>
> Best regards
>
> Christian
>
>
> Am 05.01.2011 13:30, schrieb Oliver Wulff:
>> Hi Christian
>>
>> I've attached the web.xml und spring configuration file for the
>> project. I've deployed the jax-ws service within plain tomcat 6.
>>
>> I'll do the debugging.
>>
>> I don't understand why CXF has a SoapTransportFactory. Soap is not a
>> transport for me. I'd expect the ServletTransportFactory to be used
>> instead. And if there is a requirement for a SoapTransportFactory I'm
>> wondering why the uri prefix is "soap.tcp" and not a real uri prefix
>> like http://.
>>
>> thanks
>> oli
>>
>> ________________________________________
>> Von: Christian Schneider [chris@die-schneider.net]
>> Gesendet: Mittwoch, 5. Januar 2011 11:02
>> An: users@cxf.apache.org
>> Betreff: Re: Uri prefixes of DestinationFactory wrong?
>>
>> Hi Oliver,
>>
>> can you post a complete little project that shows your environment?
>> I guess your bus does not have a destination factory for http. (At least
>> in he test). You could also try to debug into the getDestinationFactory
>> call to see what destinationFactories are available on the bus.
>>
>> Best regards
>>
>> Christian
>>
>> Am 04.01.2011 17:29, schrieb Oliver Wulff:
>>> Hi there
>>>
>>> I've developed an interceptor which should figure out what transport
>>> is in use independent whether the application is running within
>>> tomcat, osgi or whatever.
>>>
>>> I'm running my tests with a soap/http service deployed in tomcat 6.
>>>
>>> I get the DestinationFactory like this:
>>>
>>>
>>> Exchange ex = message.getExchange();
>>>
>>> Bus bus = ex.get(Bus.class);
>>>
>>> Endpoint e = ex.get(Endpoint.class);
>>>
>>> EndpointInfo ei = e.getEndpointInfo();
>>>
>>> DestinationFactoryManager mgr =
>>> bus.getExtension(DestinationFactoryManager.class);
>>>
>>> DestinationFactory factory =
>>> mgr.getDestinationFactory(ei.getTransportId());
>>>
>>> Set<String> uriPrefixes = factory.getUriPrefixes();
>>>
>>>
>>>
>>> I'm confused because the returned uri is: "soap.tcp"
>>>
>>>
>>>
>>> The transport id is fine: http://schemas.xmlsoap.org/soap/http
>>>
>>>
>>>
>>> The destination factory
>>> is:org.apache.cxf.binding.soap.SoapTransportFactory
>>> [factory.getClass().getName()]
>>>
>>>
>>>
>>> I'd expect to get something like http:// and https:// back as defined
>>> in AbstractHTTPTransportFactory:
>>>
>>>
>>>
>>> private static final Set<String> URI_PREFIXES = new HashSet<String>();
>>> static {
>>> URI_PREFIXES.add("http://");
>>> URI_PREFIXES.add("https://");
>>> }
>>>
>>>
>>>
>>> but the SoapTransportFactory defines:
>>>
>>> public Set<String> getUriPrefixes() {
>>> return Collections.singleton("soap.tcp");
>>> }
>>>
>>>
>>>
>>> Thanks
>>>
>>> Oli
>>>
>> --
>> ----
>> http://www.liquid-reality.de
>
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Re: Uri prefixes of DestinationFactory wrong?
Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Oliver,
you should import some more stuff in caseService.xml.
For a client you need the following imports:
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
For a server it is:
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
You can find complete example spring contexts in the wsdl_first example
of the cxf distribution.
Btw. I guess the SoapTransportFactory could be for soap over tcp but I
never used this
Best regards
Christian
Am 05.01.2011 13:30, schrieb Oliver Wulff:
> Hi Christian
>
> I've attached the web.xml und spring configuration file for the project. I've deployed the jax-ws service within plain tomcat 6.
>
> I'll do the debugging.
>
> I don't understand why CXF has a SoapTransportFactory. Soap is not a transport for me. I'd expect the ServletTransportFactory to be used instead. And if there is a requirement for a SoapTransportFactory I'm wondering why the uri prefix is "soap.tcp" and not a real uri prefix like http://.
>
> thanks
> oli
>
> ________________________________________
> Von: Christian Schneider [chris@die-schneider.net]
> Gesendet: Mittwoch, 5. Januar 2011 11:02
> An: users@cxf.apache.org
> Betreff: Re: Uri prefixes of DestinationFactory wrong?
>
> Hi Oliver,
>
> can you post a complete little project that shows your environment?
> I guess your bus does not have a destination factory for http. (At least
> in he test). You could also try to debug into the getDestinationFactory
> call to see what destinationFactories are available on the bus.
>
> Best regards
>
> Christian
>
> Am 04.01.2011 17:29, schrieb Oliver Wulff:
>> Hi there
>>
>> I've developed an interceptor which should figure out what transport is in use independent whether the application is running within tomcat, osgi or whatever.
>>
>> I'm running my tests with a soap/http service deployed in tomcat 6.
>>
>> I get the DestinationFactory like this:
>>
>>
>> Exchange ex = message.getExchange();
>>
>> Bus bus = ex.get(Bus.class);
>>
>> Endpoint e = ex.get(Endpoint.class);
>>
>> EndpointInfo ei = e.getEndpointInfo();
>>
>> DestinationFactoryManager mgr = bus.getExtension(DestinationFactoryManager.class);
>>
>> DestinationFactory factory = mgr.getDestinationFactory(ei.getTransportId());
>>
>> Set<String> uriPrefixes = factory.getUriPrefixes();
>>
>>
>>
>> I'm confused because the returned uri is: "soap.tcp"
>>
>>
>>
>> The transport id is fine: http://schemas.xmlsoap.org/soap/http
>>
>>
>>
>> The destination factory is:org.apache.cxf.binding.soap.SoapTransportFactory [factory.getClass().getName()]
>>
>>
>>
>> I'd expect to get something like http:// and https:// back as defined in AbstractHTTPTransportFactory:
>>
>>
>>
>> private static final Set<String> URI_PREFIXES = new HashSet<String>();
>> static {
>> URI_PREFIXES.add("http://");
>> URI_PREFIXES.add("https://");
>> }
>>
>>
>>
>> but the SoapTransportFactory defines:
>>
>> public Set<String> getUriPrefixes() {
>> return Collections.singleton("soap.tcp");
>> }
>>
>>
>>
>> Thanks
>>
>> Oli
>>
> --
> ----
> http://www.liquid-reality.de
--
----
http://www.liquid-reality.de
AW: Uri prefixes of DestinationFactory wrong?
Posted by Oliver Wulff <ow...@talend.com>.
Hi Christian
I've attached the web.xml und spring configuration file for the project. I've deployed the jax-ws service within plain tomcat 6.
I'll do the debugging.
I don't understand why CXF has a SoapTransportFactory. Soap is not a transport for me. I'd expect the ServletTransportFactory to be used instead. And if there is a requirement for a SoapTransportFactory I'm wondering why the uri prefix is "soap.tcp" and not a real uri prefix like http://.
thanks
oli
________________________________________
Von: Christian Schneider [chris@die-schneider.net]
Gesendet: Mittwoch, 5. Januar 2011 11:02
An: users@cxf.apache.org
Betreff: Re: Uri prefixes of DestinationFactory wrong?
Hi Oliver,
can you post a complete little project that shows your environment?
I guess your bus does not have a destination factory for http. (At least
in he test). You could also try to debug into the getDestinationFactory
call to see what destinationFactories are available on the bus.
Best regards
Christian
Am 04.01.2011 17:29, schrieb Oliver Wulff:
> Hi there
>
> I've developed an interceptor which should figure out what transport is in use independent whether the application is running within tomcat, osgi or whatever.
>
> I'm running my tests with a soap/http service deployed in tomcat 6.
>
> I get the DestinationFactory like this:
>
>
> Exchange ex = message.getExchange();
>
> Bus bus = ex.get(Bus.class);
>
> Endpoint e = ex.get(Endpoint.class);
>
> EndpointInfo ei = e.getEndpointInfo();
>
> DestinationFactoryManager mgr = bus.getExtension(DestinationFactoryManager.class);
>
> DestinationFactory factory = mgr.getDestinationFactory(ei.getTransportId());
>
> Set<String> uriPrefixes = factory.getUriPrefixes();
>
>
>
> I'm confused because the returned uri is: "soap.tcp"
>
>
>
> The transport id is fine: http://schemas.xmlsoap.org/soap/http
>
>
>
> The destination factory is:org.apache.cxf.binding.soap.SoapTransportFactory [factory.getClass().getName()]
>
>
>
> I'd expect to get something like http:// and https:// back as defined in AbstractHTTPTransportFactory:
>
>
>
> private static final Set<String> URI_PREFIXES = new HashSet<String>();
> static {
> URI_PREFIXES.add("http://");
> URI_PREFIXES.add("https://");
> }
>
>
>
> but the SoapTransportFactory defines:
>
> public Set<String> getUriPrefixes() {
> return Collections.singleton("soap.tcp");
> }
>
>
>
> Thanks
>
> Oli
>
--
----
http://www.liquid-reality.de
Re: Uri prefixes of DestinationFactory wrong?
Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Oliver,
can you post a complete little project that shows your environment?
I guess your bus does not have a destination factory for http. (At least
in he test). You could also try to debug into the getDestinationFactory
call to see what destinationFactories are available on the bus.
Best regards
Christian
Am 04.01.2011 17:29, schrieb Oliver Wulff:
> Hi there
>
> I've developed an interceptor which should figure out what transport is in use independent whether the application is running within tomcat, osgi or whatever.
>
> I'm running my tests with a soap/http service deployed in tomcat 6.
>
> I get the DestinationFactory like this:
>
>
> Exchange ex = message.getExchange();
>
> Bus bus = ex.get(Bus.class);
>
> Endpoint e = ex.get(Endpoint.class);
>
> EndpointInfo ei = e.getEndpointInfo();
>
> DestinationFactoryManager mgr = bus.getExtension(DestinationFactoryManager.class);
>
> DestinationFactory factory = mgr.getDestinationFactory(ei.getTransportId());
>
> Set<String> uriPrefixes = factory.getUriPrefixes();
>
>
>
> I'm confused because the returned uri is: "soap.tcp"
>
>
>
> The transport id is fine: http://schemas.xmlsoap.org/soap/http
>
>
>
> The destination factory is:org.apache.cxf.binding.soap.SoapTransportFactory [factory.getClass().getName()]
>
>
>
> I'd expect to get something like http:// and https:// back as defined in AbstractHTTPTransportFactory:
>
>
>
> private static final Set<String> URI_PREFIXES = new HashSet<String>();
> static {
> URI_PREFIXES.add("http://");
> URI_PREFIXES.add("https://");
> }
>
>
>
> but the SoapTransportFactory defines:
>
> public Set<String> getUriPrefixes() {
> return Collections.singleton("soap.tcp");
> }
>
>
>
> Thanks
>
> Oli
>
--
----
http://www.liquid-reality.de
Re: Uri prefixes of DestinationFactory wrong?
Posted by Daniel Kulp <dk...@apache.org>.
Oli,
I think you are a little confused as to what the purpose of the uri prefixes
are in the factories. I'll try and explain:
When we create a client or endpoint, we need to figure out a transport for it.
In MOST cases, we have some sort of trandport ID. That can come the wsdl
(namespace on any extensor elements in the wsdl:port element) or from a JAX-WS
annotation or specified in config or a few other places. However, there are
some cases were we don't have the transport ID. It's more common with the
simple frontend where we don't have the annotations and WSDL is used less
often. In that case, we need to do a best effort to figure out a transport
to use. The current way to do that is to look at the prefix from the publish
address and use the uri prefixes to find a transport that matches. It's a
very simple process and seems to work "OK". The http transport would handle
http:/https:, jms tranport would handle "jms:", local transport "local:",
etc.... The only thing the soap transport will match on right now is
soap.tcp, which is only about 1/2 implemented. Kind of a work in progress.
(and not documented) HOWEVER, the SOAP transport is kind of a special case.
There are a bunch of "soap" specific transport ID's that are mapped to it.
Internally, the factory for it maps those to the CXF specific ID's and then
grabs the Destination/Conduit factory from the bus based on that along with
configuring extra things for the SOAP specific processing on those transports.
That really the only purpose of those prefixes. Thus, they really aren't
usable for what you are trying to accomplish.
My suggestion is to simply do something like:
Destination dest = message.getExchange().getDestination();
to get the actual destination in use. Then map that via a class name.
String name = dest.getClass().getName();
if (name.startsWith("org.apache.cxf.transport.") {
name = name.substring(26);
}
String id = name.substring(0, name.indexOf('.'));
which should result in "jms", "http_jetty", "servlet", "local", etc... for any
of the CXF supplied transports. For custom transports, that won't work
though.
Dan
On Tuesday 04 January 2011 11:29:00 am Oliver Wulff wrote:
> Hi there
>
> I've developed an interceptor which should figure out what transport is in
> use independent whether the application is running within tomcat, osgi or
> whatever.
>
> I'm running my tests with a soap/http service deployed in tomcat 6.
>
> I get the DestinationFactory like this:
>
>
> Exchange ex = message.getExchange();
>
> Bus bus = ex.get(Bus.class);
>
> Endpoint e = ex.get(Endpoint.class);
>
> EndpointInfo ei = e.getEndpointInfo();
>
> DestinationFactoryManager mgr =
> bus.getExtension(DestinationFactoryManager.class);
>
> DestinationFactory factory =
> mgr.getDestinationFactory(ei.getTransportId());
>
> Set<String> uriPrefixes = factory.getUriPrefixes();
>
>
>
> I'm confused because the returned uri is: "soap.tcp"
>
>
>
> The transport id is fine: http://schemas.xmlsoap.org/soap/http
>
>
>
> The destination factory is:org.apache.cxf.binding.soap.SoapTransportFactory
> [factory.getClass().getName()]
>
>
>
> I'd expect to get something like http:// and https:// back as defined in
> AbstractHTTPTransportFactory:
>
>
>
> private static final Set<String> URI_PREFIXES = new HashSet<String>();
> static {
> URI_PREFIXES.add("http://");
> URI_PREFIXES.add("https://");
> }
>
>
>
> but the SoapTransportFactory defines:
>
> public Set<String> getUriPrefixes() {
> return Collections.singleton("soap.tcp");
> }
>
>
>
> Thanks
>
> Oli
--
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog