Topic
  • 7 replies
  • Latest Post - ‏2011-08-11T19:30:38Z by bhdaniel
izhd
izhd
27 Posts

Pinned topic binding.http and Servlet

‏2011-08-08T21:36:20Z |
Hello,

Is it possible in current implementation to have http binding to the Servlet as it is described for Tuscany here http://tuscany.apache.org/sca-java-bindinghttp.html

I tried to define it following way

<component name="HTTPBindingComponent">
<implementation.java class="com.HTTPBindingComponentImpl"/>
<service name="HTTPBindingComponentImpl">
<ns1_1:binding.http uri="http://localhost:9080/content"/>
</service>
</component>

@Service(HTTPBindingComponentImpl.class)
public class HTTPBindingComponentImpl implements Servlet

Can't deploy SCA after that - 8/8/11 13:33:21:783 PDT 00000049 CheckForScaCo W com.ibm.ws.soa.sca.admin.cdf.content.operation.CheckForScaContent checkForDeleteCompUnit CWSAM0001W: Package does not contain SCA artifacts. BLA containing only such packages will not be runnable.
Updated on 2011-08-11T19:30:38Z at 2011-08-11T19:30:38Z by bhdaniel
  • bhdaniel
    bhdaniel
    7 Posts

    Re: binding.http and Servlet

    ‏2011-08-09T15:32:00Z  
    Hi,

    SCA in WAS does not currently support a binding.http like the one that exists in Tuscany. The only current support for binding.http is with wireFormat.jsonRpc.

    Brent
  • izhd
    izhd
    27 Posts

    Re: binding.http and Servlet

    ‏2011-08-09T18:26:24Z  
    • bhdaniel
    • ‏2011-08-09T15:32:00Z
    Hi,

    SCA in WAS does not currently support a binding.http like the one that exists in Tuscany. The only current support for binding.http is with wireFormat.jsonRpc.

    Brent
    Thank you Brent,
    So what would be your advise if I need to upload/download file? JSON/RPC doesn't permit it, we decided to use web OSGi bundle with servlets (we use OSGi implementation for SCA components)
    Regards,
    Igor
  • bhdaniel
    bhdaniel
    7 Posts

    Re: binding.http and Servlet

    ‏2011-08-09T20:09:02Z  
    • izhd
    • ‏2011-08-09T18:26:24Z
    Thank you Brent,
    So what would be your advise if I need to upload/download file? JSON/RPC doesn't permit it, we decided to use web OSGi bundle with servlets (we use OSGi implementation for SCA components)
    Regards,
    Igor
    Hi Igor,

    It depends on your scenario. If you don't need to use SCA resources in the servlet it might be best to use a standard JEE application. If you do need access to SCA resources, or just want it modeled as part of your SCA domain, then you may want to use implementation.web. This would also require you to use a standard JEE web module for the servlet, but would allow you to use SCA annotations. More information can be found here:

    http://publib.boulder.ibm.com/infocenter/wasinfo/fep/index.jsp?topic=/com.ibm.websphere.soafep.multiplatform.doc/info/ae/ae/tsca_scaannotforwebmodules.html

    Brent
  • izhd
    izhd
    27 Posts

    Re: binding.http and Servlet

    ‏2011-08-09T20:53:19Z  
    • bhdaniel
    • ‏2011-08-09T20:09:02Z
    Hi Igor,

    It depends on your scenario. If you don't need to use SCA resources in the servlet it might be best to use a standard JEE application. If you do need access to SCA resources, or just want it modeled as part of your SCA domain, then you may want to use implementation.web. This would also require you to use a standard JEE web module for the servlet, but would allow you to use SCA annotations. More information can be found here:

    http://publib.boulder.ibm.com/infocenter/wasinfo/fep/index.jsp?topic=/com.ibm.websphere.soafep.multiplatform.doc/info/ae/ae/tsca_scaannotforwebmodules.html

    Brent
    I actually need to use OSGi services from that servlet, and initially I didn't plan to expose them as SCA services. I guess I can reconsider that. I hope there are no limitation on passing InputStream between SCA components using SCA bindings?
    Also, is that correct assumption that I will be able to use SCA policy to enable authentication for JEE/SCA component?
  • bhdaniel
    bhdaniel
    7 Posts

    Re: binding.http and Servlet

    ‏2011-08-10T18:09:08Z  
    • izhd
    • ‏2011-08-09T20:53:19Z
    I actually need to use OSGi services from that servlet, and initially I didn't plan to expose them as SCA services. I guess I can reconsider that. I hope there are no limitation on passing InputStream between SCA components using SCA bindings?
    Also, is that correct assumption that I will be able to use SCA policy to enable authentication for JEE/SCA component?
    Igor,

    In that case, you may just want to use a web OSGi bundle.

    As far as passing an InputStream, I'm not aware of any limitations. As long as it is JAXB mappable, you should be able to pass it to a remote service. Obviously, the resource the InputStream is pointing to would need to be available on both sides. I think it's possible that some InputStream implementations could be tied to the originating ClassLoader, which could cause some problems. In general, I think it would be better to pass a resource location and create the InputStream again on the service side.

    For JEE applications using implementation.jee, you would still configure security using standard JEE mechanisms.

    Brent
  • izhd
    izhd
    27 Posts

    Re: binding.http and Servlet

    ‏2011-08-10T20:31:14Z  
    • bhdaniel
    • ‏2011-08-09T20:09:02Z
    Hi Igor,

    It depends on your scenario. If you don't need to use SCA resources in the servlet it might be best to use a standard JEE application. If you do need access to SCA resources, or just want it modeled as part of your SCA domain, then you may want to use implementation.web. This would also require you to use a standard JEE web module for the servlet, but would allow you to use SCA annotations. More information can be found here:

    http://publib.boulder.ibm.com/infocenter/wasinfo/fep/index.jsp?topic=/com.ibm.websphere.soafep.multiplatform.doc/info/ae/ae/tsca_scaannotforwebmodules.html

    Brent
    Hi Brent,

    Could you please elaborate more on implementation.web approach?
    I have SCA component

    <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" xmlns:sp_0="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" xmlns:ns1_1="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_1="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_2="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_3="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_4="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_5="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_6="http://tuscany.apache.org/xmlns/sca/1.0" autowire="false" name="ICMSServicesComposite" targetNamespace="http://imaging/icms">
    <component name="ICMSServices" requires="authentication.transport">
    <ns1:implementation.osgiapp applicationSymbolicName="ICMSOSGIApp" applicationVersion="1.0.0"/>
    <service name="UserServiceExt">
    <ns1_1:binding.http>
    <ns1_1:wireFormat.jsonrpc/>
    </ns1_1:binding.http>
    </service>
    </component>
    </composite>

    I've created Dynamic Web application ICMPContent & EAR ICMPContentEAR
    In ICMPContentEAR I've created application.composit

    <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:was="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" autowire="false" name="application" targetNamespace="http://imaging/icms">
    <component name="ICMPContent">
    <implementation.web web-uri="ICMPContent.war"/>
    <reference name="UserServiceExt" requires="authentication.transport" target="ICMSServices">
    <interface.java interface="com.wellsfargo.imaging.icms.user.api.UserService"/>
    </reference>
    </component>
    </composite>

    In ICMPContent I've created servlet

    public class TestReference extends HttpServlet {
    private static final long serialVersionUID = 1L;
    @Reference
    private UserService userService;

    Now when I call that servlet, I get exception.( The ICMSServices is deployed in the same WAS and is started)

    8/10/11 12:38:13:765 PDT 00000092 annotation E com.ibm.ws.webcontainer.annotation.WASAnnotationHelper inject exception while injecting resource --> http://InjectionTargetField= private com.wellsfargo.imaging.icms.user.api.UserService com.wellsfargo.imaging.icms.security.TestReference.userService
    com.ibm.wsspi.injectionengine.InjectionException: The com.ibm.ws.soa.sca.injection.util.IndirectSCALookupObjectFactory@613e613e factory encountered a problem getting the object instance Reference Class Name: com.wellsfargo.imaging.icms.security.TestReference/userService
    Type: SCAJEEInfo
    Content: _JEEName = ICMPContentEAR#ICMPContent.war
    _applicationName = ICMPContentEAR
    _moduleName = ICMPContent.war
    _annotationName = userService
    _annotationType = interface org.osoa.sca.annotations.Reference
    _injectionClassTypeinterface com.wellsfargo.imaging.icms.user.api.UserService
    _requiredtrue

    binding object
    at com.ibm.wsspi.injectionengine.InjectionBinding.getInjectionObject(InjectionBinding.java:684)
    at com.ibm.ws.soa.sca.injection.processor.ReferenceInjectionBinding.getInjectionObject(ReferenceInjectionBinding.java:95)
    at com.ibm.wsspi.injectionengine.InjectionTargetField.inject(InjectionTargetField.java:245)
    at com.ibm.ws.injectionengine.InjectionEngineImpl.inject(InjectionEngineImpl.java:620)
    at com.ibm.ws.webcontainer.annotation.WASAnnotationHelper.inject(WASAnnotationHelper.java:278)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.createTarget(ServletWrapperImpl.java:307)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper$1.run(ServletWrapper.java:1910)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadServlet(ServletWrapper.java:1900)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:730)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
    Caused by: org.osoa.sca.ServiceRuntimeException: SCA Injection failure: No SCA component found for the application. Check if SCDL is proper and if SCA contribution succeeded.
    at com.ibm.ws.soa.sca.injection.util.IndirectSCALookupObjectFactory.checkAndThrow(IndirectSCALookupObjectFactory.java:330)
    at com.ibm.ws.soa.sca.injection.util.IndirectSCALookupObjectFactory.getObjectInstance(IndirectSCALookupObjectFactory.java:112)
    at com.ibm.wsspi.injectionengine.InjectionBinding.getInjectionObject(InjectionBinding.java:659)
    ... 30 more
  • bhdaniel
    bhdaniel
    7 Posts

    Re: binding.http and Servlet

    ‏2011-08-11T19:30:38Z  
    • izhd
    • ‏2011-08-10T20:31:14Z
    Hi Brent,

    Could you please elaborate more on implementation.web approach?
    I have SCA component

    <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" xmlns:sp_0="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" xmlns:ns1_1="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_1="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_2="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_3="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_4="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_5="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:sp_6="http://tuscany.apache.org/xmlns/sca/1.0" autowire="false" name="ICMSServicesComposite" targetNamespace="http://imaging/icms">
    <component name="ICMSServices" requires="authentication.transport">
    <ns1:implementation.osgiapp applicationSymbolicName="ICMSOSGIApp" applicationVersion="1.0.0"/>
    <service name="UserServiceExt">
    <ns1_1:binding.http>
    <ns1_1:wireFormat.jsonrpc/>
    </ns1_1:binding.http>
    </service>
    </component>
    </composite>

    I've created Dynamic Web application ICMPContent & EAR ICMPContentEAR
    In ICMPContentEAR I've created application.composit

    <composite xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:was="http://www.ibm.com/xmlns/prod/websphere/sca/1.0/2007/06" autowire="false" name="application" targetNamespace="http://imaging/icms">
    <component name="ICMPContent">
    <implementation.web web-uri="ICMPContent.war"/>
    <reference name="UserServiceExt" requires="authentication.transport" target="ICMSServices">
    <interface.java interface="com.wellsfargo.imaging.icms.user.api.UserService"/>
    </reference>
    </component>
    </composite>

    In ICMPContent I've created servlet

    public class TestReference extends HttpServlet {
    private static final long serialVersionUID = 1L;
    @Reference
    private UserService userService;

    Now when I call that servlet, I get exception.( The ICMSServices is deployed in the same WAS and is started)

    8/10/11 12:38:13:765 PDT 00000092 annotation E com.ibm.ws.webcontainer.annotation.WASAnnotationHelper inject exception while injecting resource --> http://InjectionTargetField= private com.wellsfargo.imaging.icms.user.api.UserService com.wellsfargo.imaging.icms.security.TestReference.userService
    com.ibm.wsspi.injectionengine.InjectionException: The com.ibm.ws.soa.sca.injection.util.IndirectSCALookupObjectFactory@613e613e factory encountered a problem getting the object instance Reference Class Name: com.wellsfargo.imaging.icms.security.TestReference/userService
    Type: SCAJEEInfo
    Content: _JEEName = ICMPContentEAR#ICMPContent.war
    _applicationName = ICMPContentEAR
    _moduleName = ICMPContent.war
    _annotationName = userService
    _annotationType = interface org.osoa.sca.annotations.Reference
    _injectionClassTypeinterface com.wellsfargo.imaging.icms.user.api.UserService
    _requiredtrue

    binding object
    at com.ibm.wsspi.injectionengine.InjectionBinding.getInjectionObject(InjectionBinding.java:684)
    at com.ibm.ws.soa.sca.injection.processor.ReferenceInjectionBinding.getInjectionObject(ReferenceInjectionBinding.java:95)
    at com.ibm.wsspi.injectionengine.InjectionTargetField.inject(InjectionTargetField.java:245)
    at com.ibm.ws.injectionengine.InjectionEngineImpl.inject(InjectionEngineImpl.java:620)
    at com.ibm.ws.webcontainer.annotation.WASAnnotationHelper.inject(WASAnnotationHelper.java:278)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.createTarget(ServletWrapperImpl.java:307)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper$1.run(ServletWrapper.java:1910)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadServlet(ServletWrapper.java:1900)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:730)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:502)
    at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:179)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3933)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:276)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:931)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1583)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:186)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
    Caused by: org.osoa.sca.ServiceRuntimeException: SCA Injection failure: No SCA component found for the application. Check if SCDL is proper and if SCA contribution succeeded.
    at com.ibm.ws.soa.sca.injection.util.IndirectSCALookupObjectFactory.checkAndThrow(IndirectSCALookupObjectFactory.java:330)
    at com.ibm.ws.soa.sca.injection.util.IndirectSCALookupObjectFactory.getObjectInstance(IndirectSCALookupObjectFactory.java:112)
    at com.ibm.wsspi.injectionengine.InjectionBinding.getInjectionObject(InjectionBinding.java:659)
    ... 30 more
    Hi Igor,
    Just looking at this quickly, I think the issue is a mismatch between the reference name (UserServiceExt) and the field annotated with the @Reference tag (userService). You could use @Reference(name="UserServiceExt") or change the field name to match the reference name.

    Brent