Hello programmers,

1. could give me an example code how to set up username and password for the service, which have been created using wsdl file, which has been given from web service creators on other side of the world. Web service client has been created using NetBeans IDE.

When it tries to call invoke method it gives me:
HTTP transport error: java.net.ConnectException: Connection refused: connect

So I see there is no authentication I guess.

2. How do I set proxy settings? Is this necessary and why?

xyzService service = new xyzService();

        QName portQName = new QName("http://xmlns.oracle.com/...", "x_y_zPort");
        String req = "<INSERT_RECEIVES  xmlns=\"http://xmlns.oracle.com/...\"><parameters>ENTER VALUE</parameters></INSERT_RECEIVES>";

        try { // Call Web Service Operation

            Dispatch<Source> sourceDispatch = null;
            sourceDispatch = service.createDispatch(portQName, Source.class, Service.Mode.PAYLOAD);
            Source result = sourceDispatch.invoke(new StreamSource(new StringReader(req)));
        } catch (Exception ex) {


It is obviously only needed if you are using a proxy. You should know whether this is the case or not. If not, ask your network administrators, both for whether or not one is in use, as well as its address.

Edit: And the connection refused could just as easily be coming from the proxy as from the wsdl. Solve that first.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.