Skip to Main Content

Java Programming

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!

wsdl client java authentication

897874Nov 16 2011 — edited Nov 16 2011
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) {
System.out.println("___ERROR___");
System.out.println(ex);
}

Thank you in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 14 2011
Added on Nov 16 2011
5 comments
631 views