Reputation: 153
I've created I JAX-WS client to call a remote web-services. The call is performed via over ssl tunnel and there is a middle proxy. This is the code of the method call :
RemoteWSCredentials cred = new RemoteWSCredentials();
cred.setUserid("username");
cred.setPassword("password");
URL url = new URL("https://hostname/webservicelocation"); //the exposed url
System.setProperty("https.proxyHost", "ipHostnameProxy"); //set proxy properties
System.setProperty("https.proxyPort", "portProxy");
try {
SSLContext sslContext = SSLContext.getInstance("SSL"); //instance SSLContext
// set up a TrustManager that trusts everything
sslContext.init(null, new TrustManager[]{new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs,
String authType) {
}
public void checkServerTrusted(X509Certificate[] certs,
String authType) {
}
}}, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(
sslContext.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
public boolean verify(String arg0, SSLSession arg1) {
return true;
}
});
} catch (KeyManagementException ex) {
System.err.println("KeyManagementException: " + ex.getMessage());
} catch (NoSuchAlgorithmException ex) {
System.err.println("NoSuchAlgorithmException: " + ex.getMessage());
}
RemoteWSService ws = new RemoteWSService(url); //instance WS Service
boolean result = ws.exposedService(cred);
The code fail at RemoteWSService ws = new RemoteWSService(url);. The exception reported is :
Exception in thread "main" com.sun.xml.internal.ws.streaming.XMLStreamReaderException: XML reader error: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[14,3] Message: The element type "meta" must be terminated by the matching end-tag "".
and it's cause by:
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[14,3] Message: The element type "meta" must be terminated by the matching end-tag "".
Now i don't know where the web-services is deployed. When i try to call it on my local machine and call a test url exposed without ssl tunnel and proxy, the code work fine.
can someone help me, please?
Upvotes: 1
Views: 6774
Reputation: 153
Well, I resolved it. The error was tha I called an incomplete URL, for example: I called 'hostname/webservicelocation' ; but the complete url is 'hostname/webservicelocation/service/RemoteService' ;. I don't understand why has been caught a com.sun.xml.internal.ws.streaming.XMLStreamReaderException!!! thanks anyway to everyone!!!! bye
Upvotes: 3