Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

UnknownHostException trying to connect to WebService

843833Jun 9 2005 — edited Apr 26 2007
Hi, I have to connect to a WebService and get the following error when running my client-program.
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.net.UnknownHostException: ollilap.hsh-berlin.com
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:java.net.UnknownHostException: ollilap.hsh-berlin.com
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
        at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)
        at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:181)
        at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:397)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:135)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2754)
        at org.apache.axis.client.Call.invoke(Call.java:2737)
        at org.apache.axis.client.Call.invoke(Call.java:2413)
        at org.apache.axis.client.Call.invoke(Call.java:2336)
        at org.apache.axis.client.Call.invoke(Call.java:1793)
        at Test.runIt(Test.java:51)
        at Test.main(Test.java:24)

        {http://xml.apache.org/axis/}hostname:Dell1

java.net.UnknownHostException: ollilap.hsh-berlin.com
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)

        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2754)
        at org.apache.axis.client.Call.invoke(Call.java:2737)
        at org.apache.axis.client.Call.invoke(Call.java:2413)
        at org.apache.axis.client.Call.invoke(Call.java:2336)
        at org.apache.axis.client.Call.invoke(Call.java:1793)
        at Test.runIt(Test.java:51)
        at Test.main(Test.java:24)
Caused by: java.net.UnknownHostException: ollilap.hsh-berlin.com
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.<init>(Unknown Source)
        at com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl.createSocket(Unknown Source)
        at org.apache.axis.components.net.JSSESocketFactory.create(JSSESocketFactory.java:92)
        at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:181)
        at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:397)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:135)

        ... 11 more
My Test.java looks like this:
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URL;
import java.security.Security;

import org.apache.axis.Constants;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLReaderFactory;

import javax.xml.rpc.ParameterMode;

public class Test
{
	public static void main(String [] args) throws Exception {
		try {
			runIt();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}

	private static void runIt() throws Exception {
		System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");
		Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
		System.setProperty("javax.net.ssl.trustStore","C:/java/olliclientkeystore");

		String ret = "";
		String endpoint = "https://ollilap.hsh-berlin.com:8443/axis/services/MesoWebService";
		Service service;
		Call call;

		service = new Service();
		call = (Call) service.createCall();
		call.setTargetEndpointAddress(new URL(endpoint));
		call.setOperationName("Operation1");
		call.addParameter("Param1", Constants.XSD_STRING, ParameterMode.IN);
		call.addParameter("Param2", Constants.XSD_STRING, ParameterMode.IN);
		call.addParameter("Param3", Constants.XSD_STRING, ParameterMode.IN);
		call.addParameter("Param4", Constants.XSD_INT, ParameterMode.IN);
		call.setReturnType( XMLType.XSD_STRING );
		call.setUsername("user1");
		call.setPassword("pass1");
		ret = (String) call.invoke(new Object[] {"xxx",null,null, new int[] {1,3,5}});

		File f = new File("C:\\WebService.xml");
		if (f.exists() && f.canWrite()) {
			f.delete();
		}
		try {
			FileWriter write = new FileWriter("C:\\WebService.xml",true);
			write.write(ret);
			write.close();
		} catch(IOException e) {
			e.printStackTrace();
		}
	}
}
I know that the host exists so that can't be the error (?).
It would be great if anybody could give me a hint how to solve the problem - I'm running out of ideas.
(Please help a newbie!)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 24 2007
Added on Jun 9 2005
3 comments
12,089 views