• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not Authorized as response connecting Webservice in a trusted Domain

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
}
}
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic