You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by godoloju <Ma...@zionsbank.com> on 2007/09/07 23:41:08 UTC

Re: Dependency Injection in JAXWS endpoint

This solved the problem for me as well (switching from endpoint to server) &
I learned about autowire!


Michael Lake-5 wrote:
> 
> Brad -
> 
> I'm also using spring aop for transactions and method interceptors on my 
> endpoint interface.
> instead of using the <jaxws:endpoint implementor="#yourclass" ...
> 
> try something like the following:
> 
>   <jaxws:server id="alternateServiceEndpointServer"
>                   
> serviceClass="com.example.endpoint.AlternateServiceEndpoint"
>                   address="/AlternateService">
> 
>         <jaxws:serviceBean>
>             <bean id="alternateServiceEndpointImpl"
>           class="com.example.endpoint.AlternateServiceEndpointImpl" 
> autowire="byName" />
>         </jaxws:serviceBean>       
> 
>     </jaxws:server>
> 
> I've tried it this way and it works for me. either that or my upgrading 
> to spring 2.0.5
> 
> 
> 
> Brad Harper wrote:
>> When I remove my transaction advice:
>> <aop:config>
>>        <aop:advisor id="serviceTx" advice-ref="txAdvice"
>> pointcut="execution(* *..service..*.*(..))" order="0"/>
>>    </aop:config>
>>
>>
>>    <tx:advice id="txAdvice">
>>        <tx:attributes>
>>            <tx:method name="find*" read-only="true"/>
>>            <tx:method name="*"/>
>>        </tx:attributes>
>>    </tx:advice>
>>
>> the WSDLException above is resolved.  Can endpoints be transactional?
>>
>> On 7/26/07, Brad Harper <br...@gmail.com> wrote:
>>>
>>> I've tried wiring like you've shown:
>>>
>>>    <bean id="TestServiceImpl" class="
>>> com.mycorp.service.thirdparty.TestServiceImpl">
>>>         <property name="daoFactory">
>>>             <ref bean="hibernateDAOFactory"/>
>>>         </property>
>>>     </bean>
>>>
>>>     <jaxws:endpoint
>>>       id="testService"
>>>       implementor="#TestServiceImpl"
>>>       address="/testService" />
>>>
>>> I get odd service names displayed on the /services/
>>>
>>> $Proxy50Port 
>>> <http://localhost:8080/gdservices/services/testService?wsdl>
>>>
>>> I also get a 500 error when attempting to view the wsdl ..
>>>
>>> javax.servlet.ServletException: 
>>> org.apache.cxf.transport.http.WSDLQueryException: COULD_NOT_PROVIDE_WSDL
>>>    
>>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:131) 
>>>
>>>     org.apache.cxf.transport.servlet.CXFServlet.invoke
>>> (CXFServlet.java:261)
>>>    
>>> org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:243) 
>>>
>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java
>>> :803)
>>>    
>>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174) 
>>>
>>>    
>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) 
>>>
>>>
>>> *root cause*
>>>
>>> org.apache.cxf.transport.http.WSDLQueryException: COULD_NOT_PROVIDE_WSDL
>>>    
>>> org.apache.cxf.transport.http.WSDLQueryHandler.writeResponse(WSDLQueryHandler.java:185) 
>>>
>>>     org.apache.cxf.transport.servlet.ServletController.invoke
>>> (ServletController.java:127)
>>>    
>>> org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261) 
>>>
>>>    
>>> org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java:243) 
>>>
>>>     javax.servlet.http.HttpServlet.service
>>> (HttpServlet.java:690)
>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>    
>>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:174) 
>>>
>>>     org.springframework.web.filter.OncePerRequestFilter.doFilter
>>> (OncePerRequestFilter.java:77)
>>>
>>> *root cause*
>>>
>>> javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: 
>>> Problem parsing '- WSDL Document -'.: org.xml.sax.SAXParseException: 
>>> The value of the attribute 
>>> "prefix="xmlns",localpart="ns2",rawname="xmlns:ns2"" is invalid. 
>>> Prefixed namespace bindings may not be empty.
>>>
>>>     com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
>>>     com.ibm.wsdl.xml.WSDLWriterImpl.getDocument(Unknown Source)
>>>    
>>> org.apache.cxf.transport.http.WSDLQueryHandler.writeResponse(WSDLQueryHandler.java:141) 
>>>
>>>
>>>    
>>> org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:127) 
>>>
>>>    
>>> org.apache.cxf.transport.servlet.CXFServlet.invoke(CXFServlet.java:261) 
>>>
>>>     org.apache.cxf.transport.servlet.CXFServlet.doGet(CXFServlet.java
>>> :243)
>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
>>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>>    
>>> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal 
>>>
>>> (OpenSessionInViewFilter.java:174)
>>>    
>>> org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:77) 
>>>
>>>
>>> Does this look like something with my configuration?  I'm using aop
>>> transactions on the classes I'm trying to expose -- is this a bad 
>>> practice?
>>>
>>> Thanks for your time.
>>>
>>> -bh
>>>
>>>
>>> On 7/26/07, Mansour Raad <mr...@esri.com> wrote:
>>> >
>>> > Sorry....replace the implementor, not the id.
>>> >
>>> > Mansour
>>> > :-)
>>> >
>>> > On Jul 26, 2007, at 6:49 PM, Mansour Raad wrote:
>>> >
>>> > > Create a bean as follows:
>>> > >
>>> > > <bean id="reportingServiceImpl"
>>> > > class="com.visualio.reportserver.webservices.ReportingServiceImpl">
>>> > >   <!-- set properties here -->
>>> > > </bean>
>>> > >
>>> > > Replace the jaxws:endpoint id with
>>> > >
>>> > >       id="#reportingServiceImpl"
>>> > >
>>> > > Mansour
>>> > > :-)
>>> > >
>>> > > On Jul 26, 2007, at 6:44 PM, Jeremy Isikoff wrote:
>>> > >
>>> > >> I have an endpoint declaration like this in my beans.xml file, the
>>> > >> trouble is the
>>> > >> implementing class needs to get hold of some other spring beans
>>> > >> (mainly DAOs) so it can do its work.  How can I inject these in or
>>> > >> get the application context from within this implementation
>>> > >> class?  If this was a normal bean declaration id just inject the
>>> > >> DAOs but I dont know what to do with a Jaxws:endpoint bean?  Any
>>> > >> clues?
>>> > >>
>>> > >> <jaxws:endpoint
>>> > >> id="reportingService"
>>> > >> 
>>> implementor="com.visualio.reportserver.webservices.ReportingServiceIm
>>> > >> pl"
>>> > >> address="/ReportingService"
>>> > >> />
>>> > >>
>>> > >> Jeremy M. Isikoff
>>> > >>
>>> > >>
>>> > >>
>>> > >> 
>>> _____________________________________________________________________
>>> > >> _______________
>>> > >> Be a better Heartthrob. Get better relationship answers from
>>> > >> someone who knows. Yahoo! Answers - Check it out.
>>> > >> http://answers.yahoo.com/dir/?link=list&sid=396545433
>>> > >>
>>> > >
>>> > > Mansour
>>> > > :-)
>>> > >
>>> > >
>>> > >
>>> >
>>> > Mansour
>>> > :-)
>>> >
>>> >
>>> >
>>> >
>>>
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Dependency-Injection-in-JAXWS-endpoint-tf4154573.html#a12563757
Sent from the cxf-user mailing list archive at Nabble.com.