You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Norman Franke <no...@myasd.com> on 2011/09/22 00:31:44 UTC

T5.2 and Metro / SOAP

I have a need to create some web services to provide SOAP access. I'm  
already using Tapestry 5.2 for our web applications, so I think it  
would be natural to be able to use Tapestry's IoC with Metro, if  
possible. This would save me from having to re-implement all the DAO  
functionality.

Has anyone done this? Any thoughts on how to approach this? I'm new to  
Metro, but I'm pretty comfortable with Tapestry 5.2.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com




Re: T5.2 and Metro / SOAP

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
I would love to see metro integration. Just because it's the default in glassfish and I am already using it. Or any thoughts on how to implement it. 



On Sep 22, 2011, at 12:12 PM, Norman Franke <no...@myasd.com> wrote:

> I know Metros quite Windows .NET friendly. Not sure about CXF, but if so, I could go that way, too. The question would still remain. Can you integrate Tapestry IoC with CXF relatively easily?
> 
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
> 
> 
> 
> On Sep 21, 2011, at 6:35 PM, Daniel Honig wrote:
> 
>> Why use metro when you can use CXF?
>> 
>> Metro is good, but I don't think there is as much activity as CXF post the
>> Sun/Oracle merger.
>> 
>> On Wed, Sep 21, 2011 at 6:31 PM, Norman Franke <no...@myasd.com> wrote:
>> 
>>> I have a need to create some web services to provide SOAP access. I'm
>>> already using Tapestry 5.2 for our web applications, so I think it would be
>>> natural to be able to use Tapestry's IoC with Metro, if possible. This would
>>> save me from having to re-implement all the DAO functionality.
>>> 
>>> Has anyone done this? Any thoughts on how to approach this? I'm new to
>>> Metro, but I'm pretty comfortable with Tapestry 5.2.
>>> 
>>> Norman Franke
>>> Answering Service for Directors, Inc.
>>> www.myasd.com
>>> 
>>> 
>>> 
>>> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.2 and CXF / SOAP

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
I would like to see this as well, perhaps this will help with my Metro web services integration.
Thanks!

On Sep 26, 2011, at 11:33 AM, Norman Franke wrote:

> Care to share?
> 
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
> 
> 
> 
> On Sep 26, 2011, at 9:20 AM, Ulrich Stärk wrote:
> 
>> I have.
>> 
>> On 24.09.2011 00:27, Norman Franke wrote:
>>> So, since CXF appears to be way, way better documented, I'll ask. Has anyone integrated Tapestry
>>> 5's IoC with CXF?
>>> 
>>> Norman Franke
>>> Answering Service for Directors, Inc.
>>> www.myasd.com
>>> 
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.2 and CXF / SOAP

Posted by Norman Franke <no...@myasd.com>.
Thanks! That should be very helpful.

I may be doing attachments for pictures and integrating with .NET, so  
the MTOM stuff should come in handy.

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Sep 27, 2011, at 8:30 AM, Ulrich Stärk wrote:

> Sure:
>
> First you need a CXF servlet to process incoming requests targeted  
> at the web service. Something
> along the lines of
>
> public class MyCXFServlet extends CXFNonSpringServlet
> {
>    private static final long serialVersionUID = -2887022453330372210L;
>
>    @Override
>    public void loadBus(ServletConfig servletConfig) throws  
> ServletException
>    {
>        super.loadBus(servletConfig);
>
>        Registry registry = (Registry)
> servletConfig 
> .getServletContext 
> ().getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);
>
>        MyService impl = registry.getService("MyService",  
> MyServiceImpl.class);
>
>        Bus bus = this.getBus();
>        BusFactory.setDefaultBus(bus);
>        EndpointImpl ep = (EndpointImpl) Endpoint.create(impl);
>        ep.getFeatures().add(new WSAddressingFeature());
>        ep.setPublishedEndpointUrl("https://your.host/some/path/MyService 
> ");
>        ep.publish("/MyService");
>    }
> }
>
> As you can see we fetch the Tapestry IoC registry from the servlet  
> context and ask it for a service
> called MyService that is then being published by CXF. The service  
> interface looks something like
>
> import javax.activation.DataHandler;
> import javax.jws.WebService;
>
> @WebService
> public interface RelationAnalyzer
> {
>    public List<Foo> doSomething(DataHandler file) throws IOException;
> }
>
> In this case doSomething() is working on a file upload and since  
> this one is speaking to a .NET
> client we need to configure it to send files as MTOM attachments and  
> configure it as a SOAP 1.2 HTTP
> Binding:
>
> import javax.activation.DataHandler;
> import javax.jws.WebService;
> import javax.xml.ws.BindingType;
> import javax.xml.ws.soap.SOAPBinding;
>
> @BindingType(SOAPBinding.SOAP12HTTP_MTOM_BINDING)
> @WebService(endpointInterface = "MyService",
>        serviceName = "MyService")
> public class MyServiceImpl implements MyService
> {
> ...
> }
>
> Additionally, in your AppModule you have to tell Tapestry to ignore  
> the path where your webservice
> is listening for requests (compare with above's  
> setPublishedEndpointURL()):
>
> public static void  
> contributeIgnoredPathsFilter(Configuration<String> configuration)
> {
>    configuration.add("/some/path/.*");
> }
>
> Since in previous versions, Tapestry didn't copy annotations from  
> the service implementation to it's
> proxies, you have to bind the implementation itself:
>
> binder.bind(MyServiceImpl.class).withId("MyService");
>
> This might be different now, I haven't tried the new feature though.
>
> And as a goodie from the web service client's app.config:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
>    <configSections>
>    </configSections>
>    <system.serviceModel>
>        <bindings>
>            <customBinding>
>                <binding name="MyServiceSoapBinding">
>                  <mtomMessageEncoding maxReadPoolSize="64"  
> maxWritePoolSize="16"
>                        messageVersion="Soap12" writeEncoding="utf-8">
>                        <readerQuotas maxDepth="32"  
> maxStringContentLength="8192" maxArrayLength="16384"
>                            maxBytesPerRead="4096"  
> maxNameTableCharCount="16384" />
>                    </mtomMessageEncoding>
>                    <httpsTransport manualAddressing="false"  
> maxBufferPoolSize="524288"
>                        maxReceivedMessageSize="65536"  
> allowCookies="false"
> authenticationScheme="Anonymous"
>                        bypassProxyOnLocal="false"  
> hostNameComparisonMode="StrongWildcard"
>                        keepAliveEnabled="true" maxBufferSize="65536"
> proxyAuthenticationScheme="Anonymous"
>                        realm="" transferMode="Buffered"  
> unsafeConnectionNtlmAuthentication="false"
>                        useDefaultWebProxy="true"  
> requireClientCertificate="false">
>                    </httpsTransport>
>                </binding>
>            </customBinding>
>        </bindings>
>        <client>
>            <endpoint address="https://your.host/some/path/MyService"
>                binding="customBinding"  
> bindingConfiguration="MyServiceSoapBinding"
>                contract="MyService.MyService"  
> name="MyServiceImplPort" />
>        </client>
>    </system.serviceModel>
> </configuration>
>
> HTH,
>
> Uli
>
> On 26.09.2011 17:33, Norman Franke wrote:
>> Care to share?
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>>
>>
>> On Sep 26, 2011, at 9:20 AM, Ulrich Stärk wrote:
>>
>>> I have.
>>>
>>> On 24.09.2011 00:27, Norman Franke wrote:
>>>> So, since CXF appears to be way, way better documented, I'll ask.  
>>>> Has anyone integrated Tapestry
>>>> 5's IoC with CXF?
>>>>
>>>> Norman Franke
>>>> Answering Service for Directors, Inc.
>>>> www.myasd.com
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: T5.2 and CXF / SOAP

Posted by Ulrich Stärk <ul...@spielviel.de>.
Sure:

First you need a CXF servlet to process incoming requests targeted at the web service. Something
along the lines of

public class MyCXFServlet extends CXFNonSpringServlet
{
    private static final long serialVersionUID = -2887022453330372210L;

    @Override
    public void loadBus(ServletConfig servletConfig) throws ServletException
    {
        super.loadBus(servletConfig);
       
        Registry registry = (Registry)
servletConfig.getServletContext().getAttribute(TapestryFilter.REGISTRY_CONTEXT_NAME);
       
        MyService impl = registry.getService("MyService", MyServiceImpl.class);
       
        Bus bus = this.getBus();
        BusFactory.setDefaultBus(bus);
        EndpointImpl ep = (EndpointImpl) Endpoint.create(impl);
        ep.getFeatures().add(new WSAddressingFeature());
        ep.setPublishedEndpointUrl("https://your.host/some/path/MyService");
        ep.publish("/MyService");
    }
}

As you can see we fetch the Tapestry IoC registry from the servlet context and ask it for a service
called MyService that is then being published by CXF. The service interface looks something like

import javax.activation.DataHandler;
import javax.jws.WebService;

@WebService
public interface RelationAnalyzer
{
    public List<Foo> doSomething(DataHandler file) throws IOException;
}

In this case doSomething() is working on a file upload and since this one is speaking to a .NET
client we need to configure it to send files as MTOM attachments and configure it as a SOAP 1.2 HTTP
Binding:

import javax.activation.DataHandler;
import javax.jws.WebService;
import javax.xml.ws.BindingType;
import javax.xml.ws.soap.SOAPBinding;

@BindingType(SOAPBinding.SOAP12HTTP_MTOM_BINDING)
@WebService(endpointInterface = "MyService",
        serviceName = "MyService")
public class MyServiceImpl implements MyService
{
...
}

Additionally, in your AppModule you have to tell Tapestry to ignore the path where your webservice
is listening for requests (compare with above's setPublishedEndpointURL()):

public static void contributeIgnoredPathsFilter(Configuration<String> configuration)
{
    configuration.add("/some/path/.*");
}

Since in previous versions, Tapestry didn't copy annotations from the service implementation to it's
proxies, you have to bind the implementation itself:

binder.bind(MyServiceImpl.class).withId("MyService");

This might be different now, I haven't tried the new feature though.

And as a goodie from the web service client's app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <system.serviceModel>
        <bindings>
            <customBinding>
                <binding name="MyServiceSoapBinding">
                  <mtomMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16"
                        messageVersion="Soap12" writeEncoding="utf-8">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    </mtomMessageEncoding>
                    <httpsTransport manualAddressing="false" maxBufferPoolSize="524288"
                        maxReceivedMessageSize="65536" allowCookies="false"
authenticationScheme="Anonymous"
                        bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        keepAliveEnabled="true" maxBufferSize="65536"
proxyAuthenticationScheme="Anonymous"
                        realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
                        useDefaultWebProxy="true" requireClientCertificate="false">
                    </httpsTransport>
                </binding>
            </customBinding>
        </bindings>
        <client>
            <endpoint address="https://your.host/some/path/MyService"
                binding="customBinding" bindingConfiguration="MyServiceSoapBinding"
                contract="MyService.MyService" name="MyServiceImplPort" />
        </client>
    </system.serviceModel>
</configuration>

HTH,

Uli

On 26.09.2011 17:33, Norman Franke wrote:
> Care to share?
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
> On Sep 26, 2011, at 9:20 AM, Ulrich Stärk wrote:
>
>> I have.
>>
>> On 24.09.2011 00:27, Norman Franke wrote:
>>> So, since CXF appears to be way, way better documented, I'll ask. Has anyone integrated Tapestry
>>> 5's IoC with CXF?
>>>
>>> Norman Franke
>>> Answering Service for Directors, Inc.
>>> www.myasd.com
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.2 and CXF / SOAP

Posted by Norman Franke <no...@myasd.com>.
Care to share?

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Sep 26, 2011, at 9:20 AM, Ulrich Stärk wrote:

> I have.
>
> On 24.09.2011 00:27, Norman Franke wrote:
>> So, since CXF appears to be way, way better documented, I'll ask.  
>> Has anyone integrated Tapestry
>> 5's IoC with CXF?
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: T5.2 and CXF / SOAP

Posted by Ulrich Stärk <ul...@spielviel.de>.
I have.

On 24.09.2011 00:27, Norman Franke wrote:
> So, since CXF appears to be way, way better documented, I'll ask. Has anyone integrated Tapestry
> 5's IoC with CXF?
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5.2 and CXF / SOAP

Posted by Daniel Honig <da...@gmail.com>.
Yes over the long run you will be way better served by CXF than Metro, 2 years ago I would have chosen Metro,
but no longer.

Shame I can't help you integrate it with Tap.
On Sep 23, 2011, at 6:27 PM, Norman Franke wrote:

> So, since CXF appears to be way, way better documented, I'll ask. Has anyone integrated Tapestry 5's IoC with CXF?
> 
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


T5.2 and CXF / SOAP

Posted by Norman Franke <no...@myasd.com>.
So, since CXF appears to be way, way better documented, I'll ask. Has  
anyone integrated Tapestry 5's IoC with CXF?

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com


Re: T5.2 and Metro / SOAP

Posted by Norman Franke <no...@myasd.com>.
I know Metros quite Windows .NET friendly. Not sure about CXF, but if  
so, I could go that way, too. The question would still remain. Can you  
integrate Tapestry IoC with CXF relatively easily?

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On Sep 21, 2011, at 6:35 PM, Daniel Honig wrote:

> Why use metro when you can use CXF?
>
> Metro is good, but I don't think there is as much activity as CXF  
> post the
> Sun/Oracle merger.
>
> On Wed, Sep 21, 2011 at 6:31 PM, Norman Franke <no...@myasd.com>  
> wrote:
>
>> I have a need to create some web services to provide SOAP access. I'm
>> already using Tapestry 5.2 for our web applications, so I think it  
>> would be
>> natural to be able to use Tapestry's IoC with Metro, if possible.  
>> This would
>> save me from having to re-implement all the DAO functionality.
>>
>> Has anyone done this? Any thoughts on how to approach this? I'm new  
>> to
>> Metro, but I'm pretty comfortable with Tapestry 5.2.
>>
>> Norman Franke
>> Answering Service for Directors, Inc.
>> www.myasd.com
>>
>>
>>
>>


Re: T5.2 and Metro / SOAP

Posted by Daniel Honig <da...@gmail.com>.
Why use metro when you can use CXF?

Metro is good, but I don't think there is as much activity as CXF post the
Sun/Oracle merger.

On Wed, Sep 21, 2011 at 6:31 PM, Norman Franke <no...@myasd.com> wrote:

> I have a need to create some web services to provide SOAP access. I'm
> already using Tapestry 5.2 for our web applications, so I think it would be
> natural to be able to use Tapestry's IoC with Metro, if possible. This would
> save me from having to re-implement all the DAO functionality.
>
> Has anyone done this? Any thoughts on how to approach this? I'm new to
> Metro, but I'm pretty comfortable with Tapestry 5.2.
>
> Norman Franke
> Answering Service for Directors, Inc.
> www.myasd.com
>
>
>
>