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
[EMAIL PROTECTED]
http://www.dankulp.com/blog

Reply via email to