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.