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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org




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


Reply via email to