This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Not Authorized as response connecting Webservice in a trusted Domain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Not Authorized as response connecting Webservice in a trusted Domain " Watch "Not Authorized as response connecting Webservice in a trusted Domain " New topic
Author

Not Authorized as response connecting Webservice in a trusted Domain

mark issac
Greenhorn

Joined: Oct 07, 2004
Posts: 5
Hi
I try to call a Webservice via java, the webservice is loacated on a IIS-server.
The security setup created as a trusted Domain so I do not have to Connect with a Username and Password. The Webservice should know Who I am since I am in the same network.
It seems to be a problem to get Information fram the Service. At all I do not get Acces.
Anybody have same problem or experiance with this.
I use following Code to access the Webservice. If anybody have other suggestions I am willing to try that.

My Code.
import org.apache.soap.*;
import org.apache.soap.messaging.*;
import org.apache.soap.transport.http.*;
import javax.activation.*;
import org.xml.sax.*;
import java.io.*;
import java.util.Iterator;
public class JavaAgent {

Public void NotesMain() {
try {

String retval = "";

String url ="http://xxxxxxxxx.asmx";
System.out.println("url"+url);
String TargetNamespace ="http://tempuri.org/";

String SOAPAction ="http://tempuri.org/GetFunctione1";


if (url == null) {
throw new org.apache.soap.SOAPException(Constants.FAULT_CODE_CLIENT,
"A URL must be specified via " +
"SoapBuildersExSoapProxy.setEndPoint(URL).");
}

// Instantiate the message and the envelope.
// The message sends the envelope and gets
// the response.
Message message = new Message();
Envelope env = new Envelope();
DataHandler soapMsg = null;

// Get this from the soapAction attribute on the
// soapperation element that is found within the SOAP
// binding information in the WSDL.
MessageBody theBody = new MessageBody();

theBody.orgId ="C42F504C40BB0A1EC1256F3F0032A80B";
theBody.dokType="6";

// Replace the default body with our own.
env.setBody( theBody );
message.send(new java.net.URL(url) , SOAPAction, env );
try{
// Because the Body.unmarshall handler is static,
// you cannot replace the basic machinery easily.
// Instead, you must obtain and parse the
// message on your own.
soapMsg = message.receive();

System.out.println( "***Result***: " + soapMsg.getContent().toString());
} catch ( Exception e ) {
System.out.println( "***Exception***: " + e.toString() );
}


} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
JavaAgent ja = new JavaAgent();
ja.NotesMain();
}
}
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Not Authorized as response connecting Webservice in a trusted Domain
 
Similar Threads
Which Java SOAP library for .NET access?
Need to invoke SOAP msg with standalone java class
Prob. logging in calling a Webservice on Dot-net server
Call .NET Web Service From JAVA Client
SOAPException: Error opening socket