geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Forrest_Xia <forres...@gmail.com>
Subject Re: Can we use JAX-RPC and JAX-WS in the same time in a JEE application?
Date Wed, 07 Jan 2009 05:11:31 GMT

Jarek,

That testsuite samples do help, and I make progress. But I am stopped by a
new problem: how to code to access the jax-ws web service?

What I want to achieve is not to use static wsdl in any configuration file,
while let axis2 engine generate it at runtime. So I did following changes:
1. Add a webservice-description to WEB-INF/webservices.xml like this:
<webservice-description>
        <webservice-description-name>Trade JAX-WS
Impl</webservice-description-name>
        <port-component>
            <port-component-name>TradeJWSPort</port-component-name>
            <wsdl-service>TradeJWSService</wsdl-service>
            <enable-mtom>false</enable-mtom>
           
<service-endpoint-interface>org.apache.geronimo.samples.daytrader.jaxws.Trade</service-endpoint-interface>
            <service-impl-bean>
                <servlet-link>TradeImplwJAXWS</servlet-link>
            </service-impl-bean>
        </port-component>
    </webservice-description>
2. Then in a proxy code, I write as follows to try to get the web service
port.
<code>
                Service service = null;
		QName portName = null;
		try {
		  URL wsdlLoc = new URL(TradeConfig.getSoapURL());
		  QName serviceName = new
QName("http://jaxws.daytrader.samples.geronimo.apache.org",
"TradeJWSService");
        portName = new
QName("http://jaxws.daytrader.samples.geronimo.apache.org", "TradeJWSPort");	
		  service = Service.create(wsdlLoc, serviceName); // line 45 of
TradeImplwJAXWSProxy.java
        
		  
		} catch (MalformedURLException e) {
			Log.error(e, "TradeImplwJAXWSProxy throws MalformedURLException");
		}        
		return
(org.apache.geronimo.samples.daytrader.jaxws.Trade)service.getPort(portName, 
org.apache.geronimo.samples.daytrader.jaxws.Trade.class);
</code>

Then when I try to call it, an exception like this thrown out:
javax.xml.ws.WebServiceException: An attempt was made to construct the
ServiceDelegate object with an service name that is not valid:
{http://jaxws.daytrader.samples.geronimo.apache.org}TradeJWSService.
	at
org.apache.axis2.jaxws.ExceptionFactory.createWebServiceException(ExceptionFactory.java:172)
	at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:69)
	at
org.apache.axis2.jaxws.ExceptionFactory.makeWebServiceException(ExceptionFactory.java:117)
	at
org.apache.axis2.jaxws.spi.ServiceDelegate.<init>(ServiceDelegate.java:92)
	at
org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:45)
	at javax.xml.ws.Service.<init>(Service.java:36)
	at javax.xml.ws.Service.create(Service.java:88)
	at
org.apache.geronimo.samples.daytrader.jaxws.TradeImplwJAXWSProxy.getTrade(TradeImplwJAXWSProxy.java:45)
	at
org.apache.geronimo.samples.daytrader.jaxws.TradeImplwJAXWSProxy.<init>(TradeImplwJAXWSProxy.java:34)
	at
org.apache.geronimo.samples.daytrader.web.TradeServletAction.<init>(TradeServletAction.java:52)
	at
org.apache.geronimo.samples.daytrader.web.TradeAppServlet.performTask(TradeAppServlet.java:112)
	at
org.apache.geronimo.samples.daytrader.web.TradeAppServlet.doGet(TradeAppServlet.java:77)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:693)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.geronimo.samples.daytrader.web.OrdersAlertFilter.doFilter(OrdersAlertFilter.java:94)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.geronimo.tomcat.valve.DefaultSubjectValve.invoke(DefaultSubjectValve.java:56)
	at
org.apache.geronimo.tomcat.GeronimoStandardContext$SystemMethodValve.invoke(GeronimoStandardContext.java:406)
	at
org.apache.geronimo.tomcat.valve.GeronimoBeforeAfterValve.invoke(GeronimoBeforeAfterValve.java:47)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:810)

I checked web services testsuite, but not find a sample about how to use
dynamic wsdl generation to get service port. Seems those samples all use
generated static wsdl and service-ref to get service port from JNDI. 

Please advise, thanks!

Forrest

-- 
View this message in context: http://www.nabble.com/Can-we-use-JAX-RPC-and-JAX-WS-in-the-same-time-in-a-JEE-application--tp21312861s134p21325051.html
Sent from the Apache Geronimo - Dev mailing list archive at Nabble.com.


Mime
View raw message