You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by yulinxp <yu...@gmail.com> on 2008/02/29 20:08:39 UTC

How to seperate with CXF

I have a project which uses CXF server to publish my own service.
Now I need to add in a web service client into the project to connect to 3rd
party web service.

I use JAX-WS RI wsimport to generate those class files. It works alone!
But when I add it in my project, cxf client take control! 
I don't want to use CXF client. How can I do separate it !

Feb 29, 2008 12:55:37 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {https://xxx/HPRequest.asmx}HPRequestWS from WSDL:
file:/C:/xxx.wsdl
 ....

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not
send Message.
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:175) 
<----------
-- 
View this message in context: http://www.nabble.com/How-to-seperate-with-CXF-tp15765424p15765424.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to seperate with CXF

Posted by Daniel Kulp <dk...@apache.org>.

You can try something like:

        ClassLoader cl = new URLClassLoader(new URL[0], 
Thread.currentThread().getContextClassLoader()) {
            public InputStream getResourceAsStream(String s) {
                if 
("META-INF/services/javax.xml.ws.spi.Provider".equals("s")) {
                    return null;
                }
                return super.getResourceAsStream(s);
            }            
            public URL getResource(String s) {
                if 
("META-INF/services/javax.xml.ws.spi.Provider".equals("s")) {
                    return null;
                }
                return super.getResource(s);
            }            
        };
        Thread.currentThread().setContextClassLoader(cl); 
        ... new Service...
        Thread.currentThread().setContextClassLoader(cl.getParent());

Dan


On Friday 29 February 2008, yulinxp wrote:
> Could you pls give me some code snippets?
> I don't know how to block the call to
> getResource("META-INF/services/javax.xml.ws.spi.Provider")
>
> dkulp wrote:
> > Honestly, I'm not sure there IS a way.   I was hoping for at least a
> > system property, but looking at the code for jaxws-api, the system
> > property is actually checked last.  :-(
> >
> > The only way I can come up with that MIGHT work is to create a
> > special classloader that blocks the call to
> > getResource("META-INF/services/javax.xml.ws.spi.Provider") and just
> > returns null.   Set the thread.contextClassLoader to that
> > classloader just before the call to "new HPRequestWS()".  Probably
> > should reset it back to the original when done.
> >
> > Dan
> >
> > On Friday 29 February 2008, yulinxp wrote:
> >> Those classes generated by wsimport and CXF client are very
> >> similar. For HPRequestWS ss = new HPRequestWS();
> >>
> >> wsimport version:
> >> ss-->delegate: com.sun.xml.ws.client.WSServiceDelegate@16f5261
> >>
> >> CXF version:
> >> ss-->delegate: org.apache.cxf.jaxws.ServiceImpl@a1c582
> >>
> >> How can I force it use WSServiceDelegate not cxf ServiceImpl???
> >> Please help!
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: How to seperate with CXF

Posted by yulinxp <yu...@gmail.com>.
Could you pls give me some code snippets?
I don't know how to block the call to
getResource("META-INF/services/javax.xml.ws.spi.Provider")



dkulp wrote:
> 
> 
> Honestly, I'm not sure there IS a way.   I was hoping for at least a 
> system property, but looking at the code for jaxws-api, the system 
> property is actually checked last.  :-(
> 
> The only way I can come up with that MIGHT work is to create a special 
> classloader that blocks the call to 
> getResource("META-INF/services/javax.xml.ws.spi.Provider") and just 
> returns null.   Set the thread.contextClassLoader to that classloader 
> just before the call to "new HPRequestWS()".  Probably should reset it 
> back to the original when done.
> 
> Dan
> 
> 
> On Friday 29 February 2008, yulinxp wrote:
>> Those classes generated by wsimport and CXF client are very similar.
>> For HPRequestWS ss = new HPRequestWS();
>>
>> wsimport version:
>> ss-->delegate: com.sun.xml.ws.client.WSServiceDelegate@16f5261
>>
>> CXF version:
>> ss-->delegate: org.apache.cxf.jaxws.ServiceImpl@a1c582
>>
>> How can I force it use WSServiceDelegate not cxf ServiceImpl???
>> Please help!
> 
> 
> 
> -- 
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-seperate-with-CXF-tp15765424p15767488.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to seperate with CXF

Posted by yulinxp <yu...@gmail.com>.
Thank you so much for the help. 
Now There are three solutions.

1)use CXF client with the setAllowChunking(false) and cypher suits

2) Use ClassLoader to use JAX-WS RI, and update jaxb-api.jar jax-impl.jar
jaxws-api.jar with Metro's version

3)update existing CXF server service to use Simple Frontend+Aegis instead of
JAX-WS Frontend/JAXB, 
remove cxf-rt-frontend-jaxws.jar


-- 
View this message in context: http://www.nabble.com/How-to-seperate-with-CXF-tp15765424p15797937.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to seperate with CXF

Posted by Daniel Kulp <dk...@apache.org>.


On Saturday 01 March 2008, yulinxp wrote:

> I tried CXF client. I can connect to the server after setting
> allowChunking(false) and SSL.
> But there comes another exception. The result is null.

Did some debugging and apparently the server isn't liking any of the 
cypher suites we have set and is sending back an HTML page instead of a 
nice soap fault or something.  This probably relates to:
https://issues.apache.org/jira/browse/CXF-1456

Change the code for the TLS params to:

        TLSClientParameters tlsParams = new TLSClientParameters();
        tlsParams.setSecureSocketProtocol("SSL");
        tlsParams.getCipherSuites().add("SSL_RSA_WITH_3DES_EDE_CBC_SHA");
        tlsParams.getCipherSuites().add("SSL_RSA_WITH_RC4_128_MD5");
        httpConduit.setTlsClientParameters(tlsParams);

and it connects fine.   I now get back a proper soap message and 
a "Invalid SourceID, username or password." response.

Dan




>
> org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
> 	at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
>essage(ReadHeadersInterceptor.java:187) at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
>essage(ReadHeadersInterceptor.java:56) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>rChain.java:207) at
> org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:402) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe
>sponse(HTTPConduit.java:1948) at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HT
>TPConduit.java:1791) at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66
>) at
> org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndin
>gInterceptor.handleMessage(MessageSenderInterceptor.java:62) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercepto
>rChain.java:207) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254) at
> org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205) at
> org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73) at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135
>) at $Proxy27.getRequestIDsNDA(Unknown Source)
> 	at
> https.mdf_ingenixmedpoint_com.mdfwebservices.hprequest.HPRequestWSSoap
>_HPRequestWSSoap_Client.main(HPRequestWSSoap_HPRequestWSSoap_Client.jav
>a:82) Caused by: com.ctc.wstx.exc.WstxParsingException: Received event
> DTD, instead of START_ELEMENT or END_ELEMENT.
>  at [row,col {unknown-source}]: [1,89]
> 	at
> com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java
>:605) at
> com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:461)
> at
> com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1113)
> at
> org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleM
>essage(ReadHeadersInterceptor.java:85) ... 15 more
>
> Here is my source.
>
> public final class HPRequestWSSoap_HPRequestWSSoap_Client {
>
>     private static final QName SERVICE_NAME = new
> QName("https://mdf.ingenixmedpoint.com/MDFWebServices/HPRequest.asmx",
> "HPRequestWS");
>
>     private HPRequestWSSoap_HPRequestWSSoap_Client() {
>     }
>
>     public static void main(String args[]) throws Exception {
>
>     	int sourceID =1234;
>     	String strXML = xmlFile2String("C://test.xml");
>
>         HPRequestWS ss = new HPRequestWS();
>         HPRequestWSSoap port = ss.getHPRequestWSSoap();
>
>         org.apache.cxf.endpoint.Client client =
> ClientProxy.getClient(port); HTTPConduit httpConduit = (HTTPConduit)
> client.getConduit(); httpConduit.getClient().setAllowChunking(false);
>
>         TLSClientParameters tlsParams = new TLSClientParameters();
>         tlsParams.setSecureSocketProtocol("SSL");
>         httpConduit.setTlsClientParameters(tlsParams);
>
>         {
>         	System.out.println("Invoking getRequestIDsNDA...");
>
>
>         	javax.xml.ws.Holder<java.lang.Boolean> result = new
> javax.xml.ws.Holder<java.lang.Boolean>();
>         	javax.xml.ws.Holder<java.lang.String> response = new
> javax.xml.ws.Holder<java.lang.String>();
>             try{
>             	port.getRequestIDsNDA(sourceID, strXML, result,
> response);
>
>             } catch (SOAPFaultException e) {
>         		System.out.println(e.getMessage());
>
> 	        } catch (Exception e1) {
> 	        	e1.printStackTrace();
> 	        }
>
>         	System.out.println("result=" + result.value);
>         	System.out.println("response=" + response.value);
>
>         }
>
>         System.exit(0);
>     }
>
>     public static String xmlFile2String(String fileName)
>     {
>       try{
>         DocumentBuilderFactory documentBuilderFactory =
> DocumentBuilderFactory.newInstance();
>         InputSource inputSource = new InputSource(fileName);
>         Document document =
> documentBuilderFactory.newDocumentBuilder().parse(inputSource);
>         StringWriter sw = new StringWriter();
>         Transformer serializer =
> TransformerFactory.newInstance().newTransformer();
>         serializer.transform(new DOMSource(document), new
> StreamResult(sw)); return sw.toString();
>       }
>       catch (Exception e) {
>         e.printStackTrace();
>       }
>
>       return "";
>     }
>
> //test.xml
> <?xml version="1.0" encoding="UTF-8"?>
> <mdf-get-request>
>     <user-name>myUser</user-name>
>     <user-password>myPassword</user-password>
>     <source-id>1234</source-id>
>     <id-count>1</id-count>
> </mdf-get-request>



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: How to seperate with CXF

Posted by yulinxp <yu...@gmail.com>.
Using the ClassLoader, it does load in sun's jar. But there is some runtime
exception complaining:
Exception in thread "main" java.lang.NoSuchMethodError:
com.sun.xml.bind.api.JAXBRIContext.newInstance([Ljava/lang/Class;Ljava/util/Collection;Ljava/util/Map;Ljava/lang/String;ZLcom/sun/xml/bind/v2/model/annotation/RuntimeAnnotationReader;)Lcom/sun/xml/bind/api/JAXBRIContext;
I guess this is not a right solution for me.

I tried CXF client. I can connect to the server after setting
allowChunking(false) and SSL.
But there comes another exception. The result is null.

org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
	at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:187)
	at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:56)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:402)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1948)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1791)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
	at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
	at $Proxy27.getRequestIDsNDA(Unknown Source)
	at
https.mdf_ingenixmedpoint_com.mdfwebservices.hprequest.HPRequestWSSoap_HPRequestWSSoap_Client.main(HPRequestWSSoap_HPRequestWSSoap_Client.java:82)
Caused by: com.ctc.wstx.exc.WstxParsingException: Received event DTD,
instead of START_ELEMENT or END_ELEMENT.
 at [row,col {unknown-source}]: [1,89]
	at
com.ctc.wstx.sr.StreamScanner.constructWfcException(StreamScanner.java:605)
	at com.ctc.wstx.sr.StreamScanner.throwParseError(StreamScanner.java:461)
	at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1113)
	at
org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:85)
	... 15 more

Here is my source.

public final class HPRequestWSSoap_HPRequestWSSoap_Client {

    private static final QName SERVICE_NAME = new
QName("https://mdf.ingenixmedpoint.com/MDFWebServices/HPRequest.asmx",
"HPRequestWS");

    private HPRequestWSSoap_HPRequestWSSoap_Client() {
    }

    public static void main(String args[]) throws Exception {

    	int sourceID =1234;
    	String strXML = xmlFile2String("C://test.xml");
    	
        HPRequestWS ss = new HPRequestWS();
        HPRequestWSSoap port = ss.getHPRequestWSSoap();  

        org.apache.cxf.endpoint.Client client = ClientProxy.getClient(port);
        HTTPConduit httpConduit = (HTTPConduit) client.getConduit();  
        httpConduit.getClient().setAllowChunking(false); 
        
        TLSClientParameters tlsParams = new TLSClientParameters();
        tlsParams.setSecureSocketProtocol("SSL");
        httpConduit.setTlsClientParameters(tlsParams);         
        
        {
        	System.out.println("Invoking getRequestIDsNDA...");


        	javax.xml.ws.Holder<java.lang.Boolean> result = new
javax.xml.ws.Holder<java.lang.Boolean>();
        	javax.xml.ws.Holder<java.lang.String> response = new
javax.xml.ws.Holder<java.lang.String>();
            try{
            	port.getRequestIDsNDA(sourceID, strXML, result, response);
            	
            } catch (SOAPFaultException e) {
        		System.out.println(e.getMessage());

	        } catch (Exception e1) {
	        	e1.printStackTrace();
	        }
            
        	System.out.println("result=" + result.value);
        	System.out.println("response=" + response.value);

        } 
        
        System.exit(0);
    }

    public static String xmlFile2String(String fileName)
    {
      try{
        DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory.newInstance();
        InputSource inputSource = new InputSource(fileName);
        Document document =
documentBuilderFactory.newDocumentBuilder().parse(inputSource);
        StringWriter sw = new StringWriter();
        Transformer serializer =
TransformerFactory.newInstance().newTransformer();
        serializer.transform(new DOMSource(document), new StreamResult(sw));
        return sw.toString();
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      
      return "";
    }  

//test.xml
<?xml version="1.0" encoding="UTF-8"?>
<mdf-get-request>
    <user-name>myUser</user-name>
    <user-password>myPassword</user-password>
    <source-id>1234</source-id>
    <id-count>1</id-count>
</mdf-get-request>
-- 
View this message in context: http://www.nabble.com/How-to-seperate-with-CXF-tp15765424p15784001.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to seperate with CXF

Posted by Daniel Kulp <dk...@apache.org>.

That seems to be an OLD MS based service.  Most likely, turning chunking 
off will fix it.  

import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.transport.http.HTTPConduit;

        HPRequestWSSoap port = ss.getHPRequestWSSoap();  
        Client client = ClientProxy.getClient(port);
        HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
        httpConduit.getClient().setAllowChunking(false);

You might also need:

import org.apache.cxf.configuration.jsse.TLSClientParameters;

        TLSClientParameters tlsParams = new TLSClientParameters();
        tlsParams.setSecureSocketProtocol("SSL");
        httpConduit.setTlsClientParameters(tlsParams);


Dan




On Friday 29 February 2008, yulinxp wrote:
> I was trying to use cxf client. But it didn't work for me. Here is my
> post:
> http://www.nabble.com/client-SSL-question-td15564062.html#a15564062
>
> To summarize my problem:
> I need to access the web service here:
> https://mdf.ingenixmedpoint.com/mdfwebservices/hprequest.asmx?WSDL
> I can't connect to url directly because of the unknown host.
> I save that wsdl file and change <soap:address>
> <soap:address
> location="https://mdf.ingenixmedpoint.com/mdfwebservices/hprequest.asm
>x?WSDL"/>
>
> Now using NET, I can connect to it!  Using wsimport, I can connect
> too! But CXF client doesn't work! The message could be sent!
>
> Caused by: java.io.IOException: Not Found
>         at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRe
>sponse(HTTPConduit.java:1888)
>
> The exception doesn't make sense. So I guess this is a bug in cxf
> client.
>
> dkulp wrote:
> > That all said, can I ask the reason for NOT using CXF for the
> > client?
> >
> > Dan
> >
> > On Friday 29 February 2008, Daniel Kulp wrote:
> >> Honestly, I'm not sure there IS a way.   I was hoping for at least
> >> a system property, but looking at the code for jaxws-api, the
> >> system property is actually checked last.  :-(
> >>
> >> The only way I can come up with that MIGHT work is to create a
> >> special classloader that blocks the call to
> >> getResource("META-INF/services/javax.xml.ws.spi.Provider") and just
> >> returns null.   Set the thread.contextClassLoader to that
> >> classloader just before the call to "new HPRequestWS()".  Probably
> >> should reset it back to the original when done.
> >>
> >> Dan
> >>
> >> On Friday 29 February 2008, yulinxp wrote:
> >> > Those classes generated by wsimport and CXF client are very
> >> > similar. For HPRequestWS ss = new HPRequestWS();
> >> >
> >> > wsimport version:
> >> > ss-->delegate: com.sun.xml.ws.client.WSServiceDelegate@16f5261
> >> >
> >> > CXF version:
> >> > ss-->delegate: org.apache.cxf.jaxws.ServiceImpl@a1c582
> >> >
> >> > How can I force it use WSServiceDelegate not cxf ServiceImpl???
> >> > Please help!
> >
> > --
> > J. Daniel Kulp
> > Principal Engineer, IONA
> > dkulp@apache.org
> > http://www.dankulp.com/blog



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: How to seperate with CXF

Posted by yulinxp <yu...@gmail.com>.

Now using NET, I can connect to it!  Using wsimport, I can connect too!
But CXF client doesn't work! The message could be sent! 
                                                             ~~~~~~~~~~ I
mean could NOT. (typo again)


-- 
View this message in context: http://www.nabble.com/How-to-seperate-with-CXF-tp15765424p15767475.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to seperate with CXF

Posted by yulinxp <yu...@gmail.com>.
I was trying to use cxf client. But it didn't work for me. Here is my post:
http://www.nabble.com/client-SSL-question-td15564062.html#a15564062

To summarize my problem:
I need to access the web service here:
https://mdf.ingenixmedpoint.com/mdfwebservices/hprequest.asmx?WSDL
I can't connect to url directly because of the unknown host. 
I save that wsdl file and change <soap:address>
<soap:address
location="https://mdf.ingenixmedpoint.com/mdfwebservices/hprequest.asmx?WSDL"/>

Now using NET, I can connect to it!  Using wsimport, I can connect too!
But CXF client doesn't work! The message could be sent! 

Caused by: java.io.IOException: Not Found
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1888) 

The exception doesn't make sense. So I guess this is a bug in cxf client.




dkulp wrote:
> 
> 
> That all said, can I ask the reason for NOT using CXF for the client?
> 
> Dan
> 
> 
> On Friday 29 February 2008, Daniel Kulp wrote:
>> Honestly, I'm not sure there IS a way.   I was hoping for at least a
>> system property, but looking at the code for jaxws-api, the system
>> property is actually checked last.  :-(
>>
>> The only way I can come up with that MIGHT work is to create a special
>> classloader that blocks the call to
>> getResource("META-INF/services/javax.xml.ws.spi.Provider") and just
>> returns null.   Set the thread.contextClassLoader to that classloader
>> just before the call to "new HPRequestWS()".  Probably should reset it
>> back to the original when done.
>>
>> Dan
>>
>> On Friday 29 February 2008, yulinxp wrote:
>> > Those classes generated by wsimport and CXF client are very similar.
>> > For HPRequestWS ss = new HPRequestWS();
>> >
>> > wsimport version:
>> > ss-->delegate: com.sun.xml.ws.client.WSServiceDelegate@16f5261
>> >
>> > CXF version:
>> > ss-->delegate: org.apache.cxf.jaxws.ServiceImpl@a1c582
>> >
>> > How can I force it use WSServiceDelegate not cxf ServiceImpl???
>> > Please help!
> 
> 
> 
> -- 
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-seperate-with-CXF-tp15765424p15767473.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to seperate with CXF

Posted by Daniel Kulp <dk...@apache.org>.
That all said, can I ask the reason for NOT using CXF for the client?

Dan


On Friday 29 February 2008, Daniel Kulp wrote:
> Honestly, I'm not sure there IS a way.   I was hoping for at least a
> system property, but looking at the code for jaxws-api, the system
> property is actually checked last.  :-(
>
> The only way I can come up with that MIGHT work is to create a special
> classloader that blocks the call to
> getResource("META-INF/services/javax.xml.ws.spi.Provider") and just
> returns null.   Set the thread.contextClassLoader to that classloader
> just before the call to "new HPRequestWS()".  Probably should reset it
> back to the original when done.
>
> Dan
>
> On Friday 29 February 2008, yulinxp wrote:
> > Those classes generated by wsimport and CXF client are very similar.
> > For HPRequestWS ss = new HPRequestWS();
> >
> > wsimport version:
> > ss-->delegate: com.sun.xml.ws.client.WSServiceDelegate@16f5261
> >
> > CXF version:
> > ss-->delegate: org.apache.cxf.jaxws.ServiceImpl@a1c582
> >
> > How can I force it use WSServiceDelegate not cxf ServiceImpl???
> > Please help!



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: How to seperate with CXF

Posted by Daniel Kulp <dk...@apache.org>.
Honestly, I'm not sure there IS a way.   I was hoping for at least a 
system property, but looking at the code for jaxws-api, the system 
property is actually checked last.  :-(

The only way I can come up with that MIGHT work is to create a special 
classloader that blocks the call to 
getResource("META-INF/services/javax.xml.ws.spi.Provider") and just 
returns null.   Set the thread.contextClassLoader to that classloader 
just before the call to "new HPRequestWS()".  Probably should reset it 
back to the original when done.

Dan


On Friday 29 February 2008, yulinxp wrote:
> Those classes generated by wsimport and CXF client are very similar.
> For HPRequestWS ss = new HPRequestWS();
>
> wsimport version:
> ss-->delegate: com.sun.xml.ws.client.WSServiceDelegate@16f5261
>
> CXF version:
> ss-->delegate: org.apache.cxf.jaxws.ServiceImpl@a1c582
>
> How can I force it use WSServiceDelegate not cxf ServiceImpl???
> Please help!



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

Re: How to seperate with CXF

Posted by yulinxp <yu...@gmail.com>.
Those classes generated by wsimport and CXF client are very similar.
For HPRequestWS ss = new HPRequestWS();

wsimport version:
ss-->delegate: com.sun.xml.ws.client.WSServiceDelegate@16f5261

CXF version:
ss-->delegate: org.apache.cxf.jaxws.ServiceImpl@a1c582

How can I force it use WSServiceDelegate not cxf ServiceImpl???
Please help!
-- 
View this message in context: http://www.nabble.com/How-to-seperate-with-CXF-tp15765424p15766289.html
Sent from the cxf-user mailing list archive at Nabble.com.